[FFmpeg-user] Mux encoded video data directly into mp4 files

fernando.takeshi fernando.takeshi at seventh.com.br
Wed Sep 17 01:39:03 CEST 2014


I've been searching for ways to create .mp4 files directly from saved raw
video data. The sources of said data can record frames in the h264, mpeg and
mjpeg formats; I end up with files that are basically raw frames of these
formats, one after the other.

Now, I've tested the command line approach (that I cannot use,
unfortunately) and it seems to work for h264 and mpeg files, but not for
mjpeg. I need to do this programmatically; so I've followed ffmpeg's muxing
example and many others I found online (stackoverflow, etc) and can't seem
to find any consistency in how to (or what would be the correct way to)
accomplish this.

Right now, I do not have any sample code working - the muxing example
generates a divide by zero error on av_write_frame (I tried messing with
DTS/PTS but nothing seems to work). Other examples all yielded different
results, but none worked.

So, what I ask is basically: given a file consisting of raw frames (h264,
mpeg or mjpeg), how do I go about creating a playable video mp4 file? What
would be the correct way? Specifically speaking, which functions should I be
calling and in what order as to make the code work for those three formats?

Some sample data can be found at

Thanks in advance!

View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Mux-encoded-video-data-directly-into-mp4-files-tp4667372.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.

More information about the ffmpeg-user mailing list