View Single Post
Old 12th February 2018, 20:19   #1  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
2pass encoding: 1st pass slower than 2nd pass?

I'm confused.

using for the 1st pass:
Code:
ffmpeg -y -loglevel fatal -hwaccel dxva2 -threads 1 -i "C:\Users\Selur\Desktop\Dragonball.Z.-.001.-.1080p.BluRay.x264.DHD (1)-001.mkv" -map 0:0 -an -sn  -vsync 0 -pix_fmt yuv420p  -f rawvideo - | x264 --pass 1 --bitrate 527 --profile high --level 4.1 --bframes 5 --b-pyramid none --direct auto --b-adapt 2 --lookahead-threads 10 --rc-lookahead 50 --chroma-qp-offset -2 --aq-strength 0.6 --sar 1:1 --deblock 1:1 --non-deterministic --range tv --stats "H:\Temp\Dragonball.Z.-.001.-.1080p.BluRay.x264.DHD (1)-001_new_20_01_11_2010_01.stats" --demuxer raw --input-res 1920x1080 --input-csp i420 --input-depth 8 --fps 24000/1001 --output-depth 8 --output NUL -
I get:
Code:
x264 [info]: frame I:64    Avg QP:35.08  size: 25571
x264 [info]: frame P:3562  Avg QP:38.70  size:  4281
x264 [info]: frame B:3663  Avg QP:39.86  size:   775
x264 [info]: consecutive B-frames: 14.5% 47.6% 27.6%  4.9%  3.7%  1.6%
x264 [info]: mb I  I16..4: 86.9%  0.0% 13.1%
x264 [info]: mb P  I16..4: 16.1%  0.0%  0.0%  P16..4:  8.9%  0.0%  0.0%  0.0%  0.0%    skip:75.0%
x264 [info]: mb B  I16..4:  0.7%  0.0%  0.0%  B16..8:  3.7%  0.0%  0.0%  direct: 0.9%  skip:94.7%  L0:49.6% L1:49.0% BI: 1.4%
x264 [info]: final ratefactor: 38.30
x264 [info]: direct mvs  spatial:88.0% temporal:12.0%
x264 [info]: coded y,uvDC,uvAC intra: 5.0% 28.0% 4.5% inter: 0.5% 2.0% 0.0%
x264 [info]: i16 v,h,dc,p: 57% 25% 12%  5%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 18% 26%  8%  5%  5%  5%  5%  5%
x264 [info]: i8c dc,h,v,p: 80% 10%  8%  1%
x264 [info]: Weighted P-Frames: Y:2.0% UV:1.2%
x264 [info]: kb/s:519.06

