rip dvd 2 matroska (ii)

Posted by perkins on 9 November 2010 in IT | Short Link

This continues my previous experience disclosed earlier over here. I start here at the point, where I extract one temp vob file out of standard DVD VIDEO_TS folder content:

mplayer dvd://1 -dumpstream -dvd-device ~/temp/my_moovie/ \
-dumpfile ~/temp/dvd_dump.vob

I take ‘manual’ approach here, except final muxing with “MKV file creator” utility.  Before I say goodbuy to the original DVD, I will extract chapters and look at the audio streams (though the latter is probably not that necessary).

The text is intentionally brief. For more detailed instructions please consult full fledged guide, referred to at the end of this post. Particularly, the video encoding did not involve fine tuning parameters. This is mainly because the result was pretty good without extra hustle.

ffmpeg

Make sure you have ffmpeg compiled with x265 and mp3 support (here is the instruction).

Chapters

Dvdxchap is the tool.  It is fairly simple to get chapters with it:

dvdxchap -t 1 /dev/dvd > chapters.txt

Audio

I encountered numerous problems, attempting to encode everything in one go. So, for now I decided to keep it simple and encode audio and video separately.

Decide, what audio tracks to keep, to save space and avoid extra encoding. The tracks can be identified from both, original DVD files and our temp single VOB file, extracted as above. However, I can get much more descriptive information from the original DVD:

 mplayer -frames 0 -identify dvd://1 -dvd-device ~~/temp/my_moovie/ \
2>/dev/null | egrep -i "^audio stream" -A1

NOTE: ffmpeg do not honors aid (audio id) of audio tracks. I use simple

ffmpeg -i tmp.vob

to check the content of vob file from the ffmpeg viewpoint. It is easy then just to get sample of each audio track to identify  them. For this, add to the next script ‘-ss 160 -t 90′ to encode only small part, starting from 160 sec with 90 sec length.

Then, I encode audio tracks in one blow (here I encode 2 tracks, that are 1 and 3rd stream in the tmp.vob, using mp3 encoder):

ffmpeg -i tmp.vob -map 0:1 -map 0:3 \
-ac 2 -acodec libmp3lame -ar 48000 -ab 192K first_track.mp3 \
-ac 2 -acodec libmp3lame -ar 48000 -ab 192K second_track.mp3

Video

Next, I apply 2-pass h264 encoding to our temp VOB file.

ffmpeg -i tmp.vob -pass 1 -an -vcodec libx264 -vpre slow_firstpass \
-b 2800k -bt 4000k -threads 0 -f rawvideo -y /dev/null
ffmpeg -i tmp.vob -pass 2 -an -vcodec libx264 -vpre slow \
-b 2800k -bt 4000k -threads 0 -y final.mp4

Subtitle

I found it easy to steal subtitles from free sites such as opensubtitles.org, so no extraction of subtitles was undertaken. Some information on the process can be found over here. I fetched srt file for subtitles, available on opensubtitles.org

MKV

It surprised me that no additional working was required. No audio sync problem. So, as soon as I put everything in container, everything work, including subtitles and chapters. As I mentioned before, I like GUI utility “MKV files creator”, which was used for the final muxing. For audio and subtitle tracks don’t forget to define the language. In case the number of tracks is more than one, define the default one. All that will add to the resulting mkv file usability.

References:

http://en.gentoo-wiki.com/wiki/Ripping_DVD_to_Matroska_and_H.264

Tags: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2006-2012 dimonf All rights reserved.
The Shades theme, version 1.8, is a BuyNowShop.com creation.