[FFmpeg-trac] #6533(avformat:open): Invalid EXT-X-TARGETDURATION in HLS
FFmpeg
trac at avcodec.org
Tue Jul 18 18:39:59 EEST 2017
#6533: Invalid EXT-X-TARGETDURATION in HLS
-------------------------------------+------------------------------------
Reporter: tonn81 | Owner:
Type: defect | Status: open
Priority: normal | Component: avformat
Version: unspecified | Resolution:
Keywords: hls | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+------------------------------------
Changes (by stevenliu):
* status: new => open
Comment:
Replying to [comment:1 tonn81]:
> I gave it another try with separate chunks:
> {{{
> ffmpeg -loglevel info -i file.mp4 -c:a copy -hls_time 4 -hls_list_size 0
file.m3u8
> }}}
>
> Then I've checked the duration of every chunk with ffprobe:
> {{{
> Duration: 00:00:04.02, start: 1.400000, bitrate: 89 kb/s
the duration is 5 when the *segment duration* big than the 4, eg: 4.02 is
biger than 4.000000;
if the *segment duration* == 4, then the EXT-X-TARGETDURATION will 4.
> Duration: 00:00:03.88, start: 5.417056, bitrate: 91 kb/s
> Duration: 00:00:03.90, start: 9.410889, bitrate: 89 kb/s
> Duration: 00:00:03.88, start: 13.404722, bitrate: 90 kb/s
> Duration: 00:00:03.92, start: 17.421778, bitrate: 89 kb/s
> Duration: 00:00:03.92, start: 21.415600, bitrate: 89 kb/s
> Duration: 00:00:03.88, start: 25.409433, bitrate: 91 kb/s
> Duration: 00:00:03.88, start: 29.403267, bitrate: 91 kb/s
> Duration: 00:00:03.88, start: 33.420322, bitrate: 91 kb/s
> Duration: 00:00:03.85, start: 37.414156, bitrate: 92 kb/s
> Duration: 00:00:03.85, start: 41.407989, bitrate: 91 kb/s
> Duration: 00:00:03.90, start: 45.401822, bitrate: 90 kb/s
> Duration: 00:00:03.85, start: 49.418867, bitrate: 92 kb/s
> Duration: 00:00:03.92, start: 53.412700, bitrate: 89 kb/s
> Duration: 00:00:03.90, start: 57.406533, bitrate: 89 kb/s
> Duration: 00:00:00.02, start: 61.400367, bitrate: 388 kb/s
> }}}
>
> Maybe the reason is that first chunk is > 4 seconds and got rounded to
5.
>
> Regarding the code:
>
> Function that generates the text:
> {{{
> static void write_m3u8_head_block(HLSContext *hls, AVIOContext *out, int
version,
> int target_duration, int64_t sequence)
> {
> avio_printf(out, "#EXTM3U\n");
> avio_printf(out, "#EXT-X-VERSION:%d\n", version);
> if (hls->allowcache == 0 || hls->allowcache == 1) {
> avio_printf(out, "#EXT-X-ALLOW-CACHE:%s\n", hls->allowcache == 0
? "NO" : "YES");
> }
> avio_printf(out, "#EXT-X-TARGETDURATION:%d\n", target_duration);
> avio_printf(out, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence);
> if (hls->segment_type == SEGMENT_TYPE_FMP4) {
> avio_printf(out, "#EXT-X-MAP:URI=\"%s\"\n",
hls->fmp4_init_filename);
> }
> av_log(hls, AV_LOG_VERBOSE, "EXT-X-MEDIA-SEQUENCE:%"PRId64"\n",
sequence);
> }
> }}}
>
> Code that change the duration:
> {{{
> for (en = hls->segments; en; en = en->next) {
> if (target_duration <= en->duration)
> target_duration = get_int_from_double(en->duration);
> }
> }}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/6533#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list