Analyzing DVD Content
I usually use 1 of 2 methods for finding out what's on a dvd. First, I run:
lsdvdto see how many titles & chapters are on the dvd, & I look for the main title. More
mplayer dvd://1 -dumpaudio -dumpfile episode1.ac3So, in the above scenario, title one was just one episode, not the main movie file
mplayer dvd://1 -dumpvideo -dumpfile episode1.m2v
mplex -f 8 -o episode1.vob episode1.ac3 episode1.m2v
streamanalyze -i /dev/rcd0c -t 1 (assuming title 1 is the main title)That'll show you what's in title 1. The file formats look like:
/usr/local/share/doc/streamdvd/README.streamanalyze* NOTE *
/usr/local/share/doc/streamdvd/README.streamdvd
dvdauthor -t -o /path/to/save -f 'streamdvd -i /dev/rcd0c -t 1 \That's a good example. It's trying to get title 1, the main video, the first audio, and
-s 0xe0,0x80,0x20 -c 1-9 |'
tcprobe -i foo.aviwill print interesting information about the avi file itself and its video audio content.
man 1 tcprobe. Yep, READ THE FINE MANUAL! ;)
mplayer dvd://1 -chapter 1-12 -dumpstream -dumpfile movie1st.vobBut, if you see your movie will fit on a single-layer dvd, or that it looks close, just do this:
mplayer dvd://1 -chapter 13-24 -dumpstream -dumpfile movie2nd.vob
mplayer dvd://# -dumpstream -dumpfile movie.vobTo play the movie with english subtitles, do this:
mplayer -sid 0 movie.vobIf your movie won't fit on a single-layer dvd, but it doesn't look too awfully big, after you've
tcextract -i movie.vob -t vob -x ac3 -a 0 > audio.ac3Extract video:
tcextract -i movie.vob -t vob -x mpeg2 > movie.m2vIf you need subtitles use spububmux from dvdauthor and ifo_dump from libdvdread-utils.
ifo_dump /dev/rcd0c 1 |grep Color |sed 's/Color ..: 00//' > palette.yuvCalculate the exact shrinkage factor with this formula:
Generate picture PNG in format 4.12
spuunmux -s 1 -p palette.yuv movie.vob
This command generates PNG files and command file sub.xml
requant_factor = (video_size / (4700000000 - audio_size)) * 1.04Now use the factor derived from the formula above to shrink the video:
* NOTE: This worked perfectly for me first time out. YMMV!
tcrequant -i movie.m2v -o new.m2v -f (shrinkage factor)* NOTE *
mplex -f 8 -o new.mpg new.m2v audio.ac3At this point, you can insert subtitles.
spumux sub.xml < new.mpg > new.vob
Nasty DVD's
* NOTE *:
The Nasty DVD's section has been added since I first put this information
together on my Blogger Account. I had never run into the following problem before until
recently. So, I've included this section too YMMV with this. I didn't have to do all the
'catting' of files together. After the following procedures, I wound up with only 2 blank
mpg's and the one good one. You, on the other hand, may wind up with several good ones
that will have to be combined or 'catted' together. Okay, on to the business at hand.
Usually most users end up getting frustrated at the above error and start Googling their
way into insanity. Have faith however, the following should solve your problem! Although
it isn't pretty, it will backup even the most stubborn DVDs out there.
Output to Multiple Files
Let's fix the above command so it will crank out several files. You might want to do this
in a new directory as it may poop out many mpgs.
mplex -f 8 -o final_output%d.mpg output_shrunk.m2v output.ac3{i} The %d here tells mplex that it is now free to crank out as many split files as required
Remove Blank MPG's
Here is where the nightmare starts. Once mplex is finished, you will need to browse
through all of your final_output#.mpg files. Usually there are many that are very
small blank short mpgs. Play them in a media player to confirm. What you are looking
for is your primary title files. Make a note of them all, and discard the rest of the files.
{i} Because we are now dealing with a tricky (and probably copy protected) DVD, our
audio will be completely out of sync. Ignore this for now.
Strip the Video Stream AGAIN
So now we have who knows how many mpgs containing our copy protected / tricky / poorly
made DVD. Because mplex tried to sync the sound to the tricky sections that are now
gone, we will need to rip our lovely main title out of the mix again. To do this,
simply re-issue the mplayer command to strip the video. You will need to strip each
video stream into individual m2v files. {i} If someone knows how to clean this step
up, please adjust the wiki accordingly.
mplayer -dumpvideo -dumpfile <Output_Filename_#.m2v> <Input_Filename#.mpg>Now we should have a series of m2v files that contain only our primary title without
Concatenate the Video Stream
Let's make the multiple files one again so we can sync up our singular sound file
to the new title:
cat file1.m2v file2.m2v file3.m2v > final_title.m2v{i} The above assumes you re-named your output m2v files file1, file2, and file3.
mplex -f 8 -o final_output%d.mpg final_title.m2v output.ac3Phew! That was a lot of work eh? To summarize what we have done:
Now that you've got your movie ripped and or shrunk, you setup the dvd file structure
with dvdauthor. First, create dvd.xml:
〈Name it whatever you want. Just be sure to have an .xml extension)〉
<dvdauthor>Pass the xml file to dvdauthor for authoring:
<vmgm />
<titleset>
<titles>
<pgc>
<vob file="new.vob" />
</pgc>
</titles>
</titleset>
</dvdauthor>
dvdauthor -o /path/you/saved/to -x dvd.xmlDvdauthor creates 2 subdirectories below where you're at, AUDIO_TS & VIDEO_TS.
Burning Your DVD's
* NOTE *
I don't know if I can stress the value of dvd rewritables enough! Catch some on sale and
get them. They'll save you making coasters and frisbees. I got some half-priced recently
by watching the Sunday ads. Of course, you can take your changes on eBay. I haven't run
into hardly any problems in three years. 'X' Those are crossed fingers. ;) Anyway, here's
some info on rewritables:
To blank a dvd-rw that already has been written to, and really wipe everything off of it, do:
dvd+rw-format -blank=full /dev/rcd0cThat does a full blanking. This will take about one hour on 1x media. A fast blanking can be done by:
dvd+rw-format -blank /dev/rcd0cOn to the burning.
mkisofs -dvd-video -udf -o new.iso /data/dvdfiles/To burn the image, do this:
growisofs -speed=2 -Z /dev/rcd0c=new.isoTo skip the last 2 steps & burn directly to dvd, do this:
growisofs -dvd-compat -dvd-video -speed=2 -udf -Z /dev/rcd0c /data/dvdfilesor, for the directory containing AUDIO_TS and VIDEO_TS:
(Assuming /dev/rcd0c is your burning device & /data/dvdfiles is the output
directory of dvdauthor)
growisofs -dvd-compat -speed=2 -Z /dev/rcd0c -dvd-video .* NOTE on burning devices *
(and don't forget the . on the end)
VLC
A most amazing video program, to say the least. I recently found out you can rip a dvd with
it. I first started reading about it at:
How to Rip DVDs with VLC
There's also a huge amount of info on using the command line with it at:
VLC command-line help
As a side note, here's an alternative to streaming with vlc using nc or netcat:
On your streaming client, type this first.
$ nc -l 1234 | mplayer -cache 8192 -Then walk to your streaming server (or call your buddy on the other end) and push the file
$ cat Aerosmith-Amazing.mpg | nc 192.168.1.5 1234That is all. It works. Really cool stuff! If you're on the client end, you could still use
(If the streaming client IP is 192.168.1.5...
No affiliation between this site and the OpenBSD project exists or is implied.