VideoHelp Forum
+ Reply to Thread
Results 1 to 14 of 14
Thread
  1. hey all,

    i have been searching and i can't seem to find the right answer, or i don't know enough about this kind of stuff on OS X


    I have a large folder of Multi Audio MKV files, and i need to disable 3 of the 4 audio tracks

    I know how to do this one by one, but i have read i should be able to do this with a batch file... I can't for the life of me, get any of the examples to work for me.

    Could anyone please point me in the right direction.
    Last edited by neostylez; 13th Sep 2015 at 21:48. Reason: change title
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Can you post an example that doesn't work?
    Quote Quote  
  3. Do you want to disable or remove the tracks?

    For removing you need to write a script using mkvmerge:
    Code:
    #!/bin/bash
    
    mkdir "output"
    
    for filename in ./*.mkv
    do
         mkvmerge -o "./output/$filename" --audio-tracks 1 "./$filename"
    done
    "1" is a trackID in this case. Mkvmerge counts all tracks and starts with 0 so "1" is the second track of the file. You can also use language codes like "eng", e.g. if you only want to keep English audio.
    Quote Quote  
  4. Can anyone help me to setup a script for Mac and MKVToolNix to delete unwantend audio tracks (in my case ID2) from a whole bunch of MKV's?

    I'm so sorry but I'm a absolute newbie.

    Would be so great if anyone could help me.

    Bets wishes from Germany!
    Quote Quote  
  5. You should be able to use the script I posted above. It will only keep audio track ID1 so it will already do what you want if there are only two audio tracks. Otherwise you can use "!2" instead of "1". It means "keep all audio tracks except ID2".
    Quote Quote  
  6. Thank you for your reply but how do I have to use it? Do I have to use it within MKVToolNix or do I have to run AppleScript and create something?
    Quote Quote  
  7. There are different ways to run it. One is to save it in a text file called e.g. "whatever.sh" and copy that to the folder you want to work in. Then open the terminal and navigate to said folder (cd command...). There you need to make it executable once via "chmod +x whatever.sh". Then "./whatever.sh" to actually execute it. You may have to edit the "mkvmerge" in the script to include the full absolute path of the mkvmerge executable or copy it to a known path like (I think) "/usr/local/bin". https://forum.videohelp.com/threads/377326-mkvtoolnix-8-9-0-mkvmerge-from-command-line
    Quote Quote  
  8. Thank you so much! You are my hero of the day!

    After a long long time I'm now abled to get this problem solved for me.

    Thank you!!!
    Quote Quote  
  9. Originally Posted by sneaker View Post
    Do you want to disable or remove the tracks?

    For removing you need to write a script using mkvmerge:
    Code:
    #!/bin/bash
    
    mkdir "output"
    
    for filename in ./*.mkv
    do
         mkvmerge -o "./output/$filename" --audio-tracks 1 "./$filename"
    done
    "1" is a trackID in this case. Mkvmerge counts all tracks and starts with 0 so "1" is the second track of the file. You can also use language codes like "eng", e.g. if you only want to keep English audio.
    Thanks this was very helpful. How can I edit this to also merge a subtitle file with the same name? I tried

    Code:
    mkvmerge -o "./output/$filename" --audio-tracks 1 --language 0:eng "./$filename.srt" "./$filename"
    but I got the response "filename.srt': A track with the ID 1 was requested but not found in the file."
    Quote Quote  
  10. The order of the commands is important. They belong before the corresponding input file. You tried to use "--audio-tracks 1" on the subtitle file.
    This will keep only the audio track with TrackID 1 of the mkv and set the language of the srt to english:
    mkvmerge -o "./output/$filename" --audio-tracks 1 "./$filename" --language 0:eng "./$filename.srt"
    (for "file.mkv.srt")

    mkvmerge -o "./output/$filename" --audio-tracks 1 "./$filename" --language 0:eng "./${filename%.*}.srt"
    (for "file.srt")

    https://mkvtoolnix.download/doc/mkvmerge.html
    Quote Quote  
  11. Originally Posted by sneaker View Post
    The order of the commands is important. They belong before the corresponding input file. You tried to use "--audio-tracks 1" on the subtitle file.
    This will keep only the audio track with TrackID 1 of the mkv and set the language of the srt to english:
    mkvmerge -o "./output/$filename" --audio-tracks 1 "./$filename" --language 0:eng "./$filename.srt"
    (for "file.mkv.srt")

    mkvmerge -o "./output/$filename" --audio-tracks 1 "./$filename" --language 0:eng "./${filename%.*}.srt"
    (for "file.srt")

    https://mkvtoolnix.download/doc/mkvmerge.html
    Thanks for clarifying! Is this an applescript? I want to learn all the syntax
    Quote Quote  
  12. Originally Posted by sneaker View Post
    The order of the commands is important. They belong before the corresponding input file. You tried to use "--audio-tracks 1" on the subtitle file.
    This will keep only the audio track with TrackID 1 of the mkv and set the language of the srt to english:
    mkvmerge -o "./output/$filename" --audio-tracks 1 "./$filename" --language 0:eng "./$filename.srt"
    (for "file.mkv.srt")

    mkvmerge -o "./output/$filename" --audio-tracks 1 "./$filename" --language 0:eng "./${filename%.*}.srt"
    (for "file.srt")

    https://mkvtoolnix.download/doc/mkvmerge.html
    What is the proper format for chaining multiple commands within the same filename? For example to select video, english audio, english subtitles. Thanks!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!