encoded 7289 frames, 57.56 fps, 519.06 kb/s
then using:
{code]ffmpeg -y -loglevel fatal -hwaccel dxva2 -threads 1 -i "C:\Users\Selur\Desktop\Dragonball.Z.-.001.-.1080p.BluRay.x264.DHD (1)-001.mkv" -map 0:0 -an -sn -vsync 0 -pix_fmt yuv420p -f rawvideo - | x264 --pass 2 --bitrate 527 --profile high --level 4.1 --bframes 5 --b-pyramid none --direct auto --b-adapt 2 --lookahead-threads 10 --rc-lookahead 50 --chroma-qp-offset -2 --aq-strength 0.6 --vbv-maxrate 62500 --vbv-bufsize 78125 --sar 1:1 --deblock 1:1 --non-deterministic --range tv --colormatrix bt709 --stats "H:\Temp\Dragonball.Z.-.001.-.1080p.BluRay.x264.DHD (1)-001_new_20_01_11_2010_01.stats" --demuxer raw --input-res 1920x1080 --input-csp i420 --input-depth 8 --fps 24000/1001 --output-depth 8 --output "H:\Temp\20_01_11_2010_02.264" -[/code]
for the 2nd pass, I get:
[codex264 [info]: frame I:64 Avg QP:35.09 size: 21913
x264 [info]: frame P:3562 Avg QP:39.21 size: 4318
x264 [info]: frame B:3663 Avg QP:42.73 size: 903
x264 [info]: consecutive B-frames: 14.5% 47.6% 27.6% 4.9% 3.7% 1.6%
x264 [info]: mb I I16..4: 25.2% 69.7% 5.1%
x264 [info]: mb P I16..4: 3.4% 13.7% 0.2% P16..4: 11.0% 0.6% 0.3% 0.0% 0.0% skip:70.7%
x264 [info]: mb B I16..4: 0.1% 0.1% 0.0% B16..8: 10.3% 0.1% 0.0% direct: 0.0% skip:89.3% L0:37.6% L1:62.2% BI: 0.3%
x264 [info]: 8x8 transform intra:78.1% inter:93.4%
x264 [info]: direct mvs spatial:80.6% temporal:19.4%
x264 [info]: coded y,uvDC,uvAC intra: 6.6% 30.1% 5.4% inter: 0.5% 1.7% 0.0%
x264 [info]: i16 v,h,dc,p: 41% 34% 8% 17%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 6% 61% 1% 1% 1% 1% 1% 1%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 19% 20% 6% 7% 7% 6% 5% 3%
x264 [info]: i8c dc,h,v,p: 83% 7% 8% 1%
x264 [info]: Weighted P-Frames: Y:2.2% UV:1.2%
x264 [info]: ref P L0: 60.6% 11.5% 18.8% 8.9% 0.2%
x264 [info]: ref B L0: 72.4% 27.6%
x264 [info]: kb/s:528.68

encoded 7289 frames, 93.97 fps, 528.68 kb/s][/code]


When using:
Code:
ffmpeg -y -loglevel fatal -hwaccel dxva2 -threads 1 -i "C:\Users\Selur\Desktop\Dragonball.Z.-.001.-.1080p.BluRay.x264.DHD (1)-001.mkv" -map 0:0 -an -sn  -vsync 0 -pix_fmt yuv420p  -f rawvideo - | x264 --pass 1 --bitrate 527 --profile high --level 4.1 --bframes 5 --direct auto --b-adapt 2 --lookahead-threads 10 --rc-lookahead 50 --chroma-qp-offset -2 --aq-strength 0.6 --sar 1:1 --deblock 1:1 --non-deterministic --range tv --stats "H:\Temp\Dragonball.Z.-.001.-.1080p.BluRay.x264.DHD (1)-001_new_20_09_41_0810_01.stats" --demuxer raw --input-res 1920x1080 --input-csp i420 --input-depth 8 --fps 24000/1001 --output-depth 8 --output NUL -
thus using b-frame pyramid 1st pass gets faster:
Code:
[info]: frame I:64    Avg QP:34.77  size: 26768
x264 [info]: frame P:2627  Avg QP:38.92  size:  5050
x264 [info]: frame B:4598  Avg QP:39.38  size:  1028
x264 [info]: consecutive B-frames: 12.7%  9.5% 16.6% 39.4% 12.9%  8.9%
x264 [info]: mb I  I16..4: 86.4%  0.0% 13.6%
x264 [info]: mb P  I16..4: 20.6%  0.0%  0.0%  P16..4:  9.4%  0.0%  0.0%  0.0%  0.0%    skip:70.0%
x264 [info]: mb B  I16..4:  0.9%  0.0%  0.0%  B16..8:  4.1%  0.0%  0.0%  direct: 1.1%  skip:93.8%  L0:47.8% L1:50.0% BI: 2.2%
x264 [info]: final ratefactor: 38.19
x264 [info]: direct mvs  spatial:95.7% temporal:4.3%
x264 [info]: coded y,uvDC,uvAC intra: 5.1% 27.9% 4.5% inter: 0.5% 2.1% 0.0%
x264 [info]: i16 v,h,dc,p: 58% 25% 12%  5%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 18% 25%  8%  5%  5%  5%  5%  5%
x264 [info]: i8c dc,h,v,p: 80% 10%  8%  1%
x264 [info]: Weighted P-Frames: Y:2.9% UV:1.8%
x264 [info]: kb/s:518.52

