[LAU] How to combine separate video and audio tracks together?

Bent Bisballe Nyeng deva at aasimon.org
Sun Jan 25 12:54:30 UTC 2015


On 01/25/15 01:38, david wrote:
> On 01/24/2015 12:59 PM, Markus Seeber wrote:
>> On 01/24/2015 09:57 PM, david wrote:
>>> I've done nothing with video except play them from YouTube.
>>>
>>> I've noticed that YouTube separates HD1080 video from the audio tracks,
>>> meaning I can't just download the HD1080 vid and watch it comfortably
>>> using my USB sound card. But I can download the HD1080 vid and the audio
>>> track separately.
>>>
>>> Ideas? Thanks.
>>>
>>
>> ffmpeg and avconv can do the Job fo you.
>>
>> for example:
>> http://superuser.com/questions/277642/how-to-merge-audio-and-video-file-in-ffmpeg
>>
>
> Thanks, I'll try that, too. I just finished doing it using Kdenlive
> (took about 30 minutes to render on this 2.4GHz i7!) but it has an audio
> glitch toward the end.
>
> Well, ffmpeg was a LOT faster. Also produced a smaller final MP4 (250MB
> vs 266).
>
> Still has the audio glitch towards the end, though. Let's listen to the
> audio-only track, maybe the glitch is in it. Ah, yes, the glitch is in
> the audio track. Tried downloading some other versions of the audio
> track, they all have the glitch.
>
> Oh, well! I have a decent combined video. Thanks for the help!
>
You can also do it in realtime, so you don't have to produce a new video 
file, using mplayer.
Assuming the video file is called video.mp4 and the audio file is called 
audio.mp3 you can simply use (assuming you want it to play through jack, 
otherwise simply ignore the '-ao jack' argument):

  mplayer video.mp4 -audiofile audio.mp3 -ao jack

Sometimes the audio doesn't sync up with the video, and then you can 
'resync' using '+' ansd '-' keys while playing in order to 'move' the 
audio +/-100ms.

I hope this helps.

Kind regards
Bent Bisballe Nyeng


More information about the Linux-audio-user mailing list