Write compressed frames to mpeg4 chuncks c++
Question
I'm looking to write already compressed (h264) image data into an MPEG-4 video file. Since this code needs to be optimized to run on an embedded platform the code should be as simple as possible. Best would be to just give some header information (like height width format fourcc etc.) and a filename and the compressed data and have that transformed into a data chunck and writen to that file.
So what i need either of these:
- MPEG-4 header information (what goes where exactly)
- Is there a main header or are there just headers for each data chunck
- What header information is needed for a single video stream (rectangular)
- What header information is needed for adding audio
- A simple MPEG-4 file writer that does not have to do the compression itself and also allows to add audio frames. (c/c++)
Solution
.MP4
file format is described in MPEG-4 Part 14 specification. It is not just main header and subheaders, it has certain hierarchy and so called boxes in there. Some of your choice to write data into .MP4
file:
- FFmpeg (libavcodec, libavformat) - related Q and related code link
- In Windows via DirectShow API - GDCL MP4 Multiplexer or numerous commerical similar offerings
- In Windows via Media Foundation API - MPEG-4 File Sink
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow