Opened 10 years ago
Last modified 7 years ago
#4733 new defect
HLS segmenting generates different EXT-X-TARGETDURATION values for different resolutions/framerates
Reported by: | Lushi | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | HLS TARGETDURATION |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
I am trying to encode a video to HLS in multiple bitrates (and, therefore, according to apple's recommendations, multiple frame rates).
I can get one HLS working fine when I have a single variant. But when I have variants, I sometimes get different segment durations and, therefore, different TARGETDURATION (since they have different maxes). This means that the variants can't be used together.
For example, here are the first few lines of the m3u8 file of the same video encoded a 15 fps and 30 fps. Note the durations of the first segments have _different_lengths_. Also the TARGETDURATION is different.
#EXT-X-TARGETDURATION:10 #EXTINF:9.023222, 480_0.ts
#EXT-X-TARGETDURATION:10 #EXTINF:9.023222, 640_0.ts
#EXT-X-TARGETDURATION:9 #EXTINF:9.000000, 960_0.ts
I have already posted to ffmpeg-users and discussed it on #ffmpeg irc.
Here are the links to a more complete writeup:
http://ffmpeg-users.933282.n4.nabble.com/HLS-segment-duration-for-multiple-framerate-encoding-td4671498.html
http://pastebin.com/JqxiMe3U
How to reproduce:
Source video file:http://www.caminandes.com/download/01_llama_drama_1080p.zip
full logs with -v 9 -loglevel 99 are attached
ENCODING 1
%./ffmpeg -y -i ../infile.mp4 -pix_fmt yuv420p -vbsf h264_mp4toannexb -flags -global_header -vcodec libx264 -strict -2 -acodec aac -r 15 -profile:v baseline -level 3 -b:v 1632k -maxrate 1746.24k -keyint_min 45 -g 45 -sc_threshold 0 -vf scale=480:-1 -hls_list_size 0 -hls_time 9 480_.m3u8 ffmpeg version N-48432-ga176bbc-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.9.3 (Debian 4.9.3-1) configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --cc=gcc-4.9 libavutil 54. 28.100 / 54. 28.100 libavcodec 56. 52.100 / 56. 52.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 27.100 / 5. 27.100 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../infile.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2013-02-08 18:56:45 Duration: 00:01:30.00, start: 0.000000, bitrate: 3120 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 2925 kb/s, 24 fps, 24 tbr, 48 tbn, 48 tbc (default) Metadata: creation_time : 1970-01-01 00:00:00 handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 191 kb/s (default) Metadata: creation_time : 2013-02-08 18:56:46 handler_name : IsoMedia File Produced by Google, 5-11-2011 [libx264 @ 0x3a12de0] VBV maxrate specified, but no bufsize, ignored [libx264 @ 0x3a12de0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [libx264 @ 0x3a12de0] profile Constrained Baseline, level 3.0 Output #0, hls, to '480_.m3u8': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 encoder : Lavf56.40.101 Stream #0:0(und): Video: h264 (libx264), yuv420p, 480x270, q=-1--1, 1632 kb/s, 15 fps, 90k tbn, 15 tbc (default) Metadata: creation_time : 1970-01-01 00:00:00 handler_name : VideoHandler encoder : Lavc56.52.100 libx264 Stream #0:1(und): Audio: aac, 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: creation_time : 2013-02-08 18:56:46 handler_name : IsoMedia File Produced by Google, 5-11-2011 encoder : Lavc56.52.100 aac Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (aac (native) -> aac (native)) Press [q] to stop, [?] for help frame= 1352 fps=123 q=-1.0 Lsize=N/A time=00:01:30.13 bitrate=N/A dup=0 drop=808 video:16495kB audio:1394kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown [libx264 @ 0x3a12de0] frame I:31 Avg QP: 3.48 size: 58339 [libx264 @ 0x3a12de0] frame P:1321 Avg QP: 5.84 size: 11418 [libx264 @ 0x3a12de0] mb I I16..4: 31.5% 0.0% 68.5% [libx264 @ 0x3a12de0] mb P I16..4: 2.7% 0.0% 5.5% P16..4: 45.3% 6.5% 8.2% 0.0% 0.0% skip:31.8% [libx264 @ 0x3a12de0] final ratefactor: 7.75 [libx264 @ 0x3a12de0] coded y,uvDC,uvAC intra: 86.8% 89.0% 88.6% inter: 45.3% 49.2% 47.7% [libx264 @ 0x3a12de0] i16 v,h,dc,p: 34% 34% 18% 14% [libx264 @ 0x3a12de0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 39% 12% 4% 5% 5% 8% 4% 7% [libx264 @ 0x3a12de0] i8c dc,h,v,p: 46% 39% 8% 8% [libx264 @ 0x3a12de0] ref P L0: 90.2% 6.3% 3.5% [libx264 @ 0x3a12de0] kb/s:1499.21
ENCODING 2
%./ffmpeg -y -i ../infile.mp4 -pix_fmt yuv420p -vbsf h264_mp4toannexb -flags -global_header -vcodec libx264 -strict -2 -acodec aac -r 30 -profile:v main -level 3.1 -b:v 1568k -maxrate 1677.76k -keyint_min 90 -g 90 -sc_threshold 0 -vf scale=960:-1 -hls_list_size 0 -hls_time 9 960_.m3u8 ffmpeg version N-48432-ga176bbc-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.9.3 (Debian 4.9.3-1) configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --cc=gcc-4.9 libavutil 54. 28.100 / 54. 28.100 libavcodec 56. 52.100 / 56. 52.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 27.100 / 5. 27.100 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../infile.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2013-02-08 18:56:45 Duration: 00:01:30.00, start: 0.000000, bitrate: 3120 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 2925 kb/s, 24 fps, 24 tbr, 48 tbn, 48 tbc (default) Metadata: creation_time : 1970-01-01 00:00:00 handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 191 kb/s (default) Metadata: creation_time : 2013-02-08 18:56:46 handler_name : IsoMedia File Produced by Google, 5-11-2011 [libx264 @ 0x3350de0] VBV maxrate specified, but no bufsize, ignored [libx264 @ 0x3350de0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [libx264 @ 0x3350de0] profile Main, level 3.1 Output #0, hls, to '960_.m3u8': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 encoder : Lavf56.40.101 Stream #0:0(und): Video: h264 (libx264), yuv420p, 960x540, q=-1--1, 1568 kb/s, 30 fps, 90k tbn, 30 tbc (default) Metadata: creation_time : 1970-01-01 00:00:00 handler_name : VideoHandler encoder : Lavc56.52.100 libx264 Stream #0:1(und): Audio: aac, 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: creation_time : 2013-02-08 18:56:46 handler_name : IsoMedia File Produced by Google, 5-11-2011 encoder : Lavc56.52.100 aac Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (aac (native) -> aac (native)) Press [q] to stop, [?] for help frame= 2700 fps=108 q=-1.0 Lsize=N/A time=00:01:30.00 bitrate=N/A dup=540 drop=0 video:16105kB audio:1394kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown [libx264 @ 0x3350de0] frame I:30 Avg QP:10.99 size: 99460 [libx264 @ 0x3350de0] frame P:974 Avg QP:13.39 size: 11549 [libx264 @ 0x3350de0] frame B:1696 Avg QP:17.09 size: 1332 [libx264 @ 0x3350de0] consecutive B-frames: 15.3% 2.1% 2.7% 80.0% [libx264 @ 0x3350de0] mb I I16..4: 29.2% 0.0% 70.8% [libx264 @ 0x3350de0] mb P I16..4: 5.9% 0.0% 6.1% P16..4: 26.1% 8.0% 7.6% 0.0% 0.0% skip:46.4% [libx264 @ 0x3350de0] mb B I16..4: 0.1% 0.0% 0.2% B16..8: 16.1% 1.9% 0.7% direct: 1.3% skip:79.8% L0:37.9% L1:56.3% BI: 5.8% [libx264 @ 0x3350de0] final ratefactor: 15.30 [libx264 @ 0x3350de0] coded y,uvDC,uvAC intra: 52.5% 73.7% 39.7% inter: 7.3% 13.4% 1.9% [libx264 @ 0x3350de0] i16 v,h,dc,p: 34% 38% 10% 18% [libx264 @ 0x3350de0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 32% 16% 4% 5% 5% 6% 4% 6% [libx264 @ 0x3350de0] i8c dc,h,v,p: 50% 33% 13% 5% [libx264 @ 0x3350de0] Weighted P-Frames: Y:12.8% UV:6.7% [libx264 @ 0x3350de0] ref P L0: 72.2% 10.2% 12.0% 5.3% 0.3% [libx264 @ 0x3350de0] ref B L0: 92.6% 6.1% 1.3% [libx264 @ 0x3350de0] ref B L1: 95.1% 4.9% [libx264 @ 0x3350de0] kb/s:1465.93
Attachments (4)
Change History (5)
by , 10 years ago
comment:1 by , 7 years ago
Perhaps this bug is related to https://trac.ffmpeg.org/ticket/7073 ?
Only that in the ticket #7073, with variant streams, all other variant streams have the TARGETDURATION set to 0, whereas the first variant stream has the correct target duration set?
./ffmpeg -v 9 -loglevel 99 output