[FFmpeg-user] H.264 file size

Henk Schoneveld belcampo at zonnet.nl
Tue Mar 5 19:29:38 CET 2013



Sent from my iPod

On 5 mrt. 2013, at 14:06, Daniel Zens <webmaster at danielzens.de> wrote:

> Hi everyone,
> 
> first excuse my english. I rarely write in english. ;-)
> 
> I've developed an application with ffmpeg, which grabs images from a camera and encode them with the H.264 Codec from ffmpeg.
> 
> My application works well, but after testing a little bit, I was wondering about the results.
> 
> I've grabbed two scenes with a length of 40 seconds. Scene one has nearly no motion. Scene two has very much motion.
> 
> Encoding those scenes with MPEG1, I got for scene two a file that was bigger than the file of scene one.
> 
> That seems legit, because in scene one are less changes to encode than in scene two.
> 
> But when I use H.264 for encoding, the file of scene two is smaller than in scene one.
If you want to compare apples to apples you have to encode with the same quality NOT with an unknown default bitrate. You have to provide complete command line with uncut output. Use -crf 22 and you'll see that the 1st file Will be smaller than the 2nd. Your output shows that the quality of your 2nd file is much less than the 1st one.
> 
> In scene one are many macroblocks skipped, but the I-frames have much more 4x4 macroblocks compared to scene two.
> 
> So, the I-Frames size in scene one is much bigger than in scene two, and so the scene one file is also bigger than the scene two file.
> 
> But I don't unterstand, why H.264 divide the I-frames in so much macroblocks, when there is no motion. Why is the no motion file bigger than the motion file?
> 
> Here is some data output from the codec of the two scenes. I used the high profile and level 3.0. Bitrate and all other settings are in both scenes the same.
> 
> Scene One, less motion, filesize about 2152 kb:
> [libx264 @ 0x7f0ffc1ce540] frame I:103 Avg QP:24.79 size: 19355
> [libx264 @ 0x7f0ffc1ce540] frame P:512 Avg QP:28.03 size: 316
> [libx264 @ 0x7f0ffc1ce540] frame B:410 Avg QP:33.10 size: 116
> [libx264 @ 0x7f0ffc1ce540] consecutive B-frames: 20.0% 80.0%
> [libx264 @ 0x7f0ffc1ce540] mb I I16..4: 29.4% 41.7% 28.9%
> [libx264 @ 0x7f0ffc1ce540] mb P I16..4: 0.3% 0.1% 0.0% P16..4: 7.5% 0.3% 0.3% 0.0% 0.0% skip:91.5%
> [libx264 @ 0x7f0ffc1ce540] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 4.7% 0.0% 0.0% direct: 0.1% skip:95.1% L0:12.4% L1:87.1% BI: 0.4%
> [libx264 @ 0x7f0ffc1ce540] final ratefactor: 23.93
> [libx264 @ 0x7f0ffc1ce540] 8x8 transform intra:41.3% inter:75.7%
> [libx264 @ 0x7f0ffc1ce540] coded y,uvDC,uvAC intra: 58.9% 72.7% 38.2% inter: 0.1% 3.3% 1.0%
> [libx264 @ 0x7f0ffc1ce540] i16 v,h,dc,p: 6% 40% 1% 53%
> [libx264 @ 0x7f0ffc1ce540] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 29% 7% 5% 4% 4% 6% 5% 10%
> [libx264 @ 0x7f0ffc1ce540] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 43% 6% 3% 3% 4% 5% 4% 5%
> [libx264 @ 0x7f0ffc1ce540] i8c dc,h,v,p: 50% 28% 16% 5%
> [libx264 @ 0x7f0ffc1ce540] Weighted P-Frames: Y:0.0% UV:0.0%
> [libx264 @ 0x7f0ffc1ce540] ref P L0: 82.2% 2.7% 11.0% 4.1%
> [libx264 @ 0x7f0ffc1ce540] ref B L0: 75.7% 24.3%
> [libx264 @ 0x7f0ffc1ce540] kb/s:429.87
> 
> Scene two, much motion, filesize about 2034 kb:
> [libx264 @ 0x7f99841ce540] frame I:103 Avg QP:32.64 size: 10292
> [libx264 @ 0x7f99841ce540] frame P:522 Avg QP:36.86 size: 1467
> [libx264 @ 0x7f99841ce540] frame B:400 Avg QP:40.37 size: 642
> [libx264 @ 0x7f99841ce540] consecutive B-frames: 22.0% 78.0%
> [libx264 @ 0x7f99841ce540] mb I I16..4: 28.9% 51.6% 19.6%
> [libx264 @ 0x7f99841ce540] mb P I16..4: 3.5% 6.4% 0.6% P16..4: 21.0% 3.0% 1.3% 0.0% 0.0% skip:64.2%
> [libx264 @ 0x7f99841ce540] mb B I16..4: 0.7% 1.6% 0.0% B16..8: 17.8% 1.6% 0.2% direct: 0.5% skip:77.6% L0:34.6% L1:63.6% BI: 1.8%
> [libx264 @ 0x7f99841ce540] final ratefactor: 31.53
> [libx264 @ 0x7f99841ce540] 8x8 transform intra:55.5% inter:88.1%
> [libx264 @ 0x7f99841ce540] coded y,uvDC,uvAC intra: 43.6% 45.9% 6.7% inter: 3.3% 4.9% 0.0%
> [libx264 @ 0x7f99841ce540] i16 v,h,dc,p: 20% 37% 4% 39%
> [libx264 @ 0x7f99841ce540] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 19% 14% 8% 7% 7% 8% 8% 8%
> [libx264 @ 0x7f99841ce540] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 32% 10% 5% 5% 5% 6% 5% 5%
> [libx264 @ 0x7f99841ce540] i8c dc,h,v,p: 70% 16% 12% 3%
> [libx264 @ 0x7f99841ce540] Weighted P-Frames: Y:12.5% UV:0.6%
> [libx264 @ 0x7f99841ce540] ref P L0: 70.4% 13.6% 11.4% 4.2% 0.4%
> [libx264 @ 0x7f99841ce540] ref B L0: 88.9% 11.1%
> [libx264 @ 0x7f99841ce540] kb/s:406.32
> 
> Greetings!
> 
> 
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user


More information about the ffmpeg-user mailing list