| 1 |
<chapter id="examples"><title>Examples</title> |
| 2 |
|
| 3 |
<sect1 id="ex-tools"><title>Running the tools</title> |
| 4 |
|
| 5 |
<sect2><title>Creating the DVD filesystem with dvdauthor</title> |
| 6 |
|
| 7 |
<para>In these examples, <command>dvdauthor</command> is run as:</para> |
| 8 |
<programlisting>rm -r test && dvdauthor -o test -x dvdauthor.xml</programlisting> |
| 9 |
|
| 10 |
<para>It will create or append to the directory specified, so it is a |
| 11 |
good idea to remove the directory before running |
| 12 |
<command>dvdauthor</command>, otherwise the resulting structure will |
| 13 |
not be playable.</para> |
| 14 |
|
| 15 |
</sect2> |
| 16 |
|
| 17 |
<sect2><title>Adding subtitles with spumux</title> |
| 18 |
|
| 19 |
<para><command>spumux</command> takes an mpeg2 program stream as input and spits one back out, with subtitles multiplexed in. It is run as:</para> |
| 20 |
<programlisting>spumux spumux.xml < input.mpg > output.mpg</programlisting> |
| 21 |
|
| 22 |
</sect2> |
| 23 |
|
| 24 |
<sect2><title>Creating a movie source from video and audio with mplex</title> |
| 25 |
|
| 26 |
<para><command>mplex</command> comes from the mjpegtools package, |
| 27 |
available at http://mjpeg.sourceforge.net. It can take independent |
| 28 |
video and audio streams and create a single mpeg2 stream.</para> |
| 29 |
<programlisting>mplex -f 8 -o output.mpg video.m2v audio.m2a</programlisting> |
| 30 |
|
| 31 |
</sect2> |
| 32 |
|
| 33 |
<sect2><title>Creating video from bitmap images with mpeg2enc</title> |
| 34 |
|
| 35 |
<para>When creating menus, it is necessary to create an mpeg2 video stream from one or more bitmap images. For NTSC you can do:</para> |
| 36 |
<programlisting>ppmtoy4m | mpeg2enc -a 2 -n n -f 8 -o output.m2v</programlisting> |
| 37 |
<para>and for PAL you can do:</para> |
| 38 |
<programlisting>ppmtoy4m | mpeg2enc -a 2 -n p -f 8 -o output.m2v</programlisting> |
| 39 |
|
| 40 |
</sect2> |
| 41 |
|
| 42 |
<sect2><title>Creating a blank audio track with toolame</title> |
| 43 |
|
| 44 |
<para>When creating menus with no sound, it is necessary to multiplex |
| 45 |
in an empty sound file. At 48kHz, NTSC has 1601.6 audio samples per |
| 46 |
frame while PAL has 1920 audio samples per frame. Determine how many |
| 47 |
samples you need, and run:</para> |
| 48 |
<programlisting>dd if=/dev/zero bs=4 count=<replaceable>number-of-samples</replaceable> | toolame -b 128 -s 48 /dev/stdin output.m2a</programlisting> |
| 49 |
|
| 50 |
</sect2> |
| 51 |
|
| 52 |
</sect1> |
| 53 |
|
| 54 |
<sect1 id="ex-title"><title>Creating a title</title> |
| 55 |
|
| 56 |
<sect2><title>One chapter, one source</title> |
| 57 |
<para>This forms the most basic DVD. THe DVD player will start playing the movie when the disc is inserted and will stop at the end.</para> |
| 58 |
<programlisting><![CDATA[ |
| 59 |
<dvdauthor> |
| 60 |
<vmgm /> |
| 61 |
<titleset> |
| 62 |
<titles> |
| 63 |
<pgc> |
| 64 |
<vob file="video.mpg" /> |
| 65 |
</pgc> |
| 66 |
</titles> |
| 67 |
</titleset> |
| 68 |
</dvdauthor> |
| 69 |
]]></programlisting> |
| 70 |
</sect2> |
| 71 |
|
| 72 |
|
| 73 |
<sect2><title>Two chapters, two sources</title> |
| 74 |
<para>Adding a second chapter is quite simple if it is in a separate file.</para> |
| 75 |
<programlisting><![CDATA[ |
| 76 |
<dvdauthor> |
| 77 |
<vmgm /> |
| 78 |
<titleset> |
| 79 |
<titles> |
| 80 |
<pgc> |
| 81 |
<vob file="video1.mpg" /> |
| 82 |
<vob file="video2.mpg" /> |
| 83 |
</pgc> |
| 84 |
</titles> |
| 85 |
</titleset> |
| 86 |
</dvdauthor> |
| 87 |
]]></programlisting> |
| 88 |
</sect2> |
| 89 |
|
| 90 |
|
| 91 |
<sect2><title>One chapter, two sources</title> |
| 92 |
<para><application>DVDAuthor</application> normally creates one |
| 93 |
chapter per file. This can be overridden using |
| 94 |
<literal>chapters="<replaceable>foo</replaceable>"</literal>. The |
| 95 |
parameter is a comma separated list of timestamps of the form |
| 96 |
<literal>[[<replaceable>HH</replaceable>:]<replaceable>MM</replaceable>:]<replaceable>SS</replaceable></literal>.</para> |
| 97 |
<programlisting><![CDATA[ |
| 98 |
<dvdauthor> |
| 99 |
<vmgm /> |
| 100 |
<titleset> |
| 101 |
<titles> |
| 102 |
<pgc> |
| 103 |
<vob file="video1.mpg" chapters="0" /> |
| 104 |
<vob file="video2.mpg" /> |
| 105 |
</pgc> |
| 106 |
</titles> |
| 107 |
</titleset> |
| 108 |
</dvdauthor> |
| 109 |
]]></programlisting> |
| 110 |
</sect2> |
| 111 |
|
| 112 |
|
| 113 |
<sect2><title>Two chapters, one source</title> |
| 114 |
<para>This will create a movie with two chapters, one at the beginning (which is always required) and one five minutes into the video.</para> |
| 115 |
<programlisting><![CDATA[ |
| 116 |
<dvdauthor> |
| 117 |
<vmgm /> |
| 118 |
<titleset> |
| 119 |
<titles> |
| 120 |
<pgc> |
| 121 |
<vob file="video1.mpg" chapters="0,5:00" /> |
| 122 |
</pgc> |
| 123 |
</titles> |
| 124 |
</titleset> |
| 125 |
</dvdauthor> |
| 126 |
]]></programlisting> |
| 127 |
</sect2> |
| 128 |
|
| 129 |
|
| 130 |
<sect2><title>Looping</title> |
| 131 |
<para>Having <literal><post></literal>commands will alter what happens when playback reaches the end of your title. You can repeat the current title by jumping to the first chapter.</para> |
| 132 |
<programlisting><![CDATA[ |
| 133 |
<dvdauthor> |
| 134 |
<vmgm /> |
| 135 |
<titleset> |
| 136 |
<titles> |
| 137 |
<pgc> |
| 138 |
<vob file="video1.mpg" /> |
| 139 |
<post> |
| 140 |
jump chapter 1; |
| 141 |
</post> |
| 142 |
</pgc> |
| 143 |
</titles> |
| 144 |
</titleset> |
| 145 |
</dvdauthor> |
| 146 |
]]></programlisting> |
| 147 |
</sect2> |
| 148 |
|
| 149 |
|
| 150 |
<sect2><title>Pausing</title> |
| 151 |
<para>Having <literal>pause="<replaceable>foo</replaceable>"</literal> |
| 152 |
will cause playback to pause for either the specified number of |
| 153 |
seconds or indefinitely (<literal>inf</literal>). This can be used |
| 154 |
either at the end of the title (by supplying it as an attribute to |
| 155 |
<literal>pgc</literal> or at the end of a particular source, as an |
| 156 |
attribute to <literal>vob</literal>. The following will pause |
| 157 |
indefinitely at the end of the title:</para> |
| 158 |
<programlisting><![CDATA[ |
| 159 |
<dvdauthor> |
| 160 |
<vmgm /> |
| 161 |
<titleset> |
| 162 |
<titles> |
| 163 |
<pgc pause="inf"> |
| 164 |
<vob file="video1.mpg" /> |
| 165 |
</pgc> |
| 166 |
</titles> |
| 167 |
</titleset> |
| 168 |
</dvdauthor> |
| 169 |
]]></programlisting> |
| 170 |
|
| 171 |
<para>while the following will pause for 5 seconds after the first chapter:</para> |
| 172 |
<programlisting><![CDATA[ |
| 173 |
<dvdauthor> |
| 174 |
<vmgm /> |
| 175 |
<titleset> |
| 176 |
<titles> |
| 177 |
<pgc> |
| 178 |
<vob file="video1.mpg" pause="5" /> |
| 179 |
<vob file="video2.mpg" /> |
| 180 |
</pgc> |
| 181 |
</titles> |
| 182 |
</titleset> |
| 183 |
</dvdauthor> |
| 184 |
]]></programlisting> |
| 185 |
</sect2> |
| 186 |
|
| 187 |
</sect1> |
| 188 |
|
| 189 |
</chapter> |