
metadata:s:a:0 language=eng -metadata:s:a:1 language=sme -codec copy \Ġ:v – The 0 refers to the first input which is video.mkv. Replace second audio streamįfmpeg -i video.mkv -i audio.mp3 -map 0:v -map 0:a:0 -map 1:a \ Default stream selection will only choose one of each stream type, so that is why -map has to be used. I’m still a beginner in this, so if you do notice any errors, please comment.ĭocumenting this is both a note for myself and hopefully may help othersįind this by googling (it was surprisingly difficult to find this combination).Use the -map option to choose your streams. ac 2 sets output audio to have 2 channels (stereo).q:a 3 is VBR quality 3 for the LAME codec.c:a libmp3lame uses LAME to convert the audio to MP3, here you could use.c:v copy sets video codec to copy which just copies it without changing.We use the original video as video track and the filtered audio a as the map switches select the used video and audio tracks for the output.Need to modify the 2 and the inputs if you had more than 2 audio tracks amerge=inputs=2 merges the given 2 input audio tracks.

selects both the 0th input file’s 0th audio track and l from.volume=0.1 lowers the volume (this can also use dB units) and puts.picks the 0th input file’s 1st audio track as input for the filter.SoĪ filter with two inputs looks like this: filter. Inside it,įilters have inputs and outputs that are the parts in square brackets. filter_complex is a series of filters that operates on the input.My understanding of the command is as follows: On the mic track (track 1), and copies the video data without re-encoding: ffmpeg -i 'input.mkv' -filter_complex 'volume=0.1 amerge=inputs=2' -map '0:v:0' -map '' -c:v copy -c:a libmp3lame -q:a 3 -ac 2 'output.mp4' ThisĬommand merges the audio tracks in the input video, lowers the volume
.png)
This is just a quick post to store the command I used to do that. I was surprised to find that multi-track files were not properly supportedīy many programs like Handbrake (or YouTube for that matter), so I needed to OBS writes two audio tracks to the file, one for game audio and one for my

I use OBS Studio to store replays of my games with my friends for later. Combining Audio Tracks in a Video With Ffmpeg – Random Notes Random NotesĬombining Audio Tracks in a Video With Ffmpeg
