So recently I had a nice high quality 1080p file with a dodgy audio track on it along with a 720p file with a correct audio track on it. Obviously I wanted to keep the 1080p file on my server but I just needed to switch out the audio. Turns out it is pretty straight forward and whilst I am not going to go through step by step I will list the commands I used that made this possible.
mkvextract – This is what does the actual extraction part, see this link for some documentation. Basically you have to specify the file and the track to extract.
mkvmerge -i <file> – This command tells us the number of the track that we need to use, quite helpful
As an example here is the command I used: mkvextract tracks file.mkv 2:test this extracts track 2 of file.mkv and names it test.
Then I used MkvToolNix Gui program and opened up the 1080p file, added in the new audio track (and removed the dodgy old audio track) and re-encoded the video. Job done.
After that all I had to do was get subtitles, the only downside the available subtitles didn’t account for my video having a 13 second introduction. So much twiddling, cutting, and offsetting I was able to get it working. I used Shotcut for the video editing. That program worked a treat.