So, I know about the obvious
ffmpeg -versionbut it doesn't give info such as which version of libx265 is included in my current ffmpeg build. Is there an easy way to check it, apart from converting a small dummy file using the codecs that I want to check and then reading the file's metadata?
I looked into
ffmpeg -hbut I didn't find anything that seemed relevant. For instance, I found these:
ffmpeg -encoders
ffmpeg -codecsThey do list encoders or codecs, but without their version :/
14 Answers
Unfortunately that's not possible.
The only way to find out is to run an actual encode:
ffmpeg -f lavfi -i nullsrc -frames:v 1 test.mp4Then check the metadata of the output file. Note that not all encoders will write such metadata though.
Some encoders also show their version when running ffmpeg with -loglevel debug.
Do not rely on existing binaries or libraries present on your system, as your ffmpeg version may have been statically compiled against a different library (such as the case with static builds available from ffmpeg.org).
Actually, if you are on a Linux platform, yes there is a simple way to verify.
There are a few ways to do it, depending on how high of a level of confidence you require in terms of accuracy. For instance, if you know that if a codec is available, that it has the capability you need (e.g. Decode or Encode), then a very basic search is all you need, such as this:
ffmpeg -v quiet -codecs | grep diracAbove will return a result if the codec support exists, and null if it isn't. Keep in mind, this is a crude solution, and therefore false positives are plausible. It's not a good method if you need to differentiate between similarly named codecs. However, the technique can still be applied, with a bit more effort.
If you don't know whether a codec has the capabilities you need (e.g. in a script), it's possible to check for both the codec function(s) and codec name in a similar manner:
ffmpeg -v quiet -codecs | grep '.*DE.*opus' ^ name of codec you would enter on command line ^^ D=Decoder; E=EncoderFor instance, in BaSH you could have something like this in a script:
if [[ $(ffmpeg -v quiet -codecs | grep ".*DE.*dirac.*") ]]; then echo "true"; fiThe line above will return "true" if ffmpeg is capable of both decoding and encoding Dirac streams.
Explanation: if you run ffmpeg with the -codec switch, you will get an output of all codecs it understands. The codecs are prefaced with letter codes that describe their function. 'D' means Decode, meaning that particular codec has decoding capability (read). While 'E' means Encode, or compiling/writing capability using that particular codec.
The -v quiet flag suppresses the ffmpeg text header in its output.
To re-cap, the format is:
ffmpeg -v quiet -codecs | grep {codec-name}or
codec_exists=$(ffmpeg -v quiet -codecs | grep codec-name)or to check for a decoder:
if [[ $(ffmpeg -v quiet -codecs | grep ".*D.*codec-name.*") ]]; then echo "true"; fito check for an encoder:
if [[ $(ffmpeg -v quiet -codecs | grep ".*E.*codec-name.*") ]]; then echo "true"; fito check for whether a codec name exists AND it can decode AND it can encode:
if [[ $(ffmpeg -v quiet -codecs | grep ".*DE.*codec-name.*") ]]; then echo "true"; fi Often the version will show in the name of the codec library. You just have to figure out where the libraries are located. For example on Linux:
$ which ffmpeg
/usr/local/bin/ffmpeg
$ ldd /usr/local/bin/ffmpeg ...
$ ls -l /usr/local/lib/libx265*
/usr/local/lib/libx265.199.so List all available decoders
ffmpeg -decodersList all available encoders
ffmpeg -encodersExternal encoders such as H.265 must be installed separately and enabled during compile using '--enable-library' (e.g. --enable-libx265). In which case, you can use the libx265 on the command line to check version.
On my system:
$ ./bin/x265 -V
x265 [info]: HEVC encoder version 2.8+40-0106f9f2f867Hope that helps. Cheers.
3