VideoHelp Forum
+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. Member
    Join Date
    Nov 2012
    Location
    Lombardy. Italy
    Search Comp PM
    Hello everyone.

    As the title said, I'm looking for some way to automatically embed .SRT subs in their respective Video files.
    The subtitles files are already in my possession, and I've named them properly (same name of video files).

    What I used to do is to insert them one by one using Subler, it works, but sometimes happens that I have many files and it's really annoying.

    Is there any OSX software which can help me out?

    Thank in advance for your advice!
    Quote Quote  
  2. Member
    Join Date
    Feb 2010
    Location
    europe
    Search Comp PM
    SublerCLI can do this with some shell scripting
    download SublerCLI from the same place as Subler
    put it in /usr/local/bin

    the attached file "subadder.command" is a shell script that will take a folder of mp4 and srt movies and combine them (if they have the same name)
    open the .command file in a text editor to see what it is doing...
    and if it won't run for you do this....
    open a terminal window
    type chmod +x
    then a space
    then drag the .command file in and now it will run for you.
    TEST ON A NON IMPORTANT FILE FIRST and then if you're happy..go for it on the rest!
    cheers
    jamie
    Image Attached Files
    Quote Quote  
  3. Member
    Join Date
    Nov 2012
    Location
    Lombardy. Italy
    Search Comp PM
    Fascinating!

    It works! I wasn't aware about this alternative version of subler which can runs commands.
    Did you make this command? It's very impressive.

    The only thing I've noticed is that the subtitles "meta" which are embedded have an unspecified language; also every files end to have as meta name: MY_SUBS.

    Although this, it was REALLY HELPFUL!

    Many thanks!
    Quote Quote  
  4. Member
    Join Date
    Feb 2010
    Location
    europe
    Search Comp PM
    yep i wrote the command.
    if you open the .command with textedit (set to plain text) and edit the line that starts with
    SublerCLI

    there are settings in there that were just guesses on my part so the -metadata "Name:MY_SUBS" can be changed there (or just deleted)
    and also the -language i guessed as eng for english (for me) but i'm unsure of what quicktime/ps3 etc is expecting in that bit!
    when you've done just save the file (and make sure it doesn't get .txt at the end)
    just play around and post back here so i learn something!
    cheers
    jamie
    Quote Quote  
  5. Member
    Join Date
    Nov 2012
    Location
    Lombardy. Italy
    Search Comp PM
    just play around and post back here so i learn something!
    Well, I think you can only teach me

    Anyway... after experimenting for a while I came up with this:

    Code:
    #! /bin/sh
    echo drag folder with video and srt files in
    echo for each language the subs MUST have the following pre-extensions: !!
    echo ENGLISH: .en example mysubs.en.srt
    echo ITALIAN: .it example mysubs.it.srt
    read thefolder
    cd "$thefolder"
    for i in *.m4v and for i in *.mp4
    do
    subname=`basename "$i"|rev|cut -c 5-|rev`
    SublerCLI -source "$subname.en".srt -language English -dest "$i" |
    subname=`basename "$i"|rev|cut -c 5-|rev`
    SublerCLI -source "$subname.it".srt -language Italian -dest "$i" 
    done
    clear
    echo all done. Your subs are in the video files
    Since my files are .m4v and I use to embed both Italian and English subtitles I've edited a couple of things...
    I personally tried it and it works, but again... if everyone wants to give it a try please test first on non-important files.

    Also, can you please explain me this part of the code?

    Code:
    subname=`basename "$i"|rev|cut -c 5-|rev`
    Thank you very much! I really appreciate!
    Quote Quote  
  6. Member
    Join Date
    Feb 2010
    Location
    europe
    Search Comp PM
    subname=`basename "$i"|rev|cut -c 5-|rev`

    is a way of getting the name of the movie but without the ".suffix" at the end
    ie
    thingy.avi
    becomes
    thingy

    it basically does this
    subname is the name of our "variable" whaere we want to store the information we want
    then the ` means "the result of everything inside the ` signs
    basename "$i" this gets the name of the file from the full path ie /users/me/folder1/myfilm.avi gives just myfilm.avi
    then the | means do the next thing as well
    rev reverses the string so myfilm.avi is iva.mlifym
    cut -c 5- means cut from the 5th character so that gives mlifym
    rev reverses it again to myfilm

    there is a much shorter way of doing it involving {...} type things but i can never remember it whereas the step by step approach has stuck in my head!

    you shouldn't need the second subname=`basename "$i"|rev|cut -c 5-|rev`
    line because once it is "set" it doesn't become "unset" until YOU reset it or the program quits.

    great hacking on the code I'll have that back thankyou very much!
    all the best
    jamie
    Quote Quote  
  7. Member
    Join Date
    May 2014
    Location
    Seattle, WA
    Search PM
    hey guys, I found this thread very useful. I was wondering what I would need to adjust in the code to get this to work with h264 mov files.

    I'm not much a programmer, but I was able to get the code to work with a folder of 50 mp4 files. I tried it on a batch of mov files and it didn't work. I thought changing everything in the code that said "mp4" to "mov" would do it, but there must be something else going on that I don't see.

    any help would be appreciated.

    Thanks!
    Quote Quote  
  8. VH Wanderer Ai Haibara's Avatar
    Join Date
    Jan 2006
    Location
    Somewhere on VideoHelp...
    Search Comp PM
    Does the MOV container actually allow for embedded subtitle streams?

    If so, the subtitles may need to be converted to a different format, and/or muxed into the video in a different way. (Naturally, I haven't done much work with MOVs at all, so... yeah. )
    If cameras add ten pounds, why would people want to eat them?
    Quote Quote  
  9. Member
    Join Date
    May 2014
    Location
    Seattle, WA
    Search PM
    yeah they do allow the SRT files to be embedded. I can add them 1 at a time and it works. Just wasn't able to get the script to work for batches.
    Quote Quote  
  10. Member
    Join Date
    Nov 2012
    Location
    Lombardy. Italy
    Search Comp PM
    Originally Posted by brobeans View Post
    yeah they do allow the SRT files to be embedded. I can add them 1 at a time and it works. Just wasn't able to get the script to work for batches.
    Hi pal. I'm not sure but I think it's just a matter of substitute the extension inside the script:

    Code:
    for i in *.m4v and for i in *.mp4
    Will become

    Code:
    for i in *.m4v and for i in *.MOV
    or

    Code:
    for i in *.MOV and for i in *.mp4
    Be sure to test it out before batch your important files. Let me know!
    Quote Quote  
  11. Member
    Join Date
    Dec 2014
    Location
    Chicago
    Search Comp PM
    I had to register and THANK each of you in this thread. I had hundreds of TV shows needing subtitles embedded and I KNEW there had to be a better way than one-at-a-time in Subler. I'm so glad I found this thread AND this forum. Thanks, again and Happy New Year!
    Quote Quote  
  12. Member
    Join Date
    Nov 2012
    Location
    Lombardy. Italy
    Search Comp PM
    Originally Posted by SMB-IL View Post
    I had to register and THANK each of you in this thread. I had hundreds of TV shows needing subtitles embedded and I KNEW there had to be a better way than one-at-a-time in Subler. I'm so glad I found this thread AND this forum. Thanks, again and Happy New Year!
    Happy new year to you buddy. I'm glad you've found this thread useful. If this could help you further, I figured out that now this is also possible through the GUI.

    Be sure to have both MP4s and SRTs files in the same directory and with the same name; you can even append the initial of the subtitle language: e.g. .it; .en; .sp and so.
    Then simply open the Subler queue, drag the MP4s you wish to add the subtitles to, tweak your scraper preferences and start.

    Now you should have all your queued files with embedded subs.
    Quote Quote  
  13. Hello i need to embed srt files into 1000 videos. I have all the videos and individual srt files

    Can any one suggest me a batch program that does this in window operating system.

    This thread talked about MAC operating. I am looking for windows 7. operating system

    Regards
    Kamalakar
    Quote Quote  



Similar Threads

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