我已经学习 x264 编码 几个月了。我需要的是控制速率并获得平均比特率。以下是我的设置,我得到了一个平均比特率但图像质量很差,所以我需要你的建议或可以帮助我更多地了解 x264 的东西。
Params.rc.i_rc_method = X264_RC_ABR ;
Params.rc.i_bitrate = nBitRate*0.65/1000 ;
Params.rc.i_vbv_buffer_size = nBitRate/1000;
Params.rc.i_vbv_max_bitrate = nBitRate*0.65/1000 ;
Params.rc.f_vbv_buffer_init = 1.0 ;
Params.rc.f_rate_tolerance = 1.0 ;
Params.i_fps_num = ParamIn.dFrameRate*0.6 ;
Params.i_fps_den = 1 ;
Params.i_width = ParamIn.nWidth ;
Params.i_height = ParamIn.nHeight ;
最佳答案
好吧,如果您的视频质量很差……您需要提高比特率。 这就是我用于编码的内容:-
x264 --preset fast --profile high --level 4.1 --tune animation --ref 10 --subme 9 --merange 32 --bitrate 500 --me umh --input-res 848x480 --trellis 2 --pass 1 -o Outvideo.mp4 input.mp4
x264 --preset fast --profile high --level 4.1 --tune animation --ref 10 --subme 9 --merange 32 --bitrate 330 --me umh --input-res 848x480 --trellis 2 --pass 2 -o Outvideo.mp4 input.mp4
好吧,我做 2 遍,因为有很多原因它比 1 遍好,如果你正在做基于比特率的编码,2 遍总是有帮助的!您可以使用“--bitrate x
”选项选择比特率。只需将“x
”更改为您想要的平均比特率即可。
关于c++ - x264码率控制集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16997546/