View Full Version : Creating a MP4 from seperate audio/video files

27th April 2012, 15:32
Hi Guys,

I've written a linux script to convert large HD mkv files to smaller SD versions (still in mvk containers). My script basically extracts the audio, then performs 2pass encoding to create a h264 video file, I then reduce the audio bitrate and use mkvmerge to merge the audio and video back into a mkv file.

I was wondering though if there is a tool similar to mkvmerge which will take these serperate audio and video files and create a mp4 file instead of an mkv (so I wouldn't need to transcode the video again).

Any pointers would be well received.

27th April 2012, 15:40

27th April 2012, 23:09
ok I've now got them combined using the command

ffmpeg -vcodec copy -acodec copy -i videofile.h264 -i audiofile.ac3 output.mp4

The result is an mp4 file which opens fine but the video is a little choppy .... the same video source plays fine when mkvmerge creates a mkv file from these sources.

Am I missing some parameters from ffmpeg?

28th April 2012, 01:14
MP4Box is a safer tool than FFmpeg for this. Try and see if it avoids the choppiness.

28th April 2012, 11:37
MP4Box worked a treat .... thanks guys!

Anybody wanting to achieve the same, the command turns out to be simple:

MP4Box -add videofile -add audiofile outputfile.mp4