Dvdbackup

From ArchWiki
Revision as of 01:07, 5 December 2005 by Slash (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Making a data DVD is simple. It only involves a single command in most cases. If you need to simply burn data onto a DVD, see the DVD Writing Tutorial. However if you want a DVD that you can play in your DVD player, it gets a little more complex. You need to encode the source video, generate the layout of the disc (with menus, titles, chapters, etc), make the filesystem (generate an ISO), and finally burn the ISO. This tutorial will cover only the most basic way of making a video DVD- You place the DVD in your DVD player and a movie plays. You are encouraged to research each step further, as there are countless options and features you can add beyond this.


Encoding Source Video

If the video you want to burn to a DVD is already encoded to the proper format, then you can skip this step. You will need transcode and mjpegtools to encode the video to the proper format. Note that this only applies to AVI or MPEG files. If you are dealing with wmv, asf, mov, ogm, etc files, then you will need to use mencoder.


If you are dealing with another type of file, install mencoder (part of the mplayer package):

pacman -Sy mplayer

For NTSC:

mencoder -o output_file.avi -ovc lavc -lavcopts vbitrate=5000:vhq -ffourcc DX50 -oac pcm -srate 48000 -ofps 29.97 your_movie.mov

For PAL:

mencoder -o output_file.avi -ovc lavc -lavcopts vbitrate=5000:vhq -ffourcc DX50 -oac pcm -srate 48000 -ofps 25 your_movie.mov


Now you will have an AVI file that we can convert to DVD compatable video. Continue by installing the tools we will need:

pacman -Sy transcode mjpegtools

First we separate the audio and video from the source video and encode them to the proper formats using transcode:

transcode -i source_video.avi -y ffmpeg --export_prof dvd-ntsc --export_asr 2 -o video -D0 -b224 -N 0x2000 -s2 -m video.ac3 -J modfps=clonetype=3 --export_fps 29.97 

-i is the source video you are working with. Change this to whatever the original file is called.

-o is the ouput filename. I'll just call it "video" to make it simple.

-m tells transcode to write the audio to a separate file, in this case video.ac3

-export_asr is the aspect ratio. 2 is 4:3 ratio, and 3 is for 16:9 ratio. Change this to whichever one you want.


NOTE: The above command uses the NTSC compatable format. To encode to PAL format, you need to make a few changes:

--export_prof dvd-pal

--export_fps 25


This process will probably take some time. An hour long video could take 1-3 hours to encode depending on the speed of your computer. When complete, you will be left with a video.m2v file and video.ac3 file. These are DVD-compliant video and audio files, respectively.

The next step is to merge these 2 files into one DVD MPEG file using mplex, part of the mjpegtools package.

mplex -f 8 -o video.mpg video.m2v video.ac3 

Now is a good time to test the video.mpg file in your video player of choice, such as mplayer or xine. If everything appears ok, then you can continue to the next step.


Create DVD Structure

In order to generate the layout of the DVD from your video files, you will need to use dvdauthor:

pacman -Sy dvdauthor

You can specify a lot of options via command line, but it is much easier to simply create an XML file with the appropriate options. dvdauthor can do just about anything, but it could get fairly complex and beyond the scope of this tutorial. We just wnat to put a DVD in the drive and have it play our video. The XML file should look like this:

<dvdauthor>
    <vmgm />
    <titleset>
        <titles>
            <pgc>
                <vob file="video.mpg" />
            </pgc>
        </titles>
    </titleset>
</dvdauthor>

You can name this file whatever you want. Let's just assume it is dvd.xml. Next, we will run dvdauthor to generate the structure of the DVD.

dvdauthor -o dvd -x dvd.xml

-o is the ouput directory. This can be whatever you please, but make sure the directory doesn't exist prior to running the command.

-x the XML file to load settings from. Change this to whatever you named your XML file.

After dvdauthor completes doing it's thing, you will have a dvd/ directory in the current directory. These are the files you will want to burn to a DVD in the next step.

Links with more information regarding the XML file for advanced usage:

http://dvdauthor.sourceforge.net/doc/ex-title.html

http://www.tappin.me.uk/Linux/dvd.html#author

http://gecius.de/linux/dvd.html


Generate the ISO and Burn the DVD

This can actually be done in one step, but I will go over the 2-step process anyways, just in case you want to distribute an ISO to other people. For this step, we will need two packages; dvd+rw-tools and cdrtools

pacman -Sy dvd+rw-tools cdrtools

First, we make the filesystem using mkisofs, part of the cdrtools package:

mkisofs -dvd-video -udf -o dvd.iso dvd/

-o is the output file. Of course, this can be whatever you want.

dvd/ is the directory generated by dvdauthor. If you used a different directory, of course you will need to change this.

Next, we use growisofs to burn the DVD:

growisofs -Z /dev/hdd=dvd.iso

That should be it! Make sure you change the device path to whatever your DVD burner is and specify the correct ISO filename you are using.

This can actually be done in one step, like I mentioned before, like so:

growisofs -dvd-video -udf -Z /dev/hdd dvd/

This will skip the ISO step and burn the filesystem directly to the DVD. Change the device name and the directory to fit your needs.


More Information and Links

mplayer/mencoder: http://www.mplayerhq.hu/

dvdauthor: http://dvdauthor.sourceforge.net/

http://www.tappin.me.uk/Linux/dvd.html

http://gecius.de/linux/dvd.html

http://forums.gentoo.org/viewtopic.php?t=117709