Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have four MP4 files called "file_1", "file_2", "file_3" and "file_4" and I wish to merge them into one file in the following order: file_1, file_2, file_3 and file_4.

file_1 has the following characteristics:

frame width       = 640
frame height      = 480
frame rate        = 29 frames/second
audio sample rate = 44kHz

file_2, file_3, and file_4 each have the following characteristics:

frame width       = 640
frame height      = 480
frame rate        = 30 frames/second
audio sample rate = 48kHz

Using the "append" feature in Avidemux v2.5.4, I merged file_2 and file_3 into file_2_3, with the audio and video remaining in sync in file_2_3. Then, once again using the "append" feature, I merged file_2_3 and file_4 into file_2_3_4, with the audio and video remaining in sync in file_2_3_4.

Then, I merged file_1 with file_2_3_4 into file_1_2_3_4. However, the audio and video in file_1_2_3_4 were not in sync. When file_1_2_3_4 is played, everything is OK during the file_1 portion. However, starting with the file_2 portion, the audio and video go out of sync.

Then, I tried the reverse. I merged file_2_3_4 with file_1 into file_2_3_4_1. When file_2_3_4_1 is played, the file_2_3_4 portion is OK. However, the audio and video go out of sync in the file_1 portion.

So, I used Avidemux to change the frame rate on file_1 to 30 frames/second. The frame width, frame height, and audio sample rate remained the same. Once again, I used Avidemux to merge file_1 with file_2_3_4 into file_1_2_3_4. Once again, starting with the file_2 portion, the audio and video go out of sync.

So, what do I have to do to make sure that audio and video are in sync throughout file_1_2_3_4? Should I convert the audio sample rate of file_1 to 48 kHz? What software do I use to do this? I heard of a software tool called MP4 Joiner. Will this help?

share|improve this question
add comment

1 Answer 1

You're going to need to re-encode file_1 as 30 frames/second. You can do this with x264 or mencoder or one of a very large number of freeware encoding utilities. You can't just join the files together if they don't have the same framerate. You will also need to reencode the audio to be the same sample rate. I suggest using sox to modify the wave form and then recompress with whichever codec you're already using.

share|improve this answer
    
Do I re-encode the framerate and the audio sample rate at the same time? Or do I re-encode the framerate first and THEN re-encode the audio sample rate? And does SoX re-encode both frame rate and audio sample rate? As I mentioned above, I have already been able to change the frame rate to 30 by using Avidemux. So, do I just re-encode the audio sample rate? Also, I am not sure which codec I am using. How do I find out? Thanks for your reply. –  Rob42 Jan 22 '11 at 20:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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