0

I usually do conversions with ffmpeg 1 pass CRF 22 with maxrate 1400k for some movies to convert them to 720p and generate smallest size with best quality, the parameters I use is:

c:v libx264 -vf format=yuv420p,scale=1280:-2 -crf 22 -maxrate 1400k -bufsize 7000k

Doing this too much I found that apart from the black bars that reduces bitrate, the color theme, number of high movement scenes... etc affects the bitrate too much, CRF 22 makes sure you get constant quality at every scene, that makes bitrate reaches my maximum 1400k at some scenes while the reset of the scenes in some movies are barely 800k, this result the average bitrate for a same movie reaches for example about 1100k, for these movies I do the encoding again with lower maxrate (Ex:1100k) and I get same quality with lower average rate 1000k.

Now I'm wondering is there any automated method in 2 pass to get same result? For example doing the first pass in CRF 22 and the second pass at average bitrate of first pass to lower the quality of those bitrate rages in first pass?

Alireza Rinan
  • 480
  • 6
  • 9

2 Answers2

0

I`m newbie, but i have some idea.

3 pass encoding may be help you.

For the first time, the bitrate is calculated based on the resolution and crf compression ratio.

ffmpeg -i abcd1.mp4 -an -s 720*404 -vcodec libx264 -crf 18 -pass 1 -f mp4 -y NUL
[libx264 @ 051106c0] kb/s:23.31

this bitrate according to the crf calculate.

compare it with the maxbitrate, using smaller one to transcode.

0

I found that I can do 2 pass separately, do the first pass, check log for resulted bitrate, do the second pass based on average bitrate.

Alireza Rinan
  • 480
  • 6
  • 9
  • example: -pass 1 -c:v libx264 -vf format=yuv420p,scale=1280:-2 -crf 22 -maxrate 1400k -bufsize 7000k then determine for example overalbitrate is 900k and do the second pass using new overal bitrate: -c:v libx264 -vf format=yuv420p,scale=1280:-2 -crf 22 -maxrate 1000k -bufsize 5000k – Alireza Rinan Sep 28 '22 at 10:37