How can I convert .264 file to .mp4

I want to convert an elementary stream(.264) to container format(.mp4). Can someone please help me on this? How can I use ffmpeg to do this task? What are all the other methods that could accomplish the same task?


This is easy with ffmpeg:

ffmpeg -framerate 24 -i input.264 -c copy output.mp4
  • This simply stream copies (re-muxes) the video so there is no unnecessary re-encoding occurring; therefore the quality is preserved and the whole process is quick.

  • Frame rate is by default assumed to be 25. You can change this with the -framerate input option. Typical values are 30000/1001, 25 (default), 24000/1001, 24, or frame rate aliases such as ntsc, ntsc-film, or pal.

  • If you don't know the frame rate, you can perform the conversion using your best guess as to the frame rate, and then compare the running duration of the output file with the input file running duration and then calculate the actual frame rate. e.g. assume 24 fps and actual running time of 1:00:00 (60 mins) if resulting file has running time of 1:02:30 (62.5 mins) then actual frame rate is 25 fps (24 * 62.5 / 60)


Try these commands :

sudo apt-get install x264
x264 raw_stream.264 -o playable_video.mp4

Run the MP4 files in VLC