[FFmpeg-trac] #2708(avformat:new): Muxing H.264+AAC in M4V results in initial empty edits
FFmpeg
trac at avcodec.org
Tue Jun 25 02:40:07 CEST 2013
#2708: Muxing H.264+AAC in M4V results in initial empty edits
------------------------------------+--------------------------------------
Reporter: MarkZV | Type: defect
Status: new | Priority: normal
Component: avformat | Version: git-master
Keywords: regression | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+--------------------------------------
Muxing H.264+AAC in M4V (ipod muxer) results in initial empty edits in the
video and audio track edit lists. It works as expected (no empty edits)
with MP4 output, and with ffmpeg 1.2.1.
An empty edit in a track's edit list indicates a time with no
corresponding media, and is useful if the audio should begin after the
video or vice versa. However in the example below, ffmpeg adds empty
edits on both the audio and video tracks, which means that there is no
media at all for the first several milliseconds.
{{{
$ ffmpeg -v 9 -loglevel 99 -filter_complex
"testsrc=n=2;aevalsrc=sin(440*2*PI*t)" -pix_fmt yuv420p -t 3 out.m4v
ffmpeg version 1.1.git-bbe26ef Copyright (c) 2000-2013 the FFmpeg
developers
built on Jun 24 2013 14:49:49 with gcc 4.2.1 (GCC) (Apple Inc. build
5666) (dot 3)
configuration: --prefix=/opt/local --enable-swscale --enable-avfilter
--enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora
--enable-libschroedinger --enable-libopenjpeg --enable-libmodplug
--enable-libvpx --enable-libspeex --enable-libass --enable-libbluray
--enable-gnutls --enable-libfreetype --mandir=/opt/local/share/man
--enable-shared --enable-pthreads --cc=/usr/bin/gcc-4.2 --arch=x86_64
--enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-
libxvid --enable-version3 --enable-libopencore-amrnb --enable-libopencore-
amrwb --enable-nonfree --enable-libfdk-aac --enable-libfaac
libavutil 52. 37.101 / 52. 37.101
libavcodec 55. 17.100 / 55. 17.100
libavformat 55. 9.100 / 55. 9.100
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 77.101 / 3. 77.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with
argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument '99'.
Reading option '-filter_complex' ... matched as option 'filter_complex'
(create a complex filtergraph) with argument
'testsrc=n=2;aevalsrc=sin(440*2*PI*t)'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
format) with argument 'yuv420p'.
Reading option '-t' ... matched as option 't' (record or transcode
"duration" seconds of audio/video) with argument '3'.
Reading option 'out.m4v' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Applying option filter_complex (create a complex filtergraph) with
argument testsrc=n=2;aevalsrc=sin(440*2*PI*t).
Successfully parsed a group of options.
Parsing a group of options: output file out.m4v.
Applying option pix_fmt (set pixel format) with argument yuv420p.
Applying option t (record or transcode "duration" seconds of audio/video)
with argument 3.
Successfully parsed a group of options.
Opening an output file: out.m4v.
detected 4 logical cores
[Parsed_testsrc_0 @ 0x103100000] Setting 'n' to value '2'
[Parsed_testsrc_0 @ 0x103100000] size:320x240 rate:25/1 duration:-1.000000
sar:1/1
[Parsed_aevalsrc_1 @ 0x1031003e0] compat: called with
args=[sin(440*2*PI*t)]
[Parsed_aevalsrc_1 @ 0x1031003e0] Setting 'exprs' to value
'sin(440*2*PI*t)'
[format @ 0x1031012c0] compat: called with args=[yuv420p]
[format @ 0x1031012c0] Setting 'pix_fmts' to value 'yuv420p'
[audio format for output stream 0:1 @ 0x103101ec0] Setting 'sample_fmts'
to value 's16'
[audio format for output stream 0:1 @ 0x103101ec0] Setting
'channel_layouts' to value '0x4|0x3|0x7|0x107|0x37|0x3f'
Successfully opened the file.
[auto-inserted scaler 0 @ 0x103102880] w:iw h:ih flags:'bilinear' interl:0
[format @ 0x1031012c0] auto-inserting filter 'auto-inserted scaler 0'
between the filter 'Parsed_testsrc_0' and the filter 'format'
[audio format for output stream 0:1 @ 0x103101ec0] auto-inserting filter
'auto-inserted resampler 0' between the filter 'Parsed_aevalsrc_1' and the
filter 'audio format for output stream 0:1'
[AVFilterGraph @ 0x1024217e0] query_formats: 6 queried, 8 merged, 4
already done, 0 delayed
[auto-inserted scaler 0 @ 0x103102880] w:320 h:240 fmt:rgb24 sar:1/1 ->
w:320 h:240 fmt:yuv420p sar:1/1 flags:0x2
[Parsed_aevalsrc_1 @ 0x1031003e0] sample_rate:44100 chlayout:mono
duration:-1.000000
[auto-inserted resampler 0 @ 0x103102f00] [SWR @ 0x10380b000] Using double
precision mode
[auto-inserted resampler 0 @ 0x103102f00] ch:1 chl:mono fmt:dblp r:44100Hz
-> ch:1 chl:mono fmt:s16 r:44100Hz
[libx264 @ 0x103800600] using mv_range_thread = 24
[libx264 @ 0x103800600] using SAR=1/1
[libx264 @ 0x103800600] using cpu capabilities: MMX2 SSE2Fast SSSE3
Cache64
[libx264 @ 0x103800600] profile High, level 1.3
[libx264 @ 0x103800600] 264 - core 129 - H.264/MPEG-4 AVC codec - Copyleft
2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3
deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0
deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6
lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, ipod, to 'out.m4v':
Metadata:
encoder : Lavf55.9.100
Stream #0:0, 0, 1/12800: Video: h264 (libx264) (avc1 / 0x31637661),
yuv420p, 320x240 [SAR 1:1 DAR 4:3], 1/25, q=-1--1, 12800 tbn, 25 tbc
Stream #0:1, 0, 1/44100: Audio: aac (libfaac) (mp4a / 0x6134706D),
44100 Hz, mono, s16, 128 kb/s
Stream mapping:
testsrc -> Stream #0:0 (libx264)
aevalsrc -> Stream #0:1 (libfaac)
Press [q] to stop, [?] for help
[libx264 @ 0x103800600] frame= 0 QP=22.89 NAL=3 Slice:I Poc:0 I:300
P:0 SKIP:0 size=3173 bytes
[libx264 @ 0x103800600] frame= 1 QP=19.64 NAL=2 Slice:P Poc:4 I:12
P:53 SKIP:235 size=488 bytes
[libx264 @ 0x103800600] frame= 2 QP=23.99 NAL=0 Slice:B Poc:2 I:3
P:18 SKIP:279 size=130 bytes
[libx264 @ 0x103800600] frame= 3 QP=20.04 NAL=2 Slice:P Poc:10 I:20
P:45 SKIP:235 size=571 bytes
[libx264 @ 0x103800600] frame= 4 QP=23.77 NAL=2 Slice:B Poc:8 I:6
P:18 SKIP:274 size=188 bytes
[libx264 @ 0x103800600] frame= 5 QP=24.48 NAL=0 Slice:B Poc:6 I:4
P:18 SKIP:277 size=87 bytes
[libx264 @ 0x103800600] frame= 6 QP=16.80 NAL=2 Slice:P Poc:18 I:13
P:48 SKIP:239 size=491 bytes
[libx264 @ 0x103800600] frame= 7 QP=14.07 NAL=2 Slice:B Poc:14 I:2
P:19 SKIP:279 size=72 bytes
[libx264 @ 0x103800600] frame= 8 QP=24.07 NAL=0 Slice:B Poc:12 I:4
P:15 SKIP:281 size=91 bytes
[libx264 @ 0x103800600] frame= 9 QP=24.48 NAL=0 Slice:B Poc:16 I:0
P:14 SKIP:285 size=60 bytes
[libx264 @ 0x103800600] frame= 10 QP=19.62 NAL=2 Slice:P Poc:26 I:13
P:49 SKIP:238 size=565 bytes
[libx264 @ 0x103800600] frame= 11 QP=22.93 NAL=2 Slice:B Poc:22 I:3
P:30 SKIP:267 size=182 bytes
[libx264 @ 0x103800600] frame= 12 QP=13.00 NAL=0 Slice:B Poc:20 I:1
P:29 SKIP:270 size=56 bytes
[libx264 @ 0x103800600] frame= 13 QP=15.21 NAL=0 Slice:B Poc:24 I:3
P:29 SKIP:268 size=62 bytes
[libx264 @ 0x103800600] frame= 14 QP=18.10 NAL=2 Slice:P Poc:34 I:10
P:48 SKIP:242 size=505 bytes
[libx264 @ 0x103800600] frame= 15 QP=21.88 NAL=2 Slice:B Poc:30 I:2
P:17 SKIP:279 size=92 bytes
[libx264 @ 0x103800600] frame= 16 QP=13.00 NAL=0 Slice:B Poc:28 I:1
P:12 SKIP:286 size=41 bytes
[libx264 @ 0x103800600] frame= 17 QP=25.61 NAL=0 Slice:B Poc:32 I:4
P:12 SKIP:284 size=83 bytes
[libx264 @ 0x103800600] frame= 18 QP=21.49 NAL=2 Slice:P Poc:42 I:15
P:48 SKIP:237 size=534 bytes
[libx264 @ 0x103800600] frame= 19 QP=19.63 NAL=2 Slice:B Poc:38 I:3
P:31 SKIP:265 size=138 bytes
[libx264 @ 0x103800600] frame= 20 QP=24.82 NAL=0 Slice:B Poc:36 I:0
P:22 SKIP:277 size=77 bytes
[libx264 @ 0x103800600] frame= 21 QP=15.43 NAL=0 Slice:B Poc:40 I:2
P:25 SKIP:273 size=58 bytes
[libx264 @ 0x103800600] frame= 22 QP=20.04 NAL=2 Slice:P Poc:44 I:8
P:50 SKIP:242 size=234 bytes
[libx264 @ 0x103800600] frame= 23 QP=20.31 NAL=2 Slice:P Poc:50 I:19
P:51 SKIP:230 size=510 bytes
[libx264 @ 0x103800600] frame= 24 QP=22.51 NAL=2 Slice:B Poc:48 I:0
P:25 SKIP:275 size=89 bytes
No more output streams to write to, finishing.
[libx264 @ 0x103800600] frame= 25 QP=22.99 NAL=0 Slice:B Poc:46 I:1
P:19 SKIP:279 size=77 bytes
[libx264 @ 0x103800600] frame= 26 QP=13.24 NAL=2 Slice:P Poc:58 I:19
P:46 SKIP:235 size=485 bytes
[libx264 @ 0x103800600] frame= 27 QP=15.12 NAL=2 Slice:B Poc:54 I:3
P:31 SKIP:266 size=96 bytes
[libx264 @ 0x103800600] frame= 28 QP=24.94 NAL=0 Slice:B Poc:52 I:4
P:17 SKIP:279 size=99 bytes
[libx264 @ 0x103800600] frame= 29 QP=24.48 NAL=0 Slice:B Poc:56 I:1
P:21 SKIP:277 size=70 bytes
[libx264 @ 0x103800600] frame= 30 QP=19.97 NAL=2 Slice:P Poc:64 I:10
P:50 SKIP:240 size=417 bytes
[libx264 @ 0x103800600] frame= 31 QP=25.26 NAL=2 Slice:B Poc:62 I:3
P:27 SKIP:270 size=112 bytes
[libx264 @ 0x103800600] frame= 32 QP=22.18 NAL=0 Slice:B Poc:60 I:1
P:28 SKIP:270 size=85 bytes
[libx264 @ 0x103800600] frame= 33 QP=17.44 NAL=2 Slice:P Poc:72 I:17
P:57 SKIP:226 size=485 bytes
[libx264 @ 0x103800600] frame= 34 QP=20.03 NAL=2 Slice:B Poc:68 I:0
P:31 SKIP:268 size=94 bytes
[libx264 @ 0x103800600] frame= 35 QP=23.13 NAL=0 Slice:B Poc:66 I:2
P:18 SKIP:279 size=74 bytes
[libx264 @ 0x103800600] frame= 36 QP=13.00 NAL=0 Slice:B Poc:70 I:1
P:26 SKIP:273 size=49 bytes
[libx264 @ 0x103800600] frame= 37 QP=14.02 NAL=2 Slice:P Poc:74 I:7
P:52 SKIP:241 size=250 bytes
[libx264 @ 0x103800600] frame= 38 QP=19.29 NAL=2 Slice:P Poc:82 I:11
P:63 SKIP:226 size=512 bytes
[libx264 @ 0x103800600] frame= 39 QP=14.96 NAL=2 Slice:B Poc:78 I:1
P:33 SKIP:266 size=67 bytes
[libx264 @ 0x103800600] frame= 40 QP=23.34 NAL=0 Slice:B Poc:76 I:3
P:19 SKIP:277 size=70 bytes
[libx264 @ 0x103800600] frame= 41 QP=21.64 NAL=0 Slice:B Poc:80 I:2
P:19 SKIP:277 size=69 bytes
[libx264 @ 0x103800600] frame= 42 QP=13.28 NAL=2 Slice:P Poc:84 I:13
P:51 SKIP:236 size=247 bytes
[libx264 @ 0x103800600] frame= 43 QP=19.27 NAL=2 Slice:P Poc:92 I:7
P:50 SKIP:243 size=488 bytes
[libx264 @ 0x103800600] frame= 44 QP=18.37 NAL=2 Slice:B Poc:88 I:6
P:32 SKIP:261 size=119 bytes
[libx264 @ 0x103800600] frame= 45 QP=24.48 NAL=0 Slice:B Poc:86 I:3
P:21 SKIP:275 size=75 bytes
[libx264 @ 0x103800600] frame= 46 QP=15.29 NAL=0 Slice:B Poc:90 I:3
P:21 SKIP:276 size=54 bytes
[libx264 @ 0x103800600] frame= 47 QP=13.07 NAL=2 Slice:P Poc:94 I:9
P:56 SKIP:235 size=285 bytes
[libx264 @ 0x103800600] frame= 48 QP=19.36 NAL=2 Slice:P Poc:100 I:18
P:51 SKIP:231 size=611 bytes
[libx264 @ 0x103800600] frame= 49 QP=22.61 NAL=2 Slice:B Poc:98 I:2
P:21 SKIP:277 size=75 bytes
[libx264 @ 0x103800600] frame= 50 QP=24.48 NAL=0 Slice:B Poc:96 I:1
P:12 SKIP:286 size=61 bytes
[libx264 @ 0x103800600] frame= 51 QP=11.69 NAL=2 Slice:P Poc:108 I:23
P:49 SKIP:228 size=487 bytes
[libx264 @ 0x103800600] frame= 52 QP=16.12 NAL=2 Slice:B Poc:104 I:2
P:29 SKIP:269 size=83 bytes
[libx264 @ 0x103800600] frame= 53 QP=25.61 NAL=0 Slice:B Poc:102 I:5
P:14 SKIP:281 size=90 bytes
[libx264 @ 0x103800600] frame= 54 QP=24.18 NAL=0 Slice:B Poc:106 I:2
P:22 SKIP:275 size=79 bytes
[libx264 @ 0x103800600] frame= 55 QP=19.35 NAL=2 Slice:P Poc:114 I:13
P:53 SKIP:234 size=478 bytes
[libx264 @ 0x103800600] frame= 56 QP=25.68 NAL=2 Slice:B Poc:112 I:5
P:24 SKIP:271 size=107 bytes
[libx264 @ 0x103800600] frame= 57 QP=23.08 NAL=0 Slice:B Poc:110 I:1
P:30 SKIP:268 size=83 bytes
[libx264 @ 0x103800600] frame= 58 QP=17.59 NAL=2 Slice:P Poc:122 I:17
P:58 SKIP:225 size=484 bytes
[libx264 @ 0x103800600] frame= 59 QP=16.91 NAL=2 Slice:B Poc:118 I:1
P:34 SKIP:263 size=106 bytes
[libx264 @ 0x103800600] frame= 60 QP=24.48 NAL=0 Slice:B Poc:116 I:4
P:16 SKIP:279 size=71 bytes
[libx264 @ 0x103800600] frame= 61 QP=13.00 NAL=0 Slice:B Poc:120 I:2
P:27 SKIP:271 size=52 bytes
[libx264 @ 0x103800600] frame= 62 QP=13.54 NAL=2 Slice:P Poc:124 I:12
P:53 SKIP:235 size=268 bytes
[libx264 @ 0x103800600] frame= 63 QP=19.60 NAL=2 Slice:P Poc:132 I:11
P:57 SKIP:232 size=508 bytes
[libx264 @ 0x103800600] frame= 64 QP=14.67 NAL=2 Slice:B Poc:128 I:3
P:35 SKIP:262 size=73 bytes
[libx264 @ 0x103800600] frame= 65 QP=24.16 NAL=0 Slice:B Poc:126 I:1
P:27 SKIP:271 size=83 bytes
[libx264 @ 0x103800600] frame= 66 QP=23.56 NAL=0 Slice:B Poc:130 I:1
P:16 SKIP:281 size=57 bytes
[libx264 @ 0x103800600] frame= 67 QP=20.59 NAL=2 Slice:P Poc:140 I:18
P:55 SKIP:227 size=439 bytes
[libx264 @ 0x103800600] frame= 68 QP=22.61 NAL=2 Slice:B Poc:136 I:2
P:30 SKIP:266 size=135 bytes
[libx264 @ 0x103800600] frame= 69 QP=15.47 NAL=0 Slice:B Poc:134 I:1
P:25 SKIP:274 size=46 bytes
[libx264 @ 0x103800600] frame= 70 QP=16.38 NAL=0 Slice:B Poc:138 I:0
P:24 SKIP:275 size=63 bytes
[libx264 @ 0x103800600] frame= 71 QP=22.92 NAL=2 Slice:P Poc:148 I:6
P:52 SKIP:242 size=322 bytes
[libx264 @ 0x103800600] frame= 72 QP=16.07 NAL=2 Slice:B Poc:144 I:2
P:23 SKIP:275 size=74 bytes
[libx264 @ 0x103800600] frame= 73 QP=25.61 NAL=0 Slice:B Poc:142 I:3
P:20 SKIP:277 size=98 bytes
[libx264 @ 0x103800600] frame= 74 QP=23.58 NAL=0 Slice:B Poc:146 I:1
P:10 SKIP:288 size=58 bytes
frame= 75 fps=0.0 q=-1.0 Lsize= 44kB time=00:00:03.01 bitrate=
119.8kbits/s
video:18kB audio:22kB subtitle:0 global headers:0kB muxing overhead
9.250036%
[libx264 @ 0x103800600] frame I:1 Avg QP:22.89 size: 3173
[libx264 @ 0x103800600] frame P:24 Avg QP:17.93 size: 444
[libx264 @ 0x103800600] frame B:50 Avg QP:20.73 size: 84
[libx264 @ 0x103800600] consecutive B-frames: 8.0% 2.7% 20.0% 69.3%
[libx264 @ 0x103800600] mb I I16..4: 68.0% 6.7% 25.3%
[libx264 @ 0x103800600] mb P I16..4: 3.3% 0.5% 0.6% P16..4: 10.3%
4.5% 2.4% 0.0% 0.0% skip:78.2%
[libx264 @ 0x103800600] mb B I16..4: 0.7% 0.0% 0.0% B16..8: 6.6%
0.7% 0.1% direct: 0.3% skip:91.5% L0:47.6% L1:50.4% BI: 2.0%
[libx264 @ 0x103800600] 8x8 transform intra:8.5% inter:28.5%
[libx264 @ 0x103800600] coded y,uvDC,uvAC intra: 10.0% 31.1% 18.3% inter:
1.1% 2.9% 1.8%
[libx264 @ 0x103800600] i16 v,h,dc,p: 66% 18% 6% 10%
[libx264 @ 0x103800600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 73% 2% 24% 0% 0%
0% 0% 0% 0%
[libx264 @ 0x103800600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 50% 28% 16% 1% 1%
1% 0% 1% 0%
[libx264 @ 0x103800600] i8c dc,h,v,p: 32% 20% 39% 8%
[libx264 @ 0x103800600] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x103800600] ref P L0: 63.5% 5.7% 25.2% 5.6%
[libx264 @ 0x103800600] ref B L0: 74.2% 16.5% 9.3%
[libx264 @ 0x103800600] ref B L1: 94.2% 5.8%
[libx264 @ 0x103800600] kb/s:48.13
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x103102520] Statistics: 60 seeks, 252 writeouts
}}}
Using either libfaac (as above) or the native aac encoder (add {{{-c:a aac
-strict experimental}}}), the edit lists written to out.m4v are:[[BR]]
video track edit list (2 entries):[[BR]]
[0] duration=80 (0.08s) media_time=-1 (empty edit)[[BR]]
[1] duration=3000 (3s) media_time=1024 (0.08s)[[BR]]
audio track edit list (2 entries):[[BR]]
[0] duration=56 (0.056s) media_time=-1 (empty edit)[[BR]]
[1] duration=3042 (3.066s) media_time=0 (0s)[[BR]]
As expected there are no empty edits if "out.m4v" is changed to "out.mp4"
in the above command:[[BR]]
video track edit list (1 entry):[[BR]]
[0] duration=3000 (3s) media_time=1024 (0.08s)[[BR]]
audio track edit list (1 entry):[[BR]]
[0] duration=3018 (3.018s) media_time=1024 (0.023s)[[BR]]
Using the FDK AAC encoder ({{{-c:a libfdk_aac}}}) the values are a little
different but the issue is the same.
ffplay does not correctly handle audio that does not start at time 0
(ticket:1721), and also starts playing immediately, so it is difficult to
test with ffplay. If the output video is opened in Apple's !QuickTime
Player, an empty black frame appears before the Play button is pressed.
Normally the first video frame is seen. An empty black box also appears
under "Preview:" when you click on it in a Mac Finder window (columns
mode). This works as expected with MP4 output, and with M4V output
produced by ffmpeg 1.2.1.
The edit lists can be seen directly using various utilities, such as
{{{mp4file}}} http://code.google.com/p/mp4v2/ : {{{mp4file --dump --debug
2 out.m4v}}} and search for {{{elst}}} in the output. There will be one
edit list for the video track and another one for the audio track, with
two entries each. An entry with mediaTime -1 / 4294967295 / 0xffffffff is
an empty edit (no media).
ffmpeg version 1.1.git-bbe26ef (git master 2013-Jun-24)[[BR]]
Viewed with: !QuickTime Player 10.0 (131) / Mac OS X 10.6.8
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2708>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list