Introduction
Here, I describe my experiences
creating DVDs in linux. This
is more for my reference than anything else, but I thought I might help
someone else out getting started. In this article, I describe
creating a DVD from content on a DV camera or an existing mpeg-2 video.
Either way, I also describe creating a menu and image
slideshow.
Required Tools
| Cinelerra |
Non-linear Video Editor |
| Kino |
Capture video from DV
camera |
| mplex
(mjpegtools) |
Video multiplexer,
(re)combines Aud and Vid |
| mjpeg2enc
(mjpegtools) |
Create mpeg-2 video from
anything |
| DVDAuthor |
Key to creating filesystem
and menus |
| jpeg2yuv |
Converts Jpegs to YUV4MPEG2 |
| TooLAME |
Mpeg audio creator |
| dvdslideshow |
Images to slideshow with
effects and music |
| Xine |
Play the movie to test it
out (this is the best IMO) |
| mkisofs/growisofs | Makes ISOs and burns DVDs |
Creating the Video
content
Primarily, content creation and
editing is done in whatever tools are
convenient or appropriate. Most of my content is taken from a
digital video camera and downloaded via firewire using Kino.
This process just captures the video, and stores it in files
for editing in Cinelerra.
The quality of the editing and final videos can only be as good as its
source. In my research, I found the less expensive mini DV
style cameras produced the best quality for the dollar. Of
course, the newer HD cameras are great, but the advantage of the mini
DV is the video is not compressed on the camera. The new hard
drive and direct to DVD cameras pre-compress to mpeg-2 reducing
quality. Any edits re-compress the video and continually
decrease the video quality.
Getting Video from
Camera
Kino is able to talk to firewire
cameras, so it reads the tape and
saves the scenes as files. The configuration and usage is up
to the user, since this program just keeps working, and works well.
Using Cinelerra
For non-linear video editing, I
obviously prefer Cinelerra.
Once the video is saved, the render feature is used to create
the content. This is not as easy as it sounds, though.
Video files and audio files must be exported separately.
Important to remember, since my camera is widescreen, to set
the format to 16:9 in the
Settings->Format...
menu.
Only one stream is rendered at a time. The audio files are
rendered by choosing "AC3" and picking a data bitrate in the
options. The data rate is not important, but I usually prefer
384. The video files are rendered using "YUV4MPEG" and using
the FFMPEG pipe. If the pipe is selected from the drop down,
I choose "DVD" and make sure I remove the "-hq" option, as it is not
compatible with my FFMPEG. Just for clarity,
my options are:
ffmpeg
-f yuv4mpegpipe
-i -y -target dvd -ilme -ildct -f mpeg2video %
Both streams are then recombined to form the final video using mplex.
Open the terminal and run:
mplex
-v 0 -f 8
<video>.m2v <audio>.ac3 -o
<output>.mpg
Now the video is prepared for creation of a DVD.
Image Slideshow
Creating a slideshow, complete
with audio, from a directory of images
and an MP3 is actually very easy.
Images should be colocated in a directory, already the size and shape
desired. Directing dvd-slideshow to make the video requires a
text file script. The script must contain commands for the
transition effects and identifies the files in the show. For
example:
fadein:1:
gibusima_x0.jpg:5::
creates a slideshow of 1 picture, fading in for 1 second, and holding
the image "gibusima_x0.jpg" for 5 seconds. Save the text file
with a final effect at the end for a final transition, and save as
plain text. Finally, run dvd-slideshow with the following:
dvd-slideshow
-o
/location/to/place/the/slideshow -n <name of the show> -f
<scriptfile>.txt -a ./<audiofile>.mp3
Dvd-slideshow will create a slideshow using the script file, create an
.xml file with chapters, and multiplex the audio file into the
video. This video is ready for compilation in the DVD.
DVD Menus
DVD menus are created
primarily using spumux, jpeg2yuv, and
mplex. Menus are more complex than just creating an mpeg
video. The Video must contain a channel for storing the
selection and cursor masks. This channel is only
activated/accessible when the mpeg video is combined with the target
videos in DVD author.
To begin, create an image to use as the background.
Currently, dvd menus will only work in 4:3 aspect.
If a 16:9 aspect video is created, the cursors will not line
up properly in the finished DVD. Once the image is created,
create 2 transparent layers to hold the selection and highlight masks.
Paint these masks using the underlying background to lineup
and configure the way desired. These masks are important as
they will be the cursors and selection markers for the finished DVD.
Save each part of the image in separate files:
<menuimage>.jpg, highlight.png, and
selection.png. The highlight and selection images are not
only saved as PNG files, but only contain 2 colors. This is
important since spumux will reject the highlight and selection images
with more than 2 colors.
Create the Menu movie
Now, create the "movie" for the
background using the menu image saved
in the last step. Use the following to create the movie:
jpeg2yuv
-n 50 -I p -f 29.97 -j
<menuimage>.jpg | mpeg2enc -n n -f 8 -o
<menufile>.m2v
It is possible to add an audio track for the menu. An MP3 or
wav file can be used as the track, but should be converted into an m2a
through Cinelerra using AC3 or mpeg2 audio. If no sound track
is desired, a silent track can be created with:
dd
if=/dev/zero bs=4 count=2000 | toolame
-b 128 -s 48 /dev/stdin menu-silent.m2a
Now, the audio and video must be merged together to make a complete
video file:
mplex
-f 8 -o menu.mpg
<audio>.m2a <video>.m2v
Put the menu together
Now, an .xml file containing the
menu definition is created.
The following can be used as a template:
<subpictures>
<stream>
<spu
force="yes"
start="00:00:00.00"
image="select.png"
select="select.png"
highlight="highlight.png"
autooutline="infer"
outlinewidth="6"
autoorder="rows">
</spu>
</stream>
</subpictures>
Finally, use spumux to create the menu file.
spumux
menu.xml < menu.mpg >
menu_final.mpg
The file "menu_final.mpg" is the menu file as it will appear in the
final dvd.
Final Authoring of the
DVD
The final authoring is
done with DVDAuthor. The only
work to be done is creating the DVD script file as the input for
DVDAuthor. In the script file, there are sections labelled
"vmgm" and "titleset". The vmgm section defines the main top
level menu, which is run when the disc is inserted. It is
then possible to create a separate menu for each titleset (e.g. for
chapters) using the same command set. For every menu, a menu
movie must be defined as described above.
To create the top level menu, define the following:
<vmgm>
<menus>
<video format="NTSC"
aspect="4:3"/>
<pgc entry="title"
pause="inf">
<vob
file="../menu_final.mpg"/>
<post>jump cell
1;</post>
<button name="1">
jump title 1; </button>
<button name="2">
jump title 2; </button>
<button name="3">
jump title 3; </button>
<button name="4">
jump title 4; </button>
<button name="5">
jump title 5; </button>
<button name="6">
jump title 6; </button>
<button name="7">
jump title 7; </button>
<button name="8">
jump title 8; </button>
<button name="9">
jump title 9; </button>
</pgc>
</menus>
</vmgm>
Note the aspect property set to 4:3. This is the aspect ratio
for the menu only, not the actual video titles. Also note the
<vob file="../menu_final.mpg"/> entry, which is the
reference to the menu file created with spumux. The
<post> command here tells the dvd player to jump back to
the beginning of the DVD menu mpeg.
For each title referenced in the menu, a title entry pointing to the
video file must be defined as a title in the titleset group.
In the titleset group, it is possible to redefine the aspect
ratio and format.
<titleset>
<titles>
<video aspect="16:9" format="ntsc"/>
After the titleset definition, the titles are listed with a minimum of
the vob file and the action to take when the title is finished.
Titles are listed with the entry "pgc", and the post action
listed below calls the vmgm menu..
<pgc>
<vob file="name of title mpeg"/>
<post>call vmgm menu 1;</post>
</pgc>
So for a complete listing of the dvdauthor.xml file:
<dvdauthor
dest="./DVD">
<vmgm>
<menus>
<video format="NTSC" aspect="4:3"/>
<pgc entry="title" pause="inf">
<vob
file="../menu_final.mpg"/>
<post>jump cell
1;</post>
<button name="1"> jump
title 1; </button>
<button name="2"> jump
title 2; </button>
<button name="3"> jump
title 3; </button>
<button name="4"> jump
title 4; </button>
<button name="5"> jump
title 5; </button>
<button name="6"> jump
title 6; </button>
<button name="7"> jump
title 7; </button>
<button name="8"> jump
title 8; </button>
<button name="9"> jump
title 9; </button>
</pgc>
</menus>
</vmgm>
<titleset>
<titles>
<video aspect="16:9" format="ntsc"/>
<pgc>
<vob file="../files/title1.mpeg"/>
<post>call vmgm menu 1;</post>
</pgc>
<pgc>
<vob file="../files/title2.mpeg"/>
<post>call vmgm menu 1;</post>
</pgc>
<pgc>
<vob file="../files/title3.mpeg"/>
<post>call vmgm menu 1;</post>
</pgc>
<pgc>
<vob file="../files/title4.mpeg"/>
<post>call vmgm menu 1;</post>
</pgc>
<pgc>
<vob file="../files/slideshow.vob"/>
<post>call vmgm menu 1;</post>
</pgc>
<pgc>
<vob file="../files/title6.mpeg"/>
<post>call vmgm menu 1;</post>
</pgc>
<pgc>
<vob file="../files/title7.mpeg"/>
<post>call vmgm menu 1;</post>
</pgc>
<pgc>
<vob file="../files/title8.mpeg"/>
<post>call vmgm menu 1;</post>
</pgc>
<pgc>
<vob file="../files/title9.mpeg"/>
<post>call vmgm menu 1;</post>
</pgc>
</titles>
</titleset>
</dvdauthor>
Now, calling dvdauthor creates the dvd. For more information
on creating a dvd using dvdauthor, see the man page for dvdauthor.
For instance, it is possible to assign menus to each title,
or create audio options.
Using the DVD
To create a dvd iso image, use
mkisofs to copy the dvd directory:
mkisofs
-o dvd.iso <path to dvd
filesystem>
To burn the image to disc, use growisofs:
growisofs
-Z /dev/dvd=dvd.iso speed=16
-dvd-compat -dvd-video
or to burn the directory containing the DVD, use:
growisofs
-Z /dev/dvd -speed=16
-dvd-compat -dvd-video <path to dvd filesystem>
To test the DVD without burning to disc, use your favorite DVD player:
xine
dvd:/complete/path/to/dvd/video_ts