encoded 7289 frames, 67.84 fps, 518.52 kb/s
and 2nd pass
Code:
ffmpeg -y -loglevel fatal -hwaccel dxva2 -threads 1 -i "C:\Users\Selur\Desktop\Dragonball.Z.-.001.-.1080p.BluRay.x264.DHD (1)-001.mkv" -map 0:0 -an -sn  -vsync 0 -pix_fmt yuv420p  -f rawvideo - | x264 --pass 2 --bitrate 527 --profile high --level 4.1 --bframes 5 --direct auto --b-adapt 2 --lookahead-threads 10 --rc-lookahead 50 --chroma-qp-offset -2 --aq-strength 0.6 --vbv-maxrate 62500 --vbv-bufsize 78125 --sar 1:1 --deblock 1:1 --non-deterministic --range tv --colormatrix bt709 --stats "H:\Temp\Dragonball.Z.-.001.-.1080p.BluRay.x264.DHD (1)-001_new_20_09_41_0810_01.stats" --demuxer raw --input-res 1920x1080 --input-csp i420 --input-depth 8 --fps 24000/1001 --output-depth 8 --output "H:\Temp\20_09_41_0810_02.264" -
gives me:
Code:
x264 [info]: frame I:64    Avg QP:34.75  size: 22954
x264 [info]: frame P:2627  Avg QP:38.95  size:  5126
x264 [info]: frame B:4598  Avg QP:42.19  size:  1119
x264 [info]: consecutive B-frames: 12.7%  9.5% 16.6% 39.4% 12.9%  8.9%
x264 [info]: mb I  I16..4: 24.7% 69.9%  5.3%
x264 [info]: mb P  I16..4:  4.4% 17.4%  0.3%  P16..4: 11.4%  0.7%  0.3%  0.0%  0.0%    skip:65.4%
x264 [info]: mb B  I16..4:  0.1%  0.2%  0.0%  B16..8: 11.1%  0.2%  0.0%  direct: 0.1%  skip:88.3%  L0:41.8% L1:58.0% BI: 0.3%
x264 [info]: 8x8 transform intra:77.5% inter:93.1%
x264 [info]: direct mvs  spatial:92.4% temporal:7.6%
x264 [info]: coded y,uvDC,uvAC intra: 7.0% 30.8% 5.7% inter: 0.5% 1.7% 0.0%
x264 [info]: i16 v,h,dc,p: 41% 34%  8% 16%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28%  7% 59%  1%  1%  1%  1%  1%  1%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 19% 19%  6%  7%  7%  6%  5%  3%
x264 [info]: i8c dc,h,v,p: 83%  8%  9%  1%
x264 [info]: Weighted P-Frames: Y:3.2% UV:1.8%
x264 [info]: ref P L0: 59.2% 12.0% 17.4% 11.0%  0.4%
x264 [info]: ref B L0: 80.0% 16.4%  3.6%
x264 [info]: ref B L1: 92.9%  7.1%
x264 [info]: kb/s:528.41

encoded 7289 frames, 89.77 fps, 528.41 kb/s
which is a bit slower than before, but still way faster than the first pass.


I thought the 1st pass should be the faster of the 2pass not the other way around.
-> Can someone explain this?

Cu Selur

Ps.: Is it my x264 version? I'm using:
Code:
x264 0.155.2901 7d0ff22
(libswscale 5.0.101)
(libavformat 58.5.100)
(ffmpegsource 2.27.0.0)
built on Jan 19 2018, gcc: 7.2.0
x264 configuration: --chroma-format=all
libx264 configuration: --chroma-format=all
x264 license: GPL version 2 or later
libswscale/libavformat/ffmpegsource license: GPL version 2 or later
(using the builds from https://download.videolan.org/x264/binaries/win64/ doesn't change the effect)
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 13th February 2018 at 05:17. Reason: fixed 'code'-tag
Selur is offline   Reply With Quote