VideoHelp Forum
+ Reply to Thread
Results 1 to 17 of 17
Thread
  1. Hi.

    I'm currently using this script to convert the audio of my mkv video files. What would I need to change so that only the subtitles flagged as english remain after the conversion?

    Code:
    for %%a in (*.mkv) do ffmpeg -y -i "%%a" -map 0 -c:v copy -c:a ac3 -b:a 640k -c:s copy "output_%%~na.mkv"
    Thank you.
    Quote Quote  
  2. I think this:

    Code:
    for %%a in (*.mkv) do ffmpeg -y -i "%%a" -map 0:v -map 0:a -map 0:m:language:eng -c:v copy -c:a ac3 -b:a 640k -c:s copy "output_%%~na.mkv"
    but i don't have a a suitable source file handy. I expect it will only work if the subs are marked as english.
    Quote Quote  
  3. It worked for the subs, but for some reason it duplicated both the video track and the audio track. So the new file is twice the size of the original.
    Quote Quote  
  4. try edit this: '-map 0:m:language:eng' --> change the 'm' by 's'
    Last edited by sekininsha; 7th Aug 2020 at 22:17.
    責任者-MDX
    Quote Quote  
  5. It says '0: s:language:eng' matches no stream.
    Quote Quote  
  6. are you sure the source subtitle stream is flagged as 'eng'?
    What does ffmpeg report when you call
    Code:
    ffmpeg -i "path to input"
    (no further parameters)?

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  7. Both the audio and 2 subtitles tracks are flagged as 'English", I tried '0: s:language:english', it still says no match. It's odd because it works with "0:m:language:eng", only the english subtitles remained, but the audio and video duplicated.

    The report says, path to input: No such file or directory.
    Quote Quote  
  8. without the whole output of ffmpeg this is wild guessing,...
    you can also set a higher log level when using ffmpeg to see in more details what it is doing,...
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  9. I don't know how to do that.
    Quote Quote  
  10. instead of calling ffmpeg (with proper paths not variables) through a batch file call it in a Windows Command Prompt, copy the output (right click, mark all, copy it by right click, and paste it here)
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  11. First maybe I can try to select the subtitle track number instead of the language? What would it be in the script if the only track I need is number 4?
    Quote Quote  
  12. I found a suitable MKV sample and tried the batch file I gave in post #2. The output video only had one copy of the video, one copy of the audio. The source had two English subtitles (vobsub, srt) -- both were copied to the output. Chapters too.
    Quote Quote  
  13. @jagabo: Strange, but I figured it out! I removed the extra "-map 0:v" and "-map 0:a" and it worked perfectly, no duplicates!

    So the script is:

    Code:
    for %%a in (*.mkv) do ffmpeg -y -i "%%a" -map 0:m:language:eng -c:v copy -c:a ac3 -b:a 640k -c:s copy "output_%%~na.mkv"
    Thank you.
    Quote Quote  
  14. Weird. When I run your batch file I get an output file with no video or audio. Only English subs and chapters.

    I have ffmpeg version 4.2.2, about six months old.
    Quote Quote  
  15. My version seems to be 4.1.4, so maybe that's why.
    Quote Quote  
  16. Hmm, your code looks good
    Quote Quote  
  17. Member
    Join Date
    Jul 2023
    Location
    Kansas
    Search Comp PM
    Hi! you can modify the script like this:
    Code: for %%a in (*.mkv) do ffmpeg -y -i ""%%a"" -map 0 -c:v copy -c:a ac3 -b:a 640k -map 0:0 -map 0:1 -c copy -metadata:0 language=eng -metadata:1 language=eng ""output_%%~na.mkv""
    By specifying ""-map 0:0"" and ""-map 0:1"", you're selecting the first and second subtitle streams, respectively. I also id that to watch my series with subtitles, as I'm currently learning English and preparing for IELTS. I also use https://practicalielts.com/ielts/ultimate-ielts-guide/ to prepare better. Series is just another fun way to learn a new language.
    Last edited by Samangel; 14th Jul 2023 at 04:56.
    Quote Quote  



Similar Threads

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