PDA

View Full Version : How do you extract different dvd titles?


cogman
26th July 2008, 23:38
Hey, I have several dvds with 8 episodes on each disk. I have figured out how I can automate the process of encoding each dvd but am having troubles actually getting the data.

so heres my problem, I want to run some avi-synth scripts on each of my titles while encoding, the problem is I never know exactally where a title will appear (could be PGC 1-4, but they are usually in the same PGC) Now just using mplayer, it was as easy as saying "mplayer dvd://1" (though I did run into some audio sync problems, part of the reason I would like to be able to use my avi-synth scripts...)

so is there any dvd ripper that can do each title separately? I tried vobcopy but it would copy the entire disk. Keep in mind, I would like this to be easy for automation (so if you know some fancy DVD decrypter script that will automatically find each of the 30 min titles that would be great too)

*edit* I have figured it out. The tool, dvdbackup does exactly what I want it to do (though it doesn't have the option to output to a specific directory). Maybe a little later I will post my master script that Im making :D

fbgd
28th July 2008, 16:32
You can use the -o option with dvdbackup to output to a specific directory.

cogman
29th July 2008, 15:49
so, I think i finally got the script down to where I would like it. Hopefully someone else might find this useful.

#!/bin/bash

for(( i=1; $i <= 8; ++i ))
do
s=$(expr $i + 8)
title=S3Ep$s
directory=$title/VIDEO_TS

dvdbackup -t $i -n $title
ofile=$(dir $directory/*1.VOB)
wine DGIndex -AIF=[$ofile] -OM=2 -OF=[$directory/$title] -AT=[] -EXIT -HIDE

echo "MPEG2Source(\"$title.d2v\")
Telecide()
Decimate()

source=last
denoised=FFT3DFilter(sigma=6,plane=3,bw=32,bh=32,bt=3,ow=16,oh=16)
backward_vec2 = MVAnalyse(denoised,isb = true, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
backward_vec1 = MVAnalyse(denoised,isb = true, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec1 = MVAnalyse(denoised,isb = false, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec2 = MVAnalyse(denoised,isb = false, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
MVDegrain2(source,backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=350,idx=2)" > $directory/$title.avs

mkfifo $directory/out.y4m
x264 $directory/out.y4m -o $directory/$title.264 --threads auto --no-fast-pskip -t 2 --mixed-refs --me tesa -w --direct auto -A all --crf 20.0 -r 6 -m 7 -b 16 --b-pyramid --progress --b-rdo -8 &
wine avs2yuv $directory/$title.avs $directory/out.y4m
rm $directory/out.y4m

mkfifo $directory/out.wav
k=1
for j in $directory/*.ac3
do
neroAacEnc -ignorelength -q 0.45 -if $directory/out.wav -of $directory/$title.$k.m4a &
mplayer "$j" -vo null -ao pcm:fast:file=$directory/out.wav -af volnorm=2
k=$(expr $k + 1)
done
rm $directory/out.wav
done

exit 0

Heres what it requires. mplayer, x264, dvdbackup, libdecss2 (for dvdbackup), wine, DGIndex (in the .wine/drive_c/windows folder). Avisynth with DGIndex plugin, mvtools plugin, and fft3dfilter plugin. fftw.dll in the windows system32 folder. avs2yuv.exe in the windows folder. and finally neroEncAac in a path folder (I use /usr/bin)

So, yeah, the requirements are somewhat steep and bothersome to get but here is what it will do for you.

Removes noise pretty well.
encodes the entire disk audio and video (doesn't mux for you)
auto increments episode numbers (not season numbers, some adjustment has to be done on each disk)

Maybe not the best script written, and any suggestions would be nice. But it works well for me :D;

RunningSkittle
29th July 2008, 21:41
scripting with bash looks 1000x easier than with nt command prompt! was that an actual for loop i just saw?!!! this alone makes me want to move to linux

How would you go about handling things like multiple angles/audio and the way episodes are handled on the disk. ie each eipsode is one VTS, or each episode is a chapter.

When I deal with episodic content, I rip the entire disk by cellid with dvddecrypter, then move the cells pertaining to each episode to its own folder. This way I dont really need to worry about angles, pgcs, or chapters.

Then a command like for /r %path% %%a in (*.vob) do command would enumerate each directory and perform commands on .vob files.

cogman
29th July 2008, 22:48
Yep, that would be a for loop (Oh yeah, makes ripping an episodic dvd MUCH easier)

Multiple angles doesn't seem to be available to dvdbackup, so I guess I would say that they go unhandled. Basically Im just telling dvdbackup to grab each title off the disk and store it in each episode folder.

Audio is good for my uses, but would require tweaking from other people. Unfortunatly 5.1 AC3 and 5.1 AAC have different speaker outputs (something like Left center right as opposed to Left right center). For stereo sound it works great, each language is encoded. It can't tell the difference between languages so its up to you to do the correct muxing of the language of choice (or multiple languages if you like)

Which brings me to a point. Muxing isn't done in this script, also, the full files aren't deleted. I did this for multiple reasons. First, the language reason mentioned above (that and I haven't been ambitious enough to put in a delay reader :D). The second reason is more of a fail safe. If something goes wrong with the encode it allows you to re-encode/fix problems. Yes, this takes a bit more time. But for me it is worth it. It also forces you to watch at least part of the encode to make sure you did things right :D.

But yeah, I choose dvd backup specifically for its ability to choose different titles. Dvds always will store each episode as its own title. Most of the times (not always) they are simply numbered 1 - 8 (or however many is on your disk)

Glad I whetted your appetite for bash scripts, perhaps I will make a linux convert out of you :devil:

RunningSkittle
30th July 2008, 05:37
Ive dabbed around in debian for about a year, but i detest the thought of getting linux dirty with windows apps under wine... thus I stay on windows.

Nt batch has for loops, but only like this by calling labels:

for %%a in (*.vob) do call :test "%%a"
goto endtest
:test
echo %1
othercommands
goto eof
:endtest
:eof

Not very efficient or clean to look at!