[Libav-user] detecting format compatibility

Carl Eugen Hoyos ceffmpeg at gmail.com
Wed Dec 6 17:50:38 EET 2017


2017-12-06 14:01 GMT+01:00 Anton Shekhovtsov <shekh.anton at gmail.com>:

> I am looking for a generic method to detect if specific codec-container
> combination would "work".

This is generally not possible with FFmpeg:
You are expected to know what you try to put into a container.
This is further complicated by several facts (issues) about FFmpeg:
General purpose containers (like avi) accept everything.
Other containers like mpeg-ts and mpeg-ps accept everything
although a very small number of codecs is actually supported.
Other containers do support certain codecs but FFmpeg does
not support writing them.

> I tested this approach:
> Prepare writing to memory buffer and execute just avformat_write_header and
> av_write_trailer (no actual packets).
> If neither function returns an error, assume the formats are compatible.
>
> This seems to solve great part of the problem, but there are exceptions:

> pcm in mp4 is successful (no errors reported)

This surprises me, the error that is shown here in my tests
is often reported by users.

Carl Eugen


More information about the Libav-user mailing list