4

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.

  • 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 '14 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. – PTS Jun 9 '14 at 13:48
  • Scratch that, tsMuxer only allows MP4 as input not as output. – PTS Jun 9 '14 at 14:25
5

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.

2

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.

-1

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
  • Thanks, but how does it differs from the answer of the sgryzko? – Slava Fomin II Jul 19 '18 at 16:05
  • It is simplified, yet provides the same resultant function. – ransur0t Jul 20 '18 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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