+ Reply to Thread
Results 1 to 6 of 6
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
    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  



Similar Threads

Search   Contact us   About   Advertise   Forum   RSS Feeds   Statistics   Tools