RSS



In the process of moving the site to a new and faster server, it seems we've broken the forum login. Until we've figured this out, the forums will have to stay read-only. Sorry about that.
Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/lodp14/domains/onebigtorrent.org/public_html/phpBB3/common.php on line 88 OneBigTorrent.org Forums • View topic - ripsubs - Subtitle ripping automation script

ripsubs - Subtitle ripping automation script

Solve problems when viewing files, learn how to rip & encode stuff for sharing

ripsubs - Subtitle ripping automation script

Postby ethical_anarhist on Mon Mar 01, 2010 4:58 pm

A few days ago i've written it, and i thought that some other people may benefit from it. I might prettify it a bit more, i'll try to remember to post the new code here when i do.

Code: Select all
#!/bin/bash

# Name: ripsubs
# Version: 0,1b
# Author: VolodyA! V Anarhist
# Year: 2010
# Licence: GPL 3.0

# the command line should be in the form
# ripsubs -i file.vob [file2.vob file3.vob] -ifo file.ifo -o base -a 20 [21 22 24] -v
# or
# ripsubs -h|--help

#if help
if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
   echo "ripsubs version 0,1b. written by VolodyA! V Anarhist"
   echo "The command line should look like this:"
   echo "ripsubs -i|--input file.vob [file2.vob file3.vob] -ifo|--ifo file.ifo -o|--base base -a|--streams 20 [21 22 24] -v|--verbose"
   echo "For example to rip the streams 0x21 and 0x26 from the third chapter of ripped DVD you would type"
   echo "ripsubs -i VTS3_*.VOB -ifo VTS3_0.IFO -a 21 26"
   exit
fi


#go through all the command line a word at a time
FILES=""
IFOFILE=""
STREAMS=""
BASE=""
VERBOSE=""

STATE=""
for COMMAND in "$@"; do
   if [ ${COMMAND:0:1} = "-" ]; then
      if [ "$COMMAND" = "-i" ] || [ "$COMMAND" = "--input" ]; then
         STATE="--input"
      elif [ "$COMMAND" = "-ifo" ] || [ "$COMMAND" = "--ifo" ]; then
         STATE="--ifo"
      elif [ "$COMMAND" = "-a" ] || [ "$COMMAND" = "--streams" ]; then
         STATE="--streams"
      elif [ "$COMMAND" = "-o" ] || [ "$COMMAND" = "--base" ]; then
         STATE="--base"
      elif [ "$COMMAND" = "-v" ] || [ "$COMMAND" = "--verbose" ]; then
         VERBOSE="-v"
      else
         echo "Wrong command command '$COMMAND'"
         echo "Use ripsubs --help for useage information."
         exit 1
      fi
   elif [ -n "$STATE" ]; then # if the STATE is not zero-length
      if [ "$STATE" = "--input" ]; then
         if [ ! -f $1 ] || [ ! -r $1 ]; then
            echo "File '$1' doesn't exist or is not readable"
            exit 2
         fi
         FILES="$FILES $1"
      elif [ "$STATE" = "--ifo" ]; then
         if [ ! -f $1 ] || [ ! -r $1 ]; then
            echo "File '$1' doesn't exist or is not readable"
            exit 2
         fi
         IFOFILE="$1"
      elif [ "$STATE" = "--streams" ]; then
         STREAMS="$STREAMS $1"
      elif [ "$STATE" = "--base" ]; then
         BASE="$1"
      fi
   else
      echo "Wrong command command '$COMMAND'"
      echo "Use ripsubs --help for useage information."
      exit 1
   fi
   shift
done

#if there is an IFO file that was specified then we need to add that parameter
IFOSTRING=""
if [ -n "$IFOFILE" ]; then
   IFOSTRING="-i $IFOFILE"
fi

for STREAM in $STREAMS; do
   cat $FILES | tcextract -x ps1 -t vob -a 0x$STREAM |subtitle2vobsub $IFOSTRING -o $BASE-$STREAM $VERBOSE
done


You want to put this code in the file called "ripsubs" without quotes and put that file somewhere in your path. Then you should make it executable "chmod +x ripsubs". It relies on subtitle2vobsub (part of subtitleripper) and tcextract (part of transcode).

I did this because i am annoyed that people don't share the subtitles that exist on DVDs because it's difficult to rip many of them. Well, now you can do this with a single command per VOB.
User avatar
ethical_anarhist
 
Posts: 27
Joined: Sun Nov 26, 2006 1:53 pm
Location: UK

Return to Video Codecs, Subtitles, Ripping+Encoding

Who is online

Users browsing this forum: No registered users and 1 guest