galfwender
10th October 2009, 15:30
Hello,
I have issues with sizing accuracy of x264 in 2 pass mode.
For example, a clip of 2000 frames, 80 seconds at 25fps. If I specify bitrate of 5000 I expect a filesize of 50,000kByte (80 seconds * 5000 kbit / 8), or very close to it.
The result I get is usually 2-3% smaller.
Here is a log:
x264.exe --pass 1 --bitrate 5000 --threads auto --keyint 250 --min-keyint 25 --bframes 3 --b-pyramid --me dia --subme 1 --partitions none --no-mbtree --stats "x264.stats" --output NUL "input.avs"
avis [info]: 1280x720 @ 25.00 fps (2000 frames)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
x264 [info]: profile Main, level 3.1
x264 [info]: frame I:22 Avg QP:14.42 size:127100
x264 [info]: frame P:585 Avg QP:15.89 size: 48356
x264 [info]: frame B:1393 Avg QP:17.49 size: 14049
x264 [info]: consecutive B-frames: 1.7% 9.6% 11.1% 77.7%
x264 [info]: mb I I16..4: 19.7% 0.0% 80.3%
x264 [info]: mb P I16..4: 19.9% 0.0% 0.0% P16..4: 75.9% 0.0% 0.0% 0.0% 0.0% skip: 4.2%
x264 [info]: mb B I16..4: 4.2% 0.0% 0.0% B16..8: 29.9% 0.0% 0.0% direct:29.5% skip:36.4% L0:31.2% L1:46.8% BI:21.9%
x264 [info]: final ratefactor: 19.10
x264 [info]: coded y,uvDC,uvAC intra: 83.2% 62.5% 42.8% inter: 34.6% 25.3% 1.4%
x264 [info]: i16 v,h,dc,p: 28% 17% 32% 24%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 16% 15% 9% 7% 7% 7% 7% 10%
x264 [info]: kb/s:5065.39
encoded 2000 frames, 38.31 fps, 5065.39 kb/s
x264.exe --pass 2 --bitrate 5000 --threads auto --keyint 250 --min-keyint 25 --ref 3 --bframes 3 --b-pyramid --no-mbtree --weightb --subme 6 --trellis 1 --8x8dct --stats "x264.stats" --output "test.x264" "input.avs"
avis [info]: 1280x720 @ 25.00 fps (2000 frames)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
x264 [info]: profile High, level 3.1
x264 [info]: frame I:22 Avg QP:14.72 size:121864
x264 [info]: frame P:585 Avg QP:15.99 size: 46754
x264 [info]: frame B:1393 Avg QP:17.55 size: 14329
x264 [info]: consecutive B-frames: 1.7% 9.6% 11.1% 77.7%
x264 [info]: mb I I16..4: 3.5% 77.7% 18.8%
x264 [info]: mb P I16..4: 1.2% 13.6% 1.7% P16..4: 32.3% 29.6% 17.0% 0.0% 0.0% skip: 4.7%
x264 [info]: mb B I16..4: 4.0% 5.3% 1.1% B16..8: 30.9% 3.0% 1.8% direct:18.0% skip:35.9% L0:36.0% L1:43.4% BI:20.6%
x264 [info]: 8x8 transform intra:65.0% inter:47.9%
x264 [info]: coded y,uvDC,uvAC intra: 83.7% 75.7% 56.2% inter: 35.1% 34.4% 3.0%
x264 [info]: i16 v,h,dc,p: 29% 17% 34% 20%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 13% 34% 5% 6% 6% 6% 6% 6%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 14% 18% 6% 9% 9% 8% 6% 5%
x264 [info]: ref P L0: 61.4% 25.0% 13.6%
x264 [info]: ref B L0: 81.8% 18.2%
x264 [info]: ref B L1: 93.9% 6.1%
x264 [info]: kb/s:4999.23
encoded 2000 frames, 17.87 fps, 4999.23 kb/s
It claims to have encoded at 4999.23kb/s however this is not the case - the output file is 48,821 kByte, which is 4882kb/s (48821 * 8 / 80 seconds).
If I start again specifying a higher target bitrate, the output file will be larger (so it is not a case of x264 not being able to achieve the filesize) - but it will still be 2-3% less than I wanted.
What is wrong?
I have issues with sizing accuracy of x264 in 2 pass mode.
For example, a clip of 2000 frames, 80 seconds at 25fps. If I specify bitrate of 5000 I expect a filesize of 50,000kByte (80 seconds * 5000 kbit / 8), or very close to it.
The result I get is usually 2-3% smaller.
Here is a log:
x264.exe --pass 1 --bitrate 5000 --threads auto --keyint 250 --min-keyint 25 --bframes 3 --b-pyramid --me dia --subme 1 --partitions none --no-mbtree --stats "x264.stats" --output NUL "input.avs"
avis [info]: 1280x720 @ 25.00 fps (2000 frames)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
x264 [info]: profile Main, level 3.1
x264 [info]: frame I:22 Avg QP:14.42 size:127100
x264 [info]: frame P:585 Avg QP:15.89 size: 48356
x264 [info]: frame B:1393 Avg QP:17.49 size: 14049
x264 [info]: consecutive B-frames: 1.7% 9.6% 11.1% 77.7%
x264 [info]: mb I I16..4: 19.7% 0.0% 80.3%
x264 [info]: mb P I16..4: 19.9% 0.0% 0.0% P16..4: 75.9% 0.0% 0.0% 0.0% 0.0% skip: 4.2%
x264 [info]: mb B I16..4: 4.2% 0.0% 0.0% B16..8: 29.9% 0.0% 0.0% direct:29.5% skip:36.4% L0:31.2% L1:46.8% BI:21.9%
x264 [info]: final ratefactor: 19.10
x264 [info]: coded y,uvDC,uvAC intra: 83.2% 62.5% 42.8% inter: 34.6% 25.3% 1.4%
x264 [info]: i16 v,h,dc,p: 28% 17% 32% 24%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 16% 15% 9% 7% 7% 7% 7% 10%
x264 [info]: kb/s:5065.39
encoded 2000 frames, 38.31 fps, 5065.39 kb/s
x264.exe --pass 2 --bitrate 5000 --threads auto --keyint 250 --min-keyint 25 --ref 3 --bframes 3 --b-pyramid --no-mbtree --weightb --subme 6 --trellis 1 --8x8dct --stats "x264.stats" --output "test.x264" "input.avs"
avis [info]: 1280x720 @ 25.00 fps (2000 frames)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
x264 [info]: profile High, level 3.1
x264 [info]: frame I:22 Avg QP:14.72 size:121864
x264 [info]: frame P:585 Avg QP:15.99 size: 46754
x264 [info]: frame B:1393 Avg QP:17.55 size: 14329
x264 [info]: consecutive B-frames: 1.7% 9.6% 11.1% 77.7%
x264 [info]: mb I I16..4: 3.5% 77.7% 18.8%
x264 [info]: mb P I16..4: 1.2% 13.6% 1.7% P16..4: 32.3% 29.6% 17.0% 0.0% 0.0% skip: 4.7%
x264 [info]: mb B I16..4: 4.0% 5.3% 1.1% B16..8: 30.9% 3.0% 1.8% direct:18.0% skip:35.9% L0:36.0% L1:43.4% BI:20.6%
x264 [info]: 8x8 transform intra:65.0% inter:47.9%
x264 [info]: coded y,uvDC,uvAC intra: 83.7% 75.7% 56.2% inter: 35.1% 34.4% 3.0%
x264 [info]: i16 v,h,dc,p: 29% 17% 34% 20%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 13% 34% 5% 6% 6% 6% 6% 6%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 14% 18% 6% 9% 9% 8% 6% 5%
x264 [info]: ref P L0: 61.4% 25.0% 13.6%
x264 [info]: ref B L0: 81.8% 18.2%
x264 [info]: ref B L1: 93.9% 6.1%
x264 [info]: kb/s:4999.23
encoded 2000 frames, 17.87 fps, 4999.23 kb/s
It claims to have encoded at 4999.23kb/s however this is not the case - the output file is 48,821 kByte, which is 4882kb/s (48821 * 8 / 80 seconds).
If I start again specifying a higher target bitrate, the output file will be larger (so it is not a case of x264 not being able to achieve the filesize) - but it will still be 2-3% less than I wanted.
What is wrong?