3

So, I know about the obvious

ffmpeg -version

but 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 -h

but I didn't find anything that seemed relevant. For instance, I found these:

ffmpeg -encoders
ffmpeg -codecs

They do list encoders or codecs, but without their version :/

1
  • 2
    Not implemented. – Gyan Aug 13 '18 at 16:02
4

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.mp4

Then 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).

0

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 dirac

Above 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=Encoder

For instance, in BaSH you could have something like this in a script:

if [[ $(ffmpeg -v quiet -codecs | grep ".*DE.*dirac.*") ]]; then echo "true"; fi

The 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"; fi

to check for an encoder:

if [[ $(ffmpeg -v quiet -codecs | grep ".*E.*codec-name.*") ]]; then echo "true"; fi

to 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
-2

List all available decoders

ffmpeg -decoders

List all available encoders

ffmpeg -encoders

External 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-0106f9f2f867

Hope that helps. Cheers.

3
  • 1
    The installed binaries are not a good source for checking the version. They may differ depending on the PATH, and ffmpeg may have been compiled statically against another version of the library altogether (which may not even have an executable on the system). – slhck Aug 14 '18 at 10:47
  • Ah okay. I happen to install mine using that x265 path. If you don't know what library was used during install it would complicate matters. However, FFmpeg does require x265 to be installed on your system per trac.ffmpeg.org/wiki/Encode/H.265 (bundled or not). – iangetz Aug 14 '18 at 12:38
  • 2
    That's not correct – the requirement only applies when you're building the binary. FFmpeg does not require x265 to be installed. You can, for example, go to johnvansickle.com/ffmpeg and just download the binary, which will run on its own. – slhck Aug 14 '18 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.