14

I have two files, one is MP4 file with video only and another is M4A audio file. What is the best and simpliest method of merging these two tracks in a single MP4 container? Is it possible to do this without transcoding (loosing quality)? Thanks!

Open source and free software is my preference.

3
  • 1
    Do they actually line up correctly or do you also need to synchronize them? If it is synced, this is effectively a duplicate of video.stackexchange.com/questions/10730/…. Different source for the streams, but same solution should work.
    – AJ Henderson
    Jun 9, 2014 at 13:28
  • I wouldn't say its a 100% duplicate. While the answer works, there are also other tools specifically for MP4. The question might help people that search specifically for MP4 merging.
    – timonsku
    Jun 9, 2014 at 13:48
  • Scratch that, tsMuxer only allows MP4 as input not as output.
    – timonsku
    Jun 9, 2014 at 14:25

3 Answers 3

17

ffmpeg looks promising. Might be worth a shot.

Specifically, the command

ffmpeg -i video.mp4 -i audio.m4a -acodec copy -vcodec copy output.mp4

should do the trick.

3

MP4muxer will do the job, it even takes raw h264 streams.

This process is usually called "muxing" and can be done with virtually any container format. Of course audio and video has to have the exact same length to have synchronized audio and video.

0
2

If your output container can handle the relevant codecs, then you can simply copy both audio and video streams using ffmpeg:

ffmpeg -i video.mp4 -i audio.m4a -c copy output.mp4
2
  • Thanks, but how does it differs from the answer of the sgryzko? Jul 19, 2018 at 16:05
  • 1
    It is simplified, yet provides the same resultant function.
    – ransur0t
    Jul 20, 2018 at 20:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.