-preset <int> E..V..... Set the encoding preset (from 0 to 11) (default medium)
default E..V.....
slow E..V..... hq 2 passes
medium E..V..... hq 1 pass
fast E..V..... hp 1 pass
hp E..V.....
hq E..V.....
bd E..V.....
ll E..V..... low latency
llhq E..V..... low latency hq
llhp E..V..... low latency hp
lossless E..V.....
losslesshp E..V.....
h264的preset option如上图。我将测试slow\medium\fast,相同的,我采用这样的方式调参(只调低八位)https://blog.csdn.net/qq_39575835/article/details/84960426
slow
平均psnr=83.98419246698484
最低psnr=78.80201488461105
文件压缩比=874MB/(1.17MB+7.81MB)=91.20267260579064倍
fast
变慢了。。但是差不多,可以理解为机器误差。
平均psnr=83.82493087802388
最低psnr=77.26395215294193
文件压缩比=874MB/(1.17MB+7.97MB)=89.60612691466082倍
所以基本上变差了
medium
平均psnr=83.93292173401852
最低psnr=78.25328229915203
文件压缩比=874MB/(1.17MB+7.92MB)=90.0990099009901倍
可以看出 对于设置preset带来的影响对于速度上没有特别大的影响,所以我们预置低八位slow得到最好的品质是最好的选择。
b帧
-bf integer (encoding,video)
Set max number of B frames between non-B-frames.
Must be an integer between -1 and 16. 0 means that B-frames are disabled. If a value of -1 is used, it will choose an automatic value depending on the encoder.
Default value is 0.
我们不要擅自调整限制,采用默认,不然结果很糟。
结果分析
可以看到脑图刚出来,qp维持在41左右,量化造成的损失很大。接下来和hevc一样,我们调调qp范围。
-qmin 1 -qmax 35
平均psnr=84.18797683870402
最低psnr=80.9473052814355
文件压缩比=874MB/(1.17MB+8.52MB)=84.52012383900929倍
-qmax number | avr_PSNR | min(PSNR) | 压缩比 |
41 | 83.98446 | 78.79338 | 97.32739 |
40 | 83.99672 | 79.30719 | 97.11111 |
39 | 84.01894 | 79.66555 | 96.46799 |
38 | 84.06835 | 80.02944 | 94.79393 |
37 | 84.11644754653841 | 80.38978992853069 | 93.37607 |
36 | 84.14762125855289 | 80.66212440273685 | 92.09694 |
35 | 84.18797683870402 | 80.9473052814355 | 90.19608 |
34 | 84.23899790033971 | 81.29605067489734 | 87.22555 |
33 | 84.27275258636384 | 81.53102673601046 | 85.435 |
32 | 84.30509622252255 | 81.76909561405226 | 83.39695 |
31 | 84.34989056236945 | 82.01134888467965 | 78.38565 |
30 | 84.38151177224792 | 82.15007190448009 | 73.01587 |
29 | 84.46647109650303 | 82.42370103747483 | 61.24737 |
- h264_nvenc没啥问题,但是hevc_nvenc 会出现这些的毛刺,比如我在qmax=28时候使用-preset slow(如图左) 和使用 –preset default(如图右),其他参数一样。
但是,当我在qmax=35或者更大时候时候使用-preset slow又会出现毛刺,而–preset default不会出现毛刺,其他参数一样。