MWB
MWB

Reputation: 12617

Get compression rate from ffmpeg output?

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.

Upvotes: 3

Views: 1906

Answers (1)

drake7
drake7

Reputation: 1244

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!

Upvotes: 2

Related Questions