[FFmpeg-user] Identifying an MP4 file

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Mar 31 23:54:24 CEST 2016

Sreenath BH <bhsreenath <at> gmail.com> writes:

> We have a HTTP Live Streaming (HLS) setup where we transcode 
> incoming video files to H264 video and AAC audio and build 
> playlist files from that. We want to avoid this step if the 
> input file is already a MP4 file.

This is difficult to understand:
HLS uses mpeg-ts, mp4 is a different container.

> I know that MP4 is just a container and does not imply H264 
> and AAC.

This is correct.

> I am planning to check the audio and video codec IDs in our 
> program after getting the stream information using 
> avformat_find_stream_info.

avformat_find_stream_info tells you about the codecs used in 
the stream, it does not tell you which container the stream 
has (this has to be determined before).

> So, if the video codec ID and Audio codec ID are respectively,
> Is it sufficient to qualify it as a MP4 file?

No, because H264 and AAC can be found in (many) other containers.

> The reason I ask is that there are some flv files that use 
> the same codecs, but I am not sure if it would be safe it 
> to treat it on par with an "authentic" mp4 file.

An flv and an mp4 file are definitely two different things.
(While an f4v file is an mp4 file.)

Carl Eugen

More information about the ffmpeg-user mailing list