Search code examples
mp4h.264oggmkv

Video file formats for H.264


I need to develop a small module, that can read and write h.264 packets to a container file. So far I have understood, typically h.264 encoded packets are stored in a mp4 file.

My question is, can h.264 encoded packets be stored in other file containers like in ogg file or in mkv file or in webm file.

If yes, how do I convert a mp4 file to an ogg file or mkv file or webm file, keeping same h.264 encoded packets in file.


Solution

  • H.264 can go into MP4, MKV, webm (pretty much same as MKV), FLV, F4V and others. Please check https://en.wikipedia.org/wiki/Comparison_of_video_container_formats

    For conversion I'd use ffmpeg which will do most combinations.

    ffmpeg -i inputfile.xyz -vcodec copy ... (specify output file and audio stream)