Difference between revisions of "Ripping and Encoding DVDs"
m (→Copy the Main Title from the DVD: point out that <code>lsdvd</code>’s output is somewhat important and what the IFO file is for.) |
(Swap sections.) |
||
| Line 22: | Line 22: | ||
This will extract the chapter information from the main title into a text file. If you want and if you know the names of the chapters, you can now edit this file. | This will extract the chapter information from the main title into a text file. If you want and if you know the names of the chapters, you can now edit this file. | ||
| + | |||
| + | == Encode the Video == | ||
| + | |||
| + | Encoding the video has a lot to do with voodoo. When you try to find “the best options” to encode a DVD you will find none. To be more precise, you will find plenty and they will all contradict each other. In a nutshell, I’m using the following: | ||
| + | |||
| + | * avidemux2 | ||
| + | * Video Codec: MPEG-4 ASP (xvid) | ||
| + | * Constant Quality: 5 | ||
| + | * Some time-hungry options, such as High Motion Estimation, Wide Search for Rate Distortion Optimisation, Quarter Pixel Motion Estimation, and Global Motion Compensation. | ||
| + | * Most important: The Pixel Aspect Ratio has to be set to “as input”! This allows you to crop black borders off of the image without having to recalculate the new width and height of the image. | ||
| + | * Also, you do not need to set the width and height of the image. The size of the source material in combination with the Pixel Aspect Ratio will automatically take care that the final video is stretched as necessary. | ||
| + | * Disable all audio tracks, as the input MPEG file still contains all audio tracks from the DVD. | ||
| + | |||
| + | Now save the file to <code>movie.avi</code>. | ||
== Extract Subtitle Tracks == | == Extract Subtitle Tracks == | ||
| Line 36: | Line 50: | ||
This will create the files <code>movie.en.sub</code> and <code>movie.en.idx</code>. Both are necessary for <code>mkvmerge</code> to do its magic. | This will create the files <code>movie.en.sub</code> and <code>movie.en.idx</code>. Both are necessary for <code>mkvmerge</code> to do its magic. | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
We’re almost there. | We’re almost there. | ||
Revision as of 15:34, 12 August 2010
This page describes in large detail how to create near perfect DVD rips. “Near perfect” in this context means that the video quality is nearly indistinguishable from the DVD video, and all audio tracks contained in the movie are the AC3 tracks that are contained in the DVD without any reencoding whatsoever.
Contents
Copy the Main Title from the DVD
All these actions can be performed without copying the movie to a local hard disk first but as a DVD drive is almost always slower than a local hard disk, copying the main title of the movie to the hard disk before processing will save a lot of time.
First, we need to find out which title is the main title.
$ lsdvd -x
lsdvd can tell you a lot of things about the DVD in question. Especially the track IDs for audio and subtitle tracks will be interesting later on so try not to forget where you got it from. For now it will tell you the longest title on the disc; usually this is the main title. Copy it to the hard disk using tccat from the transcode package:
$ tccat -i /dev/dvd -T <title>,-1 > movie.mpg
While tccat is busy you can already perform the next steps.
$ cp /path/to/dvd/VIDEO_TS/VTS_<vts>_0.IFO movie.ifo
This will copy the IFO file for the main title to the disc. This file contains information that is relevant for subtitle conversion. If you do not need subtitles, you can skip this. The VTS number of the main title is listed in the lsdvd -x output from above and is always two digits long.
$ dvdxchap -t <title> /dev/dvd > movie.chap
This will extract the chapter information from the main title into a text file. If you want and if you know the names of the chapters, you can now edit this file.
Encode the Video
Encoding the video has a lot to do with voodoo. When you try to find “the best options” to encode a DVD you will find none. To be more precise, you will find plenty and they will all contradict each other. In a nutshell, I’m using the following:
- avidemux2
- Video Codec: MPEG-4 ASP (xvid)
- Constant Quality: 5
- Some time-hungry options, such as High Motion Estimation, Wide Search for Rate Distortion Optimisation, Quarter Pixel Motion Estimation, and Global Motion Compensation.
- Most important: The Pixel Aspect Ratio has to be set to “as input”! This allows you to crop black borders off of the image without having to recalculate the new width and height of the image.
- Also, you do not need to set the width and height of the image. The size of the source material in combination with the Pixel Aspect Ratio will automatically take care that the final video is stretched as necessary.
- Disable all audio tracks, as the input MPEG file still contains all audio tracks from the DVD.
Now save the file to movie.avi.
Extract Subtitle Tracks
After tccat has finished copying the movie to your hard disk you can extract the subtitle tracks. This is necessary because they have to be converted before mkvmerge can handle them.
$ tcextract -i movie.mpg -a 0x20 -x ps1 > movie.en.ps1
The ID of the subtitle track (here: 0x20) can be found in the output of lsdvd. Choose the subtitles you like and extract them one after another.
Now they have to be converted to the VobSub format:
$ subtitle2vobsub -p movie.en.ps1 -i movie.ifo -o movie.en
This will create the files movie.en.sub and movie.en.idx. Both are necessary for mkvmerge to do its magic.
We’re almost there.
Mux the Final Video
Now all that we have created has to be put together.
$ mkvmerge -o movie.mkv --title "Movie" --chapter-language eng --chapters movie.chap movie.avi -D -a 1,2 --language 1:eng --language 2:ger movie.mpg --language 0:eng --default-track 0:0 movie.en.idx --language 0:ger --default-track 0:0 movie.de.idx
Voilá, movie.mkv now contains your movie, all audio tracks, and all subtitle tracks that you want to be in there.