[FFmpeg-trac] #8037(avformat:open): Incorrect HLS segment duration after 64350th frame with -hls_init_time
FFmpeg
trac at avcodec.org
Fri Jul 26 11:43:38 EEST 2019
#8037: Incorrect HLS segment duration after 64350th frame with -hls_init_time
-------------------------------------+-------------------------------------
Reporter: DusanBrejka | Owner: stevenliu
Type: defect | Status: open
Priority: normal | Component: avformat
Version: git-master | Resolution:
Keywords: hls mpegts | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by DusanBrejka):
Interesting, I'm getting different results with the patch applied:
{{{
ubuntu at ip-172-31-0-112:~/ffmpegtemp/ffmpeg$ ./ffmpeg -v quiet -report -f
lavfi -i testsrc=size=5x5:rate=30:duration=2200 -g 30 -f hls -hls_time 4
-hls_init_time 1 -start_number 540 -hls_segment_filename "hls/%03d.ts"
-t 2160 "hls/master.m3u8"
ubuntu at ip-172-31-0-112:~/ffmpegtemp/ffmpeg$ cat hls/master.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:1
#EXT-X-MEDIA-SEQUENCE:1091
#EXTINF:1.000000,
1091.ts
#EXTINF:1.000000,
1092.ts
#EXTINF:1.000000,
1093.ts
#EXTINF:1.000000,
1094.ts
#EXTINF:1.000000,
1095.ts
#EXT-X-ENDLIST
ubuntu at ip-172-31-0-112:~/ffmpegtemp/ffmpeg$ git diff
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 2ade6723f9..51310fb528 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2301,8 +2301,8 @@ static int hls_write_packet(AVFormatContext *s,
AVPacket *pkt)
if (vs->sequence - vs->nb_entries > hls->start_sequence &&
hls->init_time > 0) {
/* reset end_pts, hls->recording_time at end of the init hls list
*/
- int init_list_dur = hls->init_time * vs->nb_entries *
AV_TIME_BASE;
- int after_init_list_dur = (vs->sequence - hls->start_sequence -
vs->nb_entries ) * (hls->time * AV_TIME_BASE);
+ int64_t init_list_dur = hls->init_time * vs->nb_entries *
AV_TIME_BASE;
+ int64_t after_init_list_dur = (vs->sequence - hls->start_sequence
- vs->nb_entries ) * (hls->time * AV_TIME_BASE);
hls->recording_time = hls->time * AV_TIME_BASE;
end_pts = init_list_dur + after_init_list_dur ;
}
ubuntu at ip-172-31-0-112:~/ffmpegtemp/ffmpeg$ git branch
* master
ubuntu at ip-172-31-0-112:~/ffmpegtemp/ffmpeg$ ./ffmpeg -version
ffmpeg version N-94387-g923d5c489f Copyright (c) 2000-2019 the FFmpeg
developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --enable-gpl --disable-stripping --enable-avresample
--disable-filter=resample --enable-avisynth --enable-gnutls --enable-
ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libcaca
--enable-libcdio --enable-libcodec2 --enable-libfontconfig --enable-
libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-
libjack --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt
--enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband
--enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex
--enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265
--enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi
--enable-lv2 --enable-openal --enable-opengl --enable-sdl2 --enable-
nonfree --enable-libfdk-aac --enable-libdrm --enable-chromaprint --enable-
frei0r --enable-libx264 --enable-shared
libavutil 56. 32.100 / 56. 22.100
libavcodec 58. 55.100 / 58. 35.100
libavformat 58. 30.100 / 58. 20.100
libavdevice 58. 9.100 / 58. 5.100
libavfilter 7. 58.100 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 6.100 / 5. 3.100
libswresample 3. 6.100 / 3. 3.100
libpostproc 55. 6.100 / 55. 3.100
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8037#comment:7>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list