Back to top

How to add subtitles to a DVD, using dvdauthor

Warning: this assumes you have a DVD compliant MPEG video file, let's name it video.mpg. Let us also assume you have two subtitles named pt.sub and en.sub.

We'll use the spumux tool and create a XML file named pt.xml:

<subpictures>
  <stream>
    <textsub filename="pt.sub" characterset="ISO8859-1"
         fontsize="18.0" font="Vera.ttf"
horizontal-alignment="center"
         vertical-alignment="bottom" left-margin="60"
right-margin="60"
         top-margin="20" bottom-margin="30" subtitle-fps="25"
         movie-fps="25" movie-width="720" movie-height="574"/>
  </stream>
</subpictures>

Of course you'll have to change the charset, fps and remaining details accordingly, but this works for most movies. The font Vera.ttf must exist in the directory ~/.spumux. No let's run spumux and include the first subtitles:

spumux -s0 pt.xml < video.mpg > video+pt.mpg

This will create a new video file with the embedded portuguese subtitles. Now let's do the same for english ones. Let's create the en.xml file with the following contents:

<subpictures>
  <stream>
    <textsub filename="en.sub" characterset="ISO8859-1"
         fontsize="18.0" font="Vera.ttf"
horizontal-alignment="center"
         vertical-alignment="bottom" left-margin="60"
right-margin="60"
         top-margin="20" bottom-margin="30" subtitle-fps="25"
         movie-fps="25" movie-width="720" movie-height="574"/>
  </stream>
</subpictures>

Now we'll run spumux again but we'll put it on another stream (number 1):

spumux -s1 en.xml < video+pt.mpg > video+pt+en.mpg

This last filename, video+pt+en.mpg, contains both subtitles but we still need dvdauthor to indentify them and associate a country for it, so let's create a very rudimentary XML file named auth.xml:

<dvdauthor>
    <vmgm />
    <titleset>
        <titles>
            <subpicture lang="pt"/>
            <subpicture lang="en" />
            <pgc>
                <vob file="video+pt+en.mpg" />
            </pgc>
        </titles>
    </titleset>
</dvdauthor>

It is very important the order of the subpicture tags since it associates stream 0 with the pt language code and stream 1 with en language code.

Now generate the DVD structure with:

dvdauth -o mydvd -x auth.xml

To test the generated DVD we use gmplayer:

gmplayer dvd:// -dvd-device mydvd

To select a subtitle right click the window and navigate to DVD → Subtitles → Portuguese.


Back to top