Get compression rate from ffmpeg output?

Viewed 1088

During encoding, ffmpeg accepts a "compression rate" (crf) parameter (different from the actual compression ratio) when the H264 codec is used:

ffmpeg -i input.mp4 -vf fps=15 -crf 20 -c:v libx264 output.mp4

Is it possible to get the value of this parameter back by examining the video file? It doesn't seem to be part of the metadata, as far as I can tell.

1 Answers

You can use mediainfo and look at the Encoding Settings:

mediainfo input.mp4

To only show crfyou could select it like so:

mediainfo input.mp4  | grep "Encoding settings" | cut -d':' -f2- | tr '/' '\n' | sed 's/ //' | grep crf=

Have a look at slhck's deatiled post from whom I slightly adapted the GREP/SED command.

Caveat: There are videos where mediainfo doesn't retreive Encoding Settings!

Related