Aurelien Stride
Aurelien Stride

Reputation: 61

FFMpeg and max bitrate

For a personal project, using AV1 codec, I have a bitrate constraint for a video to 88kbps, with choosen video bitrate at 66kbps and mono audio bitrate at 22kbps.

I currently use this command:

ffmpeg -i input.mp4 -c:v libaom-av1 -strict -2 -b:v 66150 -c:a libfdk_aac -ar 22050 -b:a 22050 -ac 1 -maxrate 66150 -bufsize 66150 -vf scale=720:-1 -movflags +faststart output.mp4

However, my final video has a 95kbps bitrate:

Duration: 00:01:09.73, start: 0.000000, bitrate: 95 kb/s

Stream #0:0(und): Video: av1 (Main) (av01 / 0x31307661), yuv420p(tv, progressive), 720x302, 69 kb/s, 24 fps, 24 tbr, 12288 tbn, 12288 tbc (default)

Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 22 kb/s (default)

Is there a method to validate my need? Is it normal that 66+22>88kbps?

Regards,

EDIT 1: as @Gyan suggested, I've tried to reduce -bufsize parameter, but I still have a too high bitrate. The most working way is to set video bitrate -b:v to 50kbps, but it gives poorer image...

ffmpeg -i input.mp4 -c:v libaom-av1 -strict -2 -b:v 50k -c:a libfdk_aac -ar 22050 -b:a 22050 -ac 1 -minrate 33075 -maxrate 66150 -bufsize 44100 -vf scale=-1:360 -movflags +faststart -threads 1 output.mp4

Any idea to limit overhead, if overhead is in cause?

Upvotes: 0

Views: 4549

Answers (1)

Aurelien Stride
Aurelien Stride

Reputation: 61

After a few exchanges, here's a very suitable solution, with a 84kbps bitrate and a good image quality, thanks to this page, using 2-pass encoding:

ffmpeg -i input.mp4 -c:v libaom-av1 -strict -2 -b:v 65k -pass 1 -c:a libfdk_aac -ar 22050 -b:a 22050 -ac 1 -minrate 54k -maxrate 72k -bufsize 33075 -vf scale=-1:360 -movflags +faststart -threads 1 -an -f mp4 /dev/null && _
ffmpeg -i input.mp4 -c:v libaom-av1 -strict -2 -b:v 65k -pass 2 -c:a libfdk_aac -ar 22050 -b:a 22050 -ac 1 -minrate 54k -maxrate 72k -bufsize 33075 -vf scale=-1:360 -movflags +faststart -threads 1 output.mp4

Note: it may ask you to overwrite /dev/null.

Thanks to all of you for your help!

Upvotes: 1

Related Questions