VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. Hi, I'm new here in the forums , I came here because I'm having some problems trying to replace subtitles from a video.

    I want to remove the current ones that are in the file and put another subtitle instead using mkvmerge from the terminal. (I want to do it for a bunch of files using a batch script)

    So for remove the current subtitles I’m using this command:

    Code:
    for i in *.mkv; do
      mkvmerge --no-subtitles "$i" -o WithoutSubs/"$i"
    done
    My problem is when I try to add the new subtitles I must duplicate my files again because mkvmerge always ask me for an output file instead of replace the current one.

    There is any way to remove the currents subs and add another one into a single output file?
    Quote Quote  
  2. Code:
    for i in *.mkv; do
      mkvmerge -o "./WithoutSubs/$i" --no-subtitles "./$i" "./${i%.*}.ass"
    done
    Quote Quote  
  3. Originally Posted by sneaker View Post
    Code:
    for i in *.mkv; do
      mkvmerge -o "./WithoutSubs/$i" --no-subtitles "./$i" "./${i%.*}.ass"
    done
    I got an error msg: "Could not open for reading: open file error."

    It's like I was trying to open the subs
    Quote Quote  
  4. Post the complete error message/log. What is the file name of your subtitle file?
    Quote Quote  
  5. Originally Posted by sneaker View Post
    Post the complete error message/log. What is the file name of your subtitle file?
    Code:
    mkvmerge v9.3.1 ('Mask Machine') 64bit
    Error: El archivo '*.ass' no se pudo abrir para su lectura: open file error.
    Sorry my system is in Spanish

    I run it changing the subs for *.ass so there is no problem with the name.
    Quote Quote  
  6. Originally Posted by Akari View Post
    I run it changing chaing the subs for *.ass so there is no problem with the name.
    Mkvmerge doesn't support wildcards. Or do you mean you don't actually use the wildcard? I'm not sure I understand you correctly. If your shell interprets "./${i%.*}.ass" as "*.ass" then that's one more thing that's different on mine.

    Here I'd have:
    Code:
    !#/bin/bash
    
    for i in *.mkv
    do
      mkvmerge -o "./WithoutSubs/$i" --no-subtitles "./$i" "./${i%.*}.ass"
    done
    Maybe if you post your OS/shell someone else has advice on what you need to change.
    Last edited by sneaker; 15th Jan 2017 at 10:18.
    Quote Quote  
  7. Yup, I'm running this:
    Code:
    for i in *.mkv; do
      mkvmerge -o WithoutSubs/"$i" --no-subtitles "$i" "*.ass"
    done
    Because if I leave this as you instructed I got the same error that I got with the .ass subtitles. (the file './' could not open... open file error.)

    I'll try pass the exact subtitle file name now.

    Maybe if you post your OS/shell someone else has advice on what you need to change.
    Oh, I thought u could see it on my profile sorry.

    I'm running on Ubuntu 16.10 x64, bash 4.3.46
    Quote Quote  
  8. And without "./"?

    Code:
    !#/bin/bash
    
    for i in *.mkv
    do
      mkvmerge -o "WithoutSubs/$i" --no-subtitles "$i" "${i%.*}.ass"
    done
    Quote Quote  
  9. Originally Posted by sneaker View Post
    And without "./"?

    Code:
    !#/bin/bash
    
    for i in *.mkv
    do
      mkvmerge -o "WithoutSubs/$i" --no-subtitles "$i" "${i%.*}.ass"
    done
    It works! ty m8
    Quote Quote  
  10. Srry for the double post.

    Do u know how can I pass the language code for the subtitle?

    I just try to add
    Code:
    --language 0:spa
    but it doesn't work
    Quote Quote  
  11. Tried to add where? What does "it doesn't work" mean? Error message?

    The command order is important.
    Code:
    !#/bin/bash
    
    for i in *.mkv
    do
      mkvmerge -o "WithoutSubs/$i" --no-subtitles "$i" --language 0:spa "${i%.*}.ass"
    done
    Quote Quote  
  12. Originally Posted by sneaker View Post
    Tried to add where? What does "it doesn't work" mean? Error message?

    The command order is important.
    Code:
    !#/bin/bash
    
    for i in *.mkv
    do
      mkvmerge -o "WithoutSubs/$i" --no-subtitles "$i" --language 0:spa "${i%.*}.ass"
    done
    I just come here to delete the msg xd
    For error I mean that I got the subs marked as undefined language but it just was a dumb mistake. I put that code after the subs

    Ty again
    Quote Quote  



Similar Threads

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