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

1

9

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

Confectionery answered 25/2, 2012 at 18:6 Comment(1)
@casperOne How exactly is this question off topic?Sulcus
A
28

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
Anthropo answered 26/2, 2012 at 2:48 Comment(3)
thanks, that was exactly the cmd I needed. And sry for posting a "wrong" question, wasn't aware about that.Confectionery
It's not so much the wrong question (it is a fine question) as it is the wrong site. This should have been asked on superuser.comJournalese
VLC stops opening an mkv file after this command (Ubuntu 14.04).Rowney

© 2022 - 2024 — McMap. All rights reserved.