Difference between revisions of "Dvdbackup"
m (→Encoding Source Video)
m (moved Make backup of DVD Video to Dvdbackup: Consolidating resources; DVD Ripping will be the "general" article)
Revision as of 17:47, 27 November 2009
- The elegant method is for people who have a DVD Video and wants backing it up, eventually removing unnecessary features. The 'Older' method is for people who have a movie file, like and .avi or a .mov, and want making a true DVD Video
While dual layer DVD recorders are readily available and inexpensive, dual layer media is still not very easy on the wallet. Even if it were affordable, there are some of us who would prefer to simply make a backup copy of a movie, and not all the extra features that nobody watches more than once.
There are several ways to get what you want done, and many of them are slow, and require several steps to accomplish. Here's a simpler method using dvdbackup and dvdauthor, which can be both be found in the AUR. We will also be using mkisofs (found in the cdrtools package), and growisofs.
For a truly elegant GUI based one step method of backing up DVD9 video to DVD5 (e.g. standard cheap DVD-R) why not have a look at k9copy (see links below)?
Making a Backup
The dvdbackup program is elegant because it doesn't have to demultiplex, remultiplex, re-encode, or reformat the movie. This means the backup process is done in one step. The only time to not use this method is for longer movies (greater than 2 or 2.5 hours ... anything that won't fit on a single layer DVD). In those cases, have a look at the Long Method below.
Anyway, let's determine which title to backup. Here's the command to retrieve some information from your DVD. Replace /dev/hdc with the proper drive, of course.
dvdbackup -i/dev/hdc -I
After some less useful information, dvdbackup will show something like this:
Main feature: Title set containing the main feature is 1 The aspect ratio of the main feature is 16:9 The main feature has 1 angle(s) The main feature has 1 audio_track(s) The main feature has 2 subpicture channel(s) The main feature has a maximum of 28 chapter(s) in on of it's titles The main feature has a maximum of 6 audio channel(s) in on of it's titles
What we're concerned with is that the main feature is in title set 1. Next we'll see a list of title sets:
Title Sets: Title set 1 The aspect ratio of title set 1 is 16:9 Title set 1 has 1 angle(s) Title set 1 has 1 audio_track(s) Title set 1 has 2 subpicture channel(s) Titles included in title set 1 is/are Title 1: Title 1 has 28 chapter(s) Title 1 has 6 audio channle(s)
Obviously, the main feature is title 1. Sometimes a titleset will include more than one title, sometimes not. Title sets can also include menus, which will no longer work very well if we're not backing up the entire DVD.
Now to rip the DVD! We're using the drive /dev/hdc, ripping title 1, and outputting to our home directory.
dvdbackup -i/dev/hdc -t1 -o/home/steve
dvdbackup reads the name of the DVD and creates a directory for it. If dvdbackup decides the name of the DVD is too generic (like MOVIE, for instance), you will have to specify a name, as it will refuse to run otherwise. Just use -nMYMOVIENAME to specify.
Creating IFO and BUP Files
If you know much about DVDs, you'll notice that we only have a number of VOB files on our hard drive, and that's not enough to burn a copy! This is where dvdauthor comes in.
First, we need to create a working directory. Then we're going to the directory that contains the VOB files. Be aware that this command is going to make a copy of the entire movie. The original can be deleted right afterwards.
mkdir /home/steve/dvd cd /home/steve/MYMOVIENAME/VIDEO_TS dvdauthor -o /home/steve/dvd *.VOB
dvdauthor just created a copy of our movie, and hopefully it worked alright. If it said anything like "SCR moves backwards, remultiplex input." there might be trouble. Before deleting any files, check the file sizes of the original VOB files compared to the copied ones. If they're all roughly the same, you may be OK. You can use mplayer to test the affected VOB file to see if there's anything missing. If so, you may have to go the long route. I haven't backed up many DVDs, but it appears this problem occurs with special features, and hopefully not actual movies.
Well, now we've built VTS_01_0.IFO and BUP. All we need is VIDEO_TS.IFO and BUP, and we're in business. This part takes much less time, and doesn't waste hard drive space.
cd /home/steve/dvd/VIDEO_TS dvdauthor -o /home/steve/dvd -T
Now we can create an ISO image file, or burn straight to DVD.
Creating an ISO
The advantage to creating the ISO file is that you can test that everything works fine with mplayer before continuing. The disadvantage is of course that it takes up hard drive space again.
mkisofs -dvd-video -udf -o dvd.iso dvd/
To test the image with mplayer, simply:
mplayer dvd:// -dvd-device dvd.iso
If everything seems ok, we can burn the image. Yes, growisofs burns DVDs.
growisofs -Z /dev/hdc=dvd.iso
Burning Straight to DVD
If we're pretty confident in our skills, we don't need to create and test an image, wasting time and hard drive space! We're basically merging the mkisofs with the growisofs commands listed above.
growisofs -dvd-video -udf -Z /dev/hdc dvd/
This method may be necessary if your movie is too long to fit on a single layer disc and you need to shrink the video file a bit, or if dvdauthor was giving you trouble with the method above. Hopefully, the latter case won't happen often.
Anyway, all you need is a tool called dvdshrink, which can be found in the AUR. It's a nice perl script with included GTK2 frontend, which utilizes many tools. Unfortunately, it takes many steps to get a burnable copy with this method, which is why it takes longer than dvdbackup. Of course, the advantage is that it can shrink the video file size if needed. I was able to burn a 2h 23m movie without shrinking, even though the discs say they can only hold 120m of video.
Anyway, run xdvdshrink.pl, the interface is pretty self-explanitory. Click the Configure button to set your DVD drive(s) and specify a working directory with lots of extra space. Save the settings and go back to the main screen. You can "Select from DVD" which title to rip, as well as the audio channel. Each time, the program will scan the DVD and present you with options. The title selection is pretty obvious, as there should be only one long title on there. For the audio selection, simply pick your language. You may also have options for 2 channel or 6 channel audio (stereo or 5.1). It's up to you which one you choose here.
If you have a DVD reader and a DVD burner, you can leave a blank disc in the burner, and enable "Force DVD burn (no prompt) on the right. If you only have a single DVD drive, just enable "Autoburn new DVD", and when the ripping is complete, the program will prompt you to insert a blank disc and hit enter to continue.
The other options you should enable are "Remove working files", "Shrink selected title to fit DVD5" if your movie is too long to fit on a single disc, and it's up to you if you want to "Delete logs". "Remove working files" is especially important, since a movie is roughly 4GB, and this process takes several steps, which may result in 12-20GB of usage on your hard drive, depending on what the program has to do.
Anyway, that should be all. Click "Start copy"!
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
mencoder -o output_file.avi -ovc lavc -lavcopts vbitrate=5000:vhq \ -ffourcc DX50 -oac pcm -srate 48000 -ofps 29.97 your_movie.mov
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 -F mpeg2video --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:
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 want 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:
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