Log in

View Full Version : x264 producing different output every run


dlzinc
22nd February 2010, 22:59
I was experimenting with x264 and have discovered something strange (to me at least). It appears that it's producing different results every time I run it. I'm wondering if anyone can shed some insight about this (or if it might be a problem with my computer).

I'm just md5summing the .264 files and it shows up different. the md5 sum for the stats files are the same. You can see some differences in the x264 log below as well.

avs file:

DirectShowSource("xxxxxx")
ConvertToYv12()


commands:

start /b /belownormal /wait avs4x264 --preset veryslow --tune animation --profile high --level 4.1
--pass 1 --bitrate 950 --vbv-bufsize 50000 --vbv-maxrate 50000 --stats "aaa.stats"
--thread-input --output NUL "aaa.avs"

start /b /belownormal /wait avs4x264 --preset veryslow --tune animation --profile high --level 4.1
--pass 2 --bitrate 950 --vbv-bufsize 50000 --vbv-maxrate 50000 --stats "aaa.stats"
--thread-input --output "aaa.264" "aaa.avs"


output from first/second pass (first try):

yuv [info]: 640x360p 0:0 @ 10000000/417083 fps (cfr)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
x264 [info]: profile Main, level 4.1
x264 [info]: frame I:18 Avg QP:19.73 size: 25530
x264 [info]: frame P:1077 Avg QP:23.59 size: 7504
x264 [info]: frame B:1351 Avg QP:27.02 size: 1937
x264 [info]: consecutive B-frames: 12.2% 34.3% 31.1% 11.9% 3.9% 1.5% 1.4% 1.
3% 1.1% 1.2% 0.0%
x264 [info]: mb I I16..4: 37.2% 0.0% 62.8%
x264 [info]: mb P I16..4: 27.9% 0.0% 0.0% P16..4: 38.3% 0.0% 0.0% 0.0% 0
.0% skip:33.9%
x264 [info]: mb B I16..4: 3.6% 0.0% 0.0% B16..8: 16.1% 0.0% 0.0% direct:
7.7% skip:72.5% L0:42.9% L1:38.0% BI:19.1%
x264 [info]: final ratefactor: 21.65
x264 [info]: direct mvs spatial:92.7% temporal:7.3%
x264 [info]: coded y,uvDC,uvAC intra: 45.9% 48.7% 17.0% inter: 13.5% 11.8% 1.6%
x264 [info]: i16 v,h,dc,p: 27% 35% 27% 12%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 29% 16% 6% 6% 5% 8% 5% 9%
x264 [info]: Weighted P-Frames: Y:9.1%
x264 [info]: kb/s:875.07

encoded 2446 frames, 32.18 fps, 875.07 kb/s


yuv [info]: 640x360p 0:0 @ 10000000/417083 fps (cfr)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
x264 [info]: profile High, level 4.1
x264 [info]: frame I:18 Avg QP:19.95 size: 23920
x264 [info]: frame P:1077 Avg QP:24.64 size: 8065
x264 [info]: frame B:1351 Avg QP:27.85 size: 2245
x264 [info]: consecutive B-frames: 12.2% 34.3% 31.1% 11.9% 3.9% 1.5% 1.4% 1.
3% 1.1% 1.2% 0.0%
x264 [info]: mb I I16..4: 18.0% 70.8% 11.2%
x264 [info]: mb P I16..4: 7.9% 15.6% 2.1% P16..4: 29.5% 9.8% 3.3% 0.4% 0
.1% skip:31.3%
x264 [info]: mb B I16..4: 0.7% 1.5% 0.4% B16..8: 24.4% 1.5% 2.0% direct:
4.0% skip:65.6% L0:47.6% L1:41.4% BI:11.0%
x264 [info]: 8x8 transform intra:61.2% inter:77.9%
x264 [info]: direct mvs spatial:79.2% temporal:20.8%
x264 [info]: coded y,uvDC,uvAC intra: 50.9% 54.8% 21.0% inter: 15.3% 12.9% 2.6%
x264 [info]: i16 v,h,dc,p: 39% 34% 12% 16%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 21% 24% 5% 6% 5% 9% 6% 12%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 20% 15% 6% 8% 7% 9% 7% 11%
x264 [info]: Weighted P-Frames: Y:9.4%
x264 [info]: ref P L0: 65.8% 8.1% 14.4% 2.8% 3.2% 1.4% 1.0% 0.7% 0.6% 0.
6% 0.5% 0.3% 0.2% 0.2% 0.2% 0.1%
x264 [info]: ref B L0: 86.8% 5.6% 2.7% 1.4% 1.0% 0.8% 0.6% 0.3% 0.2% 0.
2% 0.1% 0.1% 0.1% 0.1% 0.1%
x264 [info]: kb/s:952.71

encoded 2446 frames, 16.64 fps, 952.76 kb/s


output from first/second pass (second try, after deleting all .stats, .stats.mbtree, and .264 files):

