[FFmpeg-user] Difference between FFmpeg Formats/Containers MP4 and H264

Kieran O Leary kieran.o.leary at gmail.com
Sun May 15 12:50:00 EEST 2022


Hi,


On Sun, May 15, 2022 at 3:58 AM Roger <rogerx.oss at gmail.com> wrote:

> >MP4 can contain a variety of streams, including h264. If you specify h264,
> >you just have a raw h264 video stream, that's it.
>
> I've always used -f h264 until I ran into Hauppauge WinTV Version 10 using:
>
> ffmpeg -i "[SOURCE_FILE]" -f mp4 -vcodec libx264 -preset ultrafast
> -profile:v main -acodec aac "[DEST_FILE].mp4
>
> On the flip, I've never seen a *.h264 file name.
>

I've seen it pop up a few times but I haven't seen a lot of raw h264
streams in general.


>
> If I'm not mistaken, the "-f" specifies the format or the container of the
> video/audio stream.
>

>From the ffmpeg documentation:
-f fmt (*input/output*)

Force input or output file format. The format is normally auto detected for
input files and guessed from the file extension for output files, so this
option is not needed in most cases.




>
> So when specifying, "-f h264", format is assuming a video only container?
>

I'm not sure if container is the correct term here. It's just the video
stream itself, which is capable of existing on its own outside of a
container. Not many streams allow that. DV is one that comes to mind, where
you can get raw DV streams which can even contain audio streams and other
data streams interleaved. I've ran some tests and have not found a way to
retain audio while using -f h264, it just retains a video stream. Maybe I'm
doing something wrong?

I can't think of many reasons why you would want standalone video streams
outside of a container, so why not just use the mp4 or mkv format as it
should have greater compatibility with playback tools?

Best,

Kieran

>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list