Next Previous Contents

4. Subtitling

4.1 Converting SRT to PPML

If you followed any one of the procedures in the previous section, you should have in your possession a timed script of your subtitles in the SRT format. To convert the SRT script to a PPML script for use in transcode, use this perl program here. Note that this program was a weekend hack (and I didn't even spend the whole weekend on it), so don't expect too much out of it.

The program reads in an SRT script from standard input and outputs the converted PPML script on standard output. It takes a single command line argument -framerate for the frame rate of the video you are subtitling. The default value of the frame rate is 29.97, the NTSC video standard. If you are subtitling film source that has undergone 3:2 pulldown, you will need to use a frame rate of 23.976 instead (see Which frame rate should I use?).

In summary, for normal NTSC TV source material, use:

srt-to-ppml.pl -framerate=29.97 < script.srt > script.ppml

For 3:2 pulldown converted film source material, use:

srt-to-ppml.pl -framerate=23.976 < script.srt > script.ppml

The resulting PPML script needs an additional header containing the configuration parameters for the subtitles. This header needs to be appended to the beginning of the script. I typically use the following header:

*subtitle subtitle
1 *subtitle font_dir=/usr/share/mplayer/iso-8859-1/arial-28
2 *subtitle color=290 sat=70 contr=100 outline=5 vfactor=.114 hfactor=.09

which configures the subtitling engine to use yellow 28 point arial subtitles with 11.4% vertical clearance and 9% horizontal clearance from the screen edges.

4.2 Ripping the DVD

You should use tccat, which is part of the transcode package. Use it like this:

tccat -i /dev/dvd -T A,B-C,D > video.vob
where

Don't worry about selecting the audio track; the tccat program rips all of the audio tracks for you at once.

4.3 Encoding the subtitles

For this task we will use transcode together with our newly made PPML script file. Note that this step only encodes video, not audio. See the next section for directions regarding the audio.

The basic formula is something like:

transcode -J                             \
     ivtc,32detect=force_mode=3,decimate,\
    subtitler="subtitle_file=script.ppml \
    color_depth=32"                      \
    -i video.vob                         \
    -M 0                                 \
    -o output                            \
    --a52_drc_off                        \
    --no_split                           \
    -V                                   \
    -x vob                               \
    -y mpeg2enc,null                     \
    --pulldown                           \
    -F 1,                                \
    "-I1                                 \
    -b6000                               \
    -q4                                  \
    -s                                   \
    -4 2 -2 1"                           \
    -f8                                  \
    -a2

This long command can be a bit intimidating, so we break it down line by line:

ivtc,32detect=force_mode=3,decimate,

This line activates the inverse pulldown filter in transcode. Inverse pulldown is usually needed if you are subtitling anime and if you are using an input frame rate of 29.97. Omit this line if you are not using inverse pulldown.

See also:

subtitler="subtitle_file=script.ppml

Replace script.ppml with the actual filename of the PPML script containing your timed subtitles.

color_depth=32"

Leave this alone.

-i video.vob

Replace video.vob with the actual filename of the VOB file that you ripped in the previous step.

-M 0

This flag controls NTSC audio/video synchronization. Change this to -M 2 if you are not using inverse pulldown.

-o output

Replace output with the desired filename for the encoded output video.

--a52_drc_off
--no_split
-V
-x vob

Leave these settings alone.

-y mpeg2enc,null

These two parameters control the video and audio codecs used for output. In this example we have the mpeg2 video codec combined with the null audio codec, because we will be handling the audio separately.

--pulldown

This flag should be set if you are using 23.976 framerate film source material, or if you are using inverse pulldown. Omit this line otherwise.

-F 1,

This line indicates the output framerate of the video. Use -F 1 when you are encoding film source material having input framerate of 23.976, or when you are using inverse pulldown. Change this to -F 4 if you are encoding NTSC TV source material and not using inverse pulldown.

"-I1

This flag indicates whether or not the source material is interlaced. For interlaced input material, you should use -I1. Note that -I1 will also work correctly even on uninterlaced input, at the cost of unnecessarily increasing encoding time. Thus -I1 is the safest choice.

If you are using inverse pulldown and you are absolutely sure your inverse pulldown is perfect, then you might use -I0 to save time.

-b6000

This number controls the bitrate of the output video. In this example a bitrate of 6000 kbps is used. Higher numbers give higher quality but increase the size of the output file.

-q4
-s
-4 2 -2 1

Leave these alone.

-f8

This flag sets the output format of the video. DVD uses the -f8 flag; SVCD uses -f4, and VCD uses -f1 (but the use of the latter two is not covered in this guide).

-a2

This setting controls the aspect ratio of the output. Standard TV programs use -a2. Change this to -a3 if your input material is (anamorphic) widescreen.

4.4 Extracting the audio

When fansubbing from DVD to DVD, the best way to handle the audio is to extract the original compressed audio from the original DVD. That way, no reencoding is needed and features like surround sound will be unaffected by the transfer.

Typically, extraction of audio is done with tcextract, part of the transcode package. For example,

tcextract -i video.vob -a 0 -x ac3 -t vob > audio.ac3
will extract AC3 audio track #0 from the VOB file video.vob into the file audio.ac3. If you want a different audio track, change the -a option. If your DVD uses MPEG audio or PCM instead of AC3 audio, use -x mp3 or -x pcm instead. You get the idea.


Next Previous Contents