yuv [info]: 640x360p 0:0 @ 10000000/417083 fps (cfr)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
x264 [info]: profile Main, level 4.1
x264 [info]: frame I:18 Avg QP:19.73 size: 25530
x264 [info]: frame P:1077 Avg QP:23.59 size: 7504
x264 [info]: frame B:1351 Avg QP:27.02 size: 1937
x264 [info]: consecutive B-frames: 12.2% 34.3% 31.1% 11.9% 3.9% 1.5% 1.4% 1.
3% 1.1% 1.2% 0.0%
x264 [info]: mb I I16..4: 37.2% 0.0% 62.8%
x264 [info]: mb P I16..4: 27.9% 0.0% 0.0% P16..4: 38.3% 0.0% 0.0% 0.0% 0
.0% skip:33.9%
x264 [info]: mb B I16..4: 3.6% 0.0% 0.0% B16..8: 16.1% 0.0% 0.0% direct:
7.7% skip:72.5% L0:42.9% L1:38.0% BI:19.1%
x264 [info]: final ratefactor: 21.65
x264 [info]: direct mvs spatial:92.7% temporal:7.3%
x264 [info]: coded y,uvDC,uvAC intra: 45.9% 48.7% 17.0% inter: 13.5% 11.8% 1.6%
x264 [info]: i16 v,h,dc,p: 27% 35% 27% 12%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 29% 16% 6% 6% 5% 8% 5% 9%
x264 [info]: Weighted P-Frames: Y:9.1%
x264 [info]: kb/s:875.07

encoded 2446 frames, 31.77 fps, 875.07 kb/s

yuv [info]: 640x360p 0:0 @ 10000000/417083 fps (cfr)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
x264 [info]: profile High, level 4.1
x264 [info]: frame I:18 Avg QP:19.91 size: 23954
x264 [info]: frame P:1077 Avg QP:24.66 size: 8054
x264 [info]: frame B:1351 Avg QP:27.89 size: 2250
x264 [info]: consecutive B-frames: 12.2% 34.3% 31.1% 11.9% 3.9% 1.5% 1.4% 1.
3% 1.1% 1.2% 0.0%
x264 [info]: mb I I16..4: 18.2% 70.8% 11.1%
x264 [info]: mb P I16..4: 7.8% 15.7% 2.1% P16..4: 29.6% 9.7% 3.3% 0.4% 0
.1% skip:31.3%
x264 [info]: mb B I16..4: 0.7% 1.5% 0.4% B16..8: 24.4% 1.5% 2.0% direct:
3.9% skip:65.6% L0:47.6% L1:41.4% BI:10.9%
x264 [info]: 8x8 transform intra:61.4% inter:77.9%
x264 [info]: direct mvs spatial:79.2% temporal:20.8%
x264 [info]: coded y,uvDC,uvAC intra: 51.0% 54.9% 21.1% inter: 15.3% 12.9% 2.6%
x264 [info]: i16 v,h,dc,p: 39% 33% 12% 16%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 22% 24% 5% 6% 5% 9% 6% 12%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 20% 15% 6% 8% 7% 9% 7% 11%
x264 [info]: Weighted P-Frames: Y:9.4%
x264 [info]: ref P L0: 65.5% 8.3% 14.5% 2.8% 3.2% 1.4% 1.1% 0.6% 0.6% 0.
6% 0.5% 0.3% 0.2% 0.2% 0.2% 0.1%
x264 [info]: ref B L0: 86.7% 5.7% 2.7% 1.4% 1.0% 0.7% 0.6% 0.3% 0.2% 0.
2% 0.1% 0.1% 0.1% 0.1% 0.1%
x264 [info]: kb/s:952.42

encoded 2446 frames, 16.99 fps, 952.48 kb/s


Version: x264 core:85 r1442 781d300
System specs: Core i5-750, 8GB RAM, Win7 x64 all running stock clocks.

MasterNobody
22nd February 2010, 23:25
This is normal. VBV is not deterministic with threading.

Blue_MiSfit
23rd February 2010, 00:34
Indeed. You will find no perceptible difference in image quality. If you do, something is quite wrong :)

~MiSfit

kypec
23rd February 2010, 09:01
This is normal. VBV is not deterministic with threading.
Can you point me to an explanation where VBV usage implies x264's non-determinism as such?
According to this thread (http://forum.doom9.org/showthread.php?t=149885) unless there is
different number of threads used, or
different command line settings used, or
b_deterministic option disabled explicitly
then resulting H.264 bitstreams produced by repeated runs of x264 should be identical. :confused:

Dark Shikari
23rd February 2010, 09:21
Can you point me to an explanation where VBV usage implies x264's non-determinism as such?
According to this thread (http://forum.doom9.org/showthread.php?t=149885) unless there is
different number of threads used, or
different command line settings used, or
b_deterministic option disabled explicitly
then resulting H.264 bitstreams produced by repeated runs of x264 should be identical. :confused:VBV is intentionally nondeterministic with threads. It uses more information than would be in a deterministic implementation, for maximum compliance.

kypec
23rd February 2010, 10:18
VBV is intentionally nondeterministic with threads. It uses more information than would be in a deterministic implementation, for maximum compliance.
Does it mean that when x264 is forced to use single thread only with VBV enabled then results will be deterministic i.e. bitstream identical for each repeated run?

Dark Shikari
23rd February 2010, 10:31
Does it mean that when x264 is forced to use single thread only with VBV enabled then results will be deterministic i.e. bitstream identical for each repeated run?Correct.

MasterNobody
23rd February 2010, 10:33
Yes. x264 is nondeterministic ONLY with multithreading.

dlzinc
23rd February 2010, 21:17
:thanks: