[FFmpeg-user] how to detect a 264 or 265 file

Tom Evans tevans.uk at googlemail.com
Tue Jul 7 14:22:54 CEST 2015


On Mon, Jul 6, 2015 at 4:01 PM, Carlo Politi
<politi.carlo-at-yahoo.it at ffmpeg.org> wrote:
> Good  evening,  my  question  could  be  silly:  i'm trying to write a
> software  to  detect  its  content  type but i don't know which is the
> signature to look for to see if the file i'm analyzing can be a 264 or
> 265  file or not. Could anyone tell me about the header of these video
> formats? In future i could add some other format to detect but for the
> moment i could need these... Any help is welcome.. Thanks

H264, H265 are codecs. Codecs generally do not have headers, but are
stored in containers, and containers have metadata (headers) that
indicate what codec is stored in the container.

Examples of containers are MKV, MP4, MOV, MPEG-TS and AVI. Each of
these containers is reasonably well defined on the internet, google is
your friend here.

However, to determine what codecs are in use in a single file, simply
use ffprobe. Detecting container format and decoding their metadata is
a large chunk of what ffmpeg is designed to do, and ffprobe is a tool
for probing a file to display that information. Something like:

  ffprobe -v quiet -print_format json -show_format -show_streams file.mp4

will output the data in a machine readable format that your tool can interpret.

It is worth reading and understanding the differences between a
container and a codec however.

Cheers

Tom


More information about the ffmpeg-user mailing list