bernardfrancois
August 30th, 2009, 11:22 AM
FIRST METHOD:
Use the ksubtitleripper package from synaptic.
SECOND METHOD:
If ksubtitleripper doesn't work for you, or you dont want to use it you can follow these steps:
Install the subtitleripper package from synaptic.
Change your working directory to the directory containing the VOB files. These files should not be encrypted.
Copy and paste the script below into a terminal window.
# NOTE: this script assumes there are no more than 9 subtitle tracks
# creates subtitle files for the 9 first languages
for lang in {0..9} ; do
(
# extract the given language and creates a subtitle file
tccat -i *.VOB | tcextract -x ps1 -t vob -a 0x2$lang > subs-$lang ;
# converts the subtitle file to an .srt file (if the file isn't empty)
if [[ -s subs-$lang ]] ; then
(
# convert the subtitle frames to seperate images
echo "LANGUAGE $lang: WILL NOW CREATE SUBTITLE FRAME IMAGES" ;
mkdir pgm-$lang ;
subtitle2pgm -o pgm-$lang/pgm-$lang- < subs-$lang ;
# use gocr to convert the subtitle frames to text
echo "LANGUAGE $lang: WILL START OCR ON SUBTITLE FRAME IMAGES" ;
pgm2txt pgm-$lang/pgm-$lang- ;
#convert the text to a .srt file
echo "LANGUAGE $lang: WILL NOW CONVERT THE TEXT TO AN SRT FILE" ;
srttool -s -w < pgm-$lang/pgm-$lang-.srtx > subs-$lang.srt ;
) ;
else
# removes the empty subtitle file (a languages that wasn't available)
rm subs-$lang ;
fi
) ;
done
Notes:
ksubtitleripper didn't work for me. I reported a bug regarding the issues I had with it:
https://bugs.launchpad.net/ubuntu/+source/ksubtitleripper/+bug/421470
Depending on the actual subtitles you want to copy, you may have to be the copyright holder of the subtitles.
Use this script at your own risk.
Feel free to ask any questions about the script, or to send me a personal message in case it would be broken.
Note that
Use the ksubtitleripper package from synaptic.
SECOND METHOD:
If ksubtitleripper doesn't work for you, or you dont want to use it you can follow these steps:
Install the subtitleripper package from synaptic.
Change your working directory to the directory containing the VOB files. These files should not be encrypted.
Copy and paste the script below into a terminal window.
# NOTE: this script assumes there are no more than 9 subtitle tracks
# creates subtitle files for the 9 first languages
for lang in {0..9} ; do
(
# extract the given language and creates a subtitle file
tccat -i *.VOB | tcextract -x ps1 -t vob -a 0x2$lang > subs-$lang ;
# converts the subtitle file to an .srt file (if the file isn't empty)
if [[ -s subs-$lang ]] ; then
(
# convert the subtitle frames to seperate images
echo "LANGUAGE $lang: WILL NOW CREATE SUBTITLE FRAME IMAGES" ;
mkdir pgm-$lang ;
subtitle2pgm -o pgm-$lang/pgm-$lang- < subs-$lang ;
# use gocr to convert the subtitle frames to text
echo "LANGUAGE $lang: WILL START OCR ON SUBTITLE FRAME IMAGES" ;
pgm2txt pgm-$lang/pgm-$lang- ;
#convert the text to a .srt file
echo "LANGUAGE $lang: WILL NOW CONVERT THE TEXT TO AN SRT FILE" ;
srttool -s -w < pgm-$lang/pgm-$lang-.srtx > subs-$lang.srt ;
) ;
else
# removes the empty subtitle file (a languages that wasn't available)
rm subs-$lang ;
fi
) ;
done
Notes:
ksubtitleripper didn't work for me. I reported a bug regarding the issues I had with it:
https://bugs.launchpad.net/ubuntu/+source/ksubtitleripper/+bug/421470
Depending on the actual subtitles you want to copy, you may have to be the copyright holder of the subtitles.
Use this script at your own risk.
Feel free to ask any questions about the script, or to send me a personal message in case it would be broken.
Note that