reaching constant video bitrate by using ffmpeg
- by sebastian
We use ffmpeg and a transcoding script for transcoding and want to make some batch files which we can use for transcoding.
For example I use a parameter called video_kbit and if I am writing in 30000 it should reach 30 Mbit. Of course if I use 6000 as parameter it should reach 6 MBit as well, so I have one script which reaches every video bitrate I want.
As my settings are now, I only reach 18.1 Mbit. Only when I use 15000 as a parameter I am reaching my goal for a constant video bitrate of 15 MBit. If I use 8000 as parameter I get 10.1 MBit as a result. So under 15000, I get a higher bitrate and over 15000, I get a lower bitrate than I want.
My presettings are:
ffmpeg -threads "4" -i "$2" -f mp4 -c:v libx264 -crf 1 \
-bufsize 30000k -maxrate ${FC_PARAM_video_kbit}k \
-acodec libfaac -ac 2 -ab ${FC_PARAM_audio_kbit}k -ar 44100 \
-pix_fmt yuv420p -vf scale=${FC_PARAM_width}:${FC_PARAM_height} -y "$3"
And I am using these parameters:
FC_PARAM_video_kbit = 30000
FC_PARAM_audio_kbit = 192
FC_PARAM_width = 1920
FC_PARAM_height = 1080
I have tried using a higher bufsize and using profile:v and level settings, but nothing got me near the constant video bitrate of 30000 Mbit.
Do you guys have any ideas or suggestions for a better way to reach my goal?