VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. as an example: I have 2 MKV videos with
    3 audio streams (English, French and Mandarin)
    2 subtitle streams (English and Mandarin)

    The streams can appear in any order. like on the first video, Mandarin is the first audio stream but on the 2nd it's using French. Same situation with subtitle.

    what I want to auto-select the Mandarin audio and English subtitle without having to specify the stream number (like using -map perhaps?).

    Is this possible? If yes, how?

    Thanks!
    Quote Quote  
  2. You'll have to rely on that the proper language code is set and it is not merely using "Undetermined".

    But you could use MKVBatch to mux a filteret file to use with ffmpeg.

    Or a batch job using ffprobe/mediainfo to find the stream numbers and set the ffmpeg command accordingly. (if you would call that auto select)
    Quote Quote  
  3. You can use:
    Code:
    -map 0:s:language:ISO?
    where ISO is language code you wish to keep so for example
    Code:
    -map 0:s:language:eng?
    will map subtitle English if they exist, for audio
    Code:
    -map 0:a:language:ISO?
    same principle. This will work in most of cases OK.
    Quote Quote  
  4. Originally Posted by pandy View Post
    You can use:
    Code:
    -map 0:s:language:ISO?
    where ISO is language code you wish to keep so for example
    Code:
    -map 0:s:language:eng?
    will map subtitle English if they exist
    -snip-
    as a test, I tried your suggestion using an MKV I have in my laptop.
    It's has a single audio stream + many many subtitle streams. As an example, there are eng, ger, ita and many more subtitle streams. I got the subtitle language/language code by parsing the MKV file via ffprobe. Also according to ffprobe, eng is the default subtitle stream.

    as a test, I tried this command:

    Code:
    -i INPUT.mkv -map 0:0 -map 0:1 -map 0:s:language:ita? -vcodec copy -acodec copy -scodec mov_text OUTPUT.mp4
    When I viewed the new MP4 file using VLC, the subtitle menu shows English. And when I selected it, VLC is showing English subtitles.

    As another test, I tried:

    Code:
    -i INPUT.mkv -map 0:0 -map 0:1 -map 0:s:language:ita -vcodec copy -acodec copy -scodec mov_text OUTPUT.mp4
    same results.

    Any ideas what I could be doing wrong? Thanks!
    Quote Quote  
  5. Not used this for very long time and i can't verify this (have no source with many language sub currently) but i use slightly different way of writing ffmpeg script - perhaps this will help?
    Code:
    -i INPUT.mkv -c:v copy -c:a copy -map 0:s:language:ita? -c:s mov_text OUTPUT.mp4
    Will try to test this during weekend.
    Quote Quote  
  6. Originally Posted by pandy View Post
    Not used this for very long time and i can't verify this (have no source with many language sub currently) but i use slightly different way of writing ffmpeg script - perhaps this will help?
    Code:
    -i INPUT.mkv -c:v copy -c:a copy -map 0:s:language:ita? -c:s mov_text OUTPUT.mp4
    Will try to test this during weekend.
    Without mapping the video and audio streams, the output video won't play on VLC.
    Quote Quote  



Similar Threads

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