Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to replace audio track in mkv file (on Ubuntu 11.10) [closed]

I have

  • a mkv file with webm video and ogg audio
  • an ogg audio file

I want to replace the audio in the mkv file with the audio from the ogg file. How can I do that on Ubuntu 11.10 with programs available from default repositories?

The resulting file may also have another format (e.g. avi), but I would prefer mkv. Btw. doesn't ffmpeg have an mkv muxer? My test with param -f mkv resulted in error Requested output format 'mkv' is not a suitable output format

like image 441
didi_X8 Avatar asked Feb 25 '12 18:02

didi_X8


People also ask

How do I change the default audio track in MKV?

Go to the “Audio” tab and next to Audio Track 1, click the plus button to add as many audio tracks as there are in your MKV video. Then, choose the track that you want to set as default and check “Edit this track” > tick “Default track” > keep it as “Yes”.


1 Answers

Matroska file format (mkv) is specified with -f matroskaoption. It should be supported by ffmpeg (version 0.7.3) in Ubuntu 11.10. Use ffmpeg -formats for a list of supported file formats.

To merge specific streams (audio or video) from several files use -i option for each input and -map input_index[:stream_index]. For example, the following command merges the first stream of the first input with the second input and keeps the codecs:

ffmpeg -i input.mkv -i input_audio.ogg -map 0:0 -map 1 \
    -vcodec copy -acodec copy output.mkv
like image 160
Dmitry Shkuropatsky Avatar answered Oct 23 '22 12:10

Dmitry Shkuropatsky