#187: 3GP/MP4 performance regression ------------------------+--------------------------- Reporter: jsd | Owner: Type: defect | Status: open Priority: normal | Component: undetermined Version: unspecified | Resolution: Keywords: | Blocked By: Blocking: | Reproduced: 0 Analyzed: 0 | ------------------------+--------------------------- Comment (by jsd): With this command line, it runs perfectly fine: ffmpeg -y -i 2423.mp4 -s 480x352 -b 300k -bt 300k test.flv It's fine if I add -acodec libfaac. It's fine if I add -vcodec libx264. Maybe this points to the mp4 muxer being a problem? I will spend the rest of the day trying to pin down where things changed. If you think of anything, please update this ticket, I will be online all day. Here is complete uncut output with flv muxer (good): $ ffmpeg -y -i 2423.mp4 -s 480x352 -b 300k -bt 300k -acodec libfaac -vcodec libx264 test.flv ffmpeg version UNKNOWN, Copyright (c) 2000-2011 the FFmpeg developers built on May 5 2011 11:01:27 with gcc 4.1.2 20080704 (Red Hat 4.1.2-48) configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-pthreads --enable-static --disable-shared --disable-network --enable-nonfree libavutil 51. 2. 0 / 51. 2. 0 libavcodec 53. 3. 0 / 53. 3. 0 libavformat 53. 0. 3 / 53. 0. 3 libavdevice 53. 0. 0 / 53. 0. 0 libavfilter 2. 4. 0 / 2. 4. 0 libswscale 0. 14. 0 / 0. 14. 0 Seems stream 1 codec frame rate differs from container frame rate: 60000.00 (60000/1) -> 30000.00 (60000/2) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2423.mp4': Metadata: major_brand : 3gp4 minor_version : 768 compatible_brands: 3gp43gp6 Duration: 00:02:55.63, start: 0.000000, bitrate: 3493 kb/s Stream #0.0(eng): Audio: aac, 16000 Hz, mono, s16, 61 kb/s Stream #0.1(eng): Video: h264 (Baseline), yuv420p, 720x480, 3429 kb/s, 29.83 fps, 30k tbr, 30k tbn, 60k tbc [buffer @ 0x8d5d5e0] w:720 h:480 pixfmt:yuv420p [scale @ 0x8d5c940] w:720 h:480 fmt:yuv420p -> w:480 h:352 fmt:yuv420p flags:0xa0000004 [libx264 @ 0x8d5b2e0] Default settings detected, using medium profile [libx264 @ 0x8d5b2e0] MB rate (19800000) > level limit (983040) [libx264 @ 0x8d5b2e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64 [libx264 @ 0x8d5b2e0] profile High, level 5.1 [libx264 @ 0x8d5b2e0] 264 - core 104 - H.264/MPEG-4 AVC codec - Copyleft 2003-2010 - 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=1 sliced_threads=0 nr=0 decimate=1 interlaced=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=abr mbtree=1 bitrate=300 ratetol=1.0 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, flv, to 'test.flv': Metadata: major_brand : 3gp4 minor_version : 768 compatible_brands: 3gp43gp6 encoder : Lavf53.0.3 Stream #0.0(eng): Video: libx264, yuv420p, 480x352, q=2-31, 300 kb/s, 1k tbn, 30k tbc Stream #0.1(eng): Audio: libfaac, 16000 Hz, mono, s16, 64 kb/s Stream mapping: Stream #0.1 -> #0.0 Stream #0.0 -> #0.1 Press [q] to stop encoding frame= 2818 fps= 32 q=29.0 Lsize= 3887kB time=94.38 bitrate= 337.4kbits/s video:3480kB audio:327kB global headers:0kB muxing overhead 2.100497% frame I:12 Avg QP:20.98 size: 10995 [libx264 @ 0x8d5b2e0] frame P:737 Avg QP:21.90 size: 3100 [libx264 @ 0x8d5b2e0] frame B:2069 Avg QP:25.42 size: 554 [libx264 @ 0x8d5b2e0] consecutive B-frames: 0.1% 2.1% 8.0% 89.8% [libx264 @ 0x8d5b2e0] mb I I16..4: 18.5% 54.2% 27.3% [libx264 @ 0x8d5b2e0] mb P I16..4: 1.9% 1.2% 0.2% P16..4: 49.5% 15.9% 9.3% 0.0% 0.0% skip:22.0% [libx264 @ 0x8d5b2e0] mb B I16..4: 0.1% 0.0% 0.0% B16..8: 45.8% 2.1% 0.2% direct: 0.6% skip:51.2% L0:42.0% L1:54.6% BI: 3.4% [libx264 @ 0x8d5b2e0] final ratefactor: 23.23 [libx264 @ 0x8d5b2e0] 8x8 transform intra:41.9% inter:69.4% [libx264 @ 0x8d5b2e0] coded y,uvDC,uvAC intra: 33.5% 58.4% 18.3% inter: 7.2% 13.0% 0.1% [libx264 @ 0x8d5b2e0] i16 v,h,dc,p: 32% 14% 9% 44% [libx264 @ 0x8d5b2e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 9% 41% 3% 5% 7% 4% 5% 4% [libx264 @ 0x8d5b2e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 10% 19% 5% 7% 9% 5% 6% 4% [libx264 @ 0x8d5b2e0] i8c dc,h,v,p: 61% 12% 23% 4% [libx264 @ 0x8d5b2e0] Weighted P-Frames: Y:0.9% [libx264 @ 0x8d5b2e0] ref P L0: 58.7% 10.7% 22.5% 8.0% 0.0% [libx264 @ 0x8d5b2e0] ref B L0: 87.6% 9.9% 2.5% [libx264 @ 0x8d5b2e0] ref B L1: 93.8% 6.2% [libx264 @ 0x8d5b2e0] kb/s:301.65 Here is output with MP4 muxer. Note that I aborted the encode after a few seconds - it's obvious it's not going to work right when you see that the "dup" number on the progress line is shooting up into the thousands almost immediately. $ ffmpeg -y -i 2423.mp4 -s 480x352 -b 300k -bt 300k -acodec libfaac -vcodec libx264 test.mp4 ffmpeg version UNKNOWN, Copyright (c) 2000-2011 the FFmpeg developers built on May 5 2011 11:01:27 with gcc 4.1.2 20080704 (Red Hat 4.1.2-48) configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-pthreads --enable-static --disable-shared --disable-network --enable-nonfree libavutil 51. 2. 0 / 51. 2. 0 libavcodec 53. 3. 0 / 53. 3. 0 libavformat 53. 0. 3 / 53. 0. 3 libavdevice 53. 0. 0 / 53. 0. 0 libavfilter 2. 4. 0 / 2. 4. 0 libswscale 0. 14. 0 / 0. 14. 0 Seems stream 1 codec frame rate differs from container frame rate: 60000.00 (60000/1) -> 30000.00 (60000/2) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2423.mp4': Metadata: major_brand : 3gp4 minor_version : 768 compatible_brands: 3gp43gp6 Duration: 00:02:55.63, start: 0.000000, bitrate: 3493 kb/s Stream #0.0(eng): Audio: aac, 16000 Hz, mono, s16, 61 kb/s Stream #0.1(eng): Video: h264 (Baseline), yuv420p, 720x480, 3429 kb/s, 29.83 fps, 30k tbr, 30k tbn, 60k tbc [buffer @ 0x8d5d5e0] w:720 h:480 pixfmt:yuv420p [scale @ 0x8d5c940] w:720 h:480 fmt:yuv420p -> w:480 h:352 fmt:yuv420p flags:0xa0000004 [libx264 @ 0x8d5b2e0] Default settings detected, using medium profile [libx264 @ 0x8d5b2e0] MB rate (19800000) > level limit (983040) [libx264 @ 0x8d5b2e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64 [libx264 @ 0x8d5b2e0] profile High, level 5.1 [libx264 @ 0x8d5b2e0] 264 - core 104 - H.264/MPEG-4 AVC codec - Copyleft 2003-2010 - 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=1 sliced_threads=0 nr=0 decimate=1 interlaced=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=abr mbtree=1 bitrate=300 ratetol=1.0 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'test.mp4': Metadata: major_brand : 3gp4 minor_version : 768 compatible_brands: 3gp43gp6 encoder : Lavf53.0.3 Stream #0.0(eng): Video: libx264, yuv420p, 480x352, q=2-31, 300 kb/s, 60k tbn, 30k tbc Stream #0.1(eng): Audio: libfaac, 16000 Hz, mono, s16, 64 kb/s Stream mapping: Stream #0.1 -> #0.0 Stream #0.0 -> #0.1 Press [q] to stop encoding frame= 2010 fps=180 q=51.0 Lsize= 87kB time=0.07 bitrate=10641.9kbits/s dup=2007 drop=0 video:55kB audio:0kB global headers:0kB muxing overhead 58.719718% frame I:9 Avg QP:36.41 size: 2067 [libx264 @ 0x8d5b2e0] frame P:507 Avg QP:50.98 size: 23 [libx264 @ 0x8d5b2e0] frame B:1494 Avg QP:51.00 size: 17 [libx264 @ 0x8d5b2e0] consecutive B-frames: 0.4% 0.0% 0.0% 99.6% [libx264 @ 0x8d5b2e0] mb I I16..4: 38.8% 54.4% 6.8% [libx264 @ 0x8d5b2e0] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.1% 0.1% 0.0% 0.0% 0.0% skip:99.8% [libx264 @ 0x8d5b2e0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.1% 0.0% 0.0% direct: 0.0% skip:99.9% L0:33.9% L1:66.1% BI: 0.0% [libx264 @ 0x8d5b2e0] final ratefactor: 71.63 [libx264 @ 0x8d5b2e0] 8x8 transform intra:54.3% inter:85.7% [libx264 @ 0x8d5b2e0] coded y,uvDC,uvAC intra: 19.9% 27.4% 3.4% inter: 0.0% 0.0% 0.0% [libx264 @ 0x8d5b2e0] i16 v,h,dc,p: 54% 19% 7% 19% [libx264 @ 0x8d5b2e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 5% 34% 4% 3% 5% 2% 5% 2% [libx264 @ 0x8d5b2e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 8% 25% 7% 5% 6% 2% 6% 1% [libx264 @ 0x8d5b2e0] i8c dc,h,v,p: 80% 3% 16% 1% [libx264 @ 0x8d5b2e0] Weighted P-Frames: Y:0.0% [libx264 @ 0x8d5b2e0] ref P L0: 89.2% 0.5% 9.9% 0.5% [libx264 @ 0x8d5b2e0] ref B L0: 99.2% 0.8% [libx264 @ 0x8d5b2e0] kb/s:6615.40 Received signal 2: terminating. Just for kicks, I tried it with .avi output and it works fine there as well. It must be the mp4 muxer... I'll try to figure out what change caused this. I don't really know how to use git but I guess it's time to learn! -- Ticket URL: <http://ffmpeg.org/trac/ffmpeg/ticket/187#comment:2> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker