DVD Authoring with Linux

Ian Pointer

ian@snappishproductions.com

What You Need

Audio & Video Formats

DVD MPEG-2 streams can have up to 8 different audio streams, 32 different sub-picture tracks (for subtitles or buttons-over-video, currently not supported by dvdauthor), and up to nine video streams, or 'angles' (currently, dvdauthor does not support angles).

Total bitrate of a DVD MPEG-2 stream must not exceed 9.8Mbps for maximum compatibility.

    Audio:
  • PCM: 48/86kHz, at 16, 20, or 24 bits per sample. Up to eight channels.
  • MPEG2: 48kHz, 16/20 bits per sample. Bitrate from 32 to 912kbps. 5.1 channels, plus 7.1 mode (extra left and right channels). Not often used in commercial DVDs, as not required for NTSC DVD specification.
  • Dolby Digital (AC-3): 48kHz, 24 bits/sample. Bitrate from 64 to 448kbps. 5.1 channels. Most common commercial offering.
  • DTS: 48kHz, 24 bits/sample. Bitrate from 64 to 1536kbps. Requires DTS decoder (not part of DVD spec).
  • Most commercial DVDs these days include a DTS soundtrack plus a DD/AC-3 track in case the player doesn't have a DTS decoder.

    Preparing Audio & Video

    Why? DVD MPEG-2 streams need some extra navigational information

    mplex - multiplexes audio and video into MPEG streams

    e.g.

    mplex -f 8 -o film_nosubs.mpg film.m2v english.ac3 
    french.ac3 german.ac3 

    In this case:

    mplex -f 8 -o film_nosubs.mpg film.m2v film.ac3

    mplex works with several other different MPEG formats, including VideoCD.

    Use ffmpeg to convert between audio formats (AC3 is the most compatible and efficent format, although it is patent-encumbered).

    Subtitles

    Subtitles in DVDs are implemented via a sub-picture track

    Subtitles: Using spumux

    subs.xml (using TrueType fonts):

    <subpictures> 
      <stream> 
       <textsub filename= "filename"  [ fontsize="size" ] 
    [ font="fontname.ttf" ] 
    [ horizontal-alignment="left | right | center | default" ]
    [ vertical-alignment="top | middle | bottom" ] 
    [ left-margin="" ] [ right-margin="" ] 
    [ top-margin="" ] [ bottom-margin="" ] 
    [ subtitle-fps="frames-per-second" ] 
    [ movie-fps="frames-per-second" ] 
    [ movie-width="" ] [ movie-height="" ] />
      </stream> 
    </subpictures> 
    

    dvdauthor can handle most of the common subtitle formats (*.srt, *.ssa, *.sub, etc).

    Fonts must be in the directory ~/.spumux for spumux to find them.

    Subtitles: Alternative version

    subs.xml (using PNG images):

    <subpictures>
     <stream>
       <spu start="start-time" 
        [ end="end-time" ] 
        [ image="picture.png" ]
        [ transparent="color-code" ]
        [ force="yes" ]
        [ xoffset="x-coord" yoffset="y-coord" ] >
       </spu>
     </stream>
    </subpictures>
    

    Subtitles: 4

    Example:

    <subpictures>
       <stream>
          <spu start="00:00:00.00" end="00:00:15.00"  
          image="sub1.png">         
          </spu>
       </stream>
    </subpictures>
    

    Adding subtitles

    spumux subs.xml < film_nosubs.mpg > film.mpg 

    For multiple streams of subtitles, use the -s x switch to insert a subtitle stream (where x runs between 0 and 31 in a title)

    Structure of A DVD

    DVDs are comprised of units called a Video Title Set (VTS).

    It is possible, of course, to create DVDs without any menus in them at all.

    Structure of A DVD: 2

    This DVD:

    Making Menus

    Current alpha versions of dvdauthor support 16:9 and anamorphic menus

    Making Menus: Static Menus

    Create an image with 3 layers:

    Making Menus: 3

    menu.xml:

    <subpictures>
      <stream> 
        <spu start="00:00:00" end="00:00:00" 
            force="yes" 
            highlight="highlight.png" 
            select="select.png" 
            autooutline="infer" 
            autoorder="rows" /> 
      </stream> 
    </subpictures> 
    

    For more complex DVDs, button placement can be specified individually; see dvdauthor documentation for details.

    Making Menus: 4

    Use jpeg2yuv, mpeg2enc, and mplex to create an MPEG-2 stream from the image:

    jpeg2yuv -n 1 -f 25 -I p -j menu.jpg | 
    mpeg2enc -f 8 -o menu_temp.m2v
    
    mplex -f 8  -o menu_temp.mpg menu.m2v menu.ac3
    

    Then, add the button masks using spumux:

    spumux menu.xml < menu_temp.mpg > menu.mpg 

    Menus must have an audio track. It can be silence, but it needs to be there.

    jpegyuv options: -I (interlace - here using progressive) -f (frame rate) -n 1 (only process one frame - will create a 25-frame sequence (using the -f value)).

    DVDAuthor

    
    <dvdauthor>
      <vmgm> 
        <menus> 
          <pgc> 
            <vob file="menu.mpg" pause="inf"/> 
             <button>subtitle=0;jump title 1;</button> 
             <button>subtitle=64; jump title 1;</button>                
          </pgc> 
        </menus> 
      </vmgm> 
    

    DVDAuthor: 2

    
    <titleset>
     <titles>
       <pgc>
         <vob file = "film.mpg" 
            chapters="00:00:00, 00:00:15" /> 
         <post>call vmgm menu 1;</post>
     </pgc> 
     </titles>
    </titleset>
    </dvdauthor>
    

    DVDAuthor: 3

    <vmgm> tag

    DVDAuthor: 4

    <menus> tag

    See dvdauthor documentation for further options, such as language codes, aspect ratios, etc.

    DVDAuthor: 5

    <pgc> tag

    When used in menus. the tag can also have an entry attribute, corresponding to certain special types of button on the DVD controller (such as 'title, 'angle', etc.). When the button is pressed, the player jumps to the menu with the appropriate entry.

    DVDAuthor: 6

    <vob> tag

    DVDAuthor: 7

    <button> tag

    The subtitle=64 command shown in the dvd.xml file forces the subtitles to be displayed. If subtitle=0 was used, only titles with a force="yes" attribute will be display. To force all subtitles, add 64 when selecting the required stream (e.g. 0+64).

    DVDAuthor: 8

    <titleset> and <titles> tags

    See dvdauthor documentation for further options, such as language codes, aspect ratios, etc.

    DVDAuthor: 9

    <pre> and <post> tags

    DVDAuthor: 10

    Creating the DVD:

    
    dvdauthor -o [DIRECTORY] -x dvd.xml
    
    

    Testing & Burning

    Testing the DVD:

    xine dvd:/path_to_output_dir/VIDEO_TS/

    Making The ISO Image:

    mkisofs -o image_name -dvd-video path_to_output_dir

    Then burn using dvdrtools, or any other method

    DVD players expect to certain certain files on a DVD in particular places. The -dvd-video option makes sure mkisofs places files in the correct order.

    Advanced Features

    DVD players have registers available:

    End



    email: ian@snappishproductions.com



    Slides: http://snappishproductions.com/media/dvdtalk.html