command line option to scan dvd and rip chapter by chapter

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
davidm71
Posts: 46
Joined: Sat Dec 31, 2016 2:44 am

command line option to scan dvd and rip chapter by chapter

Post by davidm71 »

Hi,

I have been trying to write a command line argument for HandbrakeCLI to open up a DVD and go through processing chapter by chapter and automatically naming them. Having trouble with the commands.

Can anyone help please?

Thanks
Woodstock
Veteran User
Posts: 4619
Joined: Tue Aug 27, 2013 6:39 am

Re: command line option to scan dvd and rip chapter by chapter

Post by Woodstock »

What you are asking for cannot be done within the CLI, but you can use the CLI to do it, via external scripting. The CLI has no looping control structures like you find in scripting languages, be they the Windows CMD prompt, a Linux/Unix shell (also available on MacOS), or things like PowerShell on Windows.

First, I recommend that you simplify your life by NOT having handbrake ripping the disk. At best, it is slow, especially when you're running it 20 times to rip the same disk. Use a dedicated tool for that, like MakeMKV, and you end up with one or more files on your disk that needs a LOT less processing to compute a command line.

How many disks are you talking about? A text editor with column mode editing can construct multiple command lines very quickly. I typically construct one command line with the options I want for the encode, then duplicate it for however many input and output file combinations there are.

Using UltraEdit, I can construct however many lines I need for a disk series in a few minutes. My batch file for Bleach has over 720 lines (361 episodes, two different sets of parameters), covering a mix of "4 or 5 episodes of 5 chapters each" and "1 episode per file" input files. I built it up as I ripped the disks with MakeMKV, and handbrake chugged along processing them. It took less time to copy/paste/edit the batch job than it would to construct a script to "automatically" attempt to do the same thing.
davidm71
Posts: 46
Joined: Sat Dec 31, 2016 2:44 am

Re: command line option to scan dvd and rip chapter by chapter

Post by davidm71 »

Well I'm trying to convert my old Xmen cartoons DVD set onto either x264 or x265. I found a powershell script that I was able to modify that that would take every .Vob file on the disk and convert it to a mp4. That worked. Thing is there are other vob files that I don't want it to convert so I guess a '--min-duration' flag might do the trick there and filter out the smaller vob files. So that technique works, but couldnt instruct handbrakecli to scan the dvd and rip out chapters as a whole. Got Permission denied message when I tried directing it towards the DVD drive or any folder containing its ripped structure. I was right about to download MakeMKV when I got your reply and tried it out and that produced like a dozen large mkv files of various lengths. Guess I could adapt the script towards those files instead but considering I could just as easily scan all the vob files by scripting why run the makemkv?

Thanks
Woodstock
Veteran User
Posts: 4619
Joined: Tue Aug 27, 2013 6:39 am

Re: command line option to scan dvd and rip chapter by chapter

Post by Woodstock »

The MKV generated by MakeMKV is essentially what is in the VOB file. You can set the minimum time in MakeMKV's configuration, too (it's at the bottom of the Video tab of preferences). There are other things you can do within MakeMKV as far as file names, but this isn't the MakeMKV support forum. ;)

Once you have the MKV files, the Power Shell script should not need a lot of tweaking, other than changing from looking at the VOB to looking at an MKV; Handbrake still sees the chapter track to be able to decide where to break up the file according to the chapter count.
davidm71
Posts: 46
Joined: Sat Dec 31, 2016 2:44 am

Re: command line option to scan dvd and rip chapter by chapter

Post by davidm71 »

So why do I need mkv if handbrake can read vobs directly?

Thanks
rollin_eng
Veteran User
Posts: 4854
Joined: Wed May 04, 2011 11:06 pm

Re: command line option to scan dvd and rip chapter by chapter

Post by rollin_eng »

HB does not work on encrypted sources, makemkv will remove any encryption and other issues on commercial DVDs.
davidm71
Posts: 46
Joined: Sat Dec 31, 2016 2:44 am

Re: command line option to scan dvd and rip chapter by chapter

Post by davidm71 »

I have a license for Slysoft Anydvd that runs behind the scenes. For example I can use the HB gui on whatever DVD Anydvd scans.
Woodstock
Veteran User
Posts: 4619
Joined: Tue Aug 27, 2013 6:39 am

Re: command line option to scan dvd and rip chapter by chapter

Post by Woodstock »

If you are copying the VOBs to your drive, and then working with them there, there is not that much difference.

If, however, you're relying on AnyDVD to decrypt in "real time", it makes a big difference in the time to encode AND the wear and tear on your drive and disk. You also cannot change disks until the encode completes; ripping separately to disk allows encodes to continue while you change disks and get the next rip done.

When you're only ripping one disk at a time, it is not a big issue. I typically have 8 to 10 disks ripped in the time it takes handbrake to encode the first one, which means I don't have to sit around the computer for hours.
davidm71
Posts: 46
Joined: Sat Dec 31, 2016 2:44 am

Re: command line option to scan dvd and rip chapter by chapter

Post by davidm71 »

So you don't recommend ripping and encoding in real time? Thing is copying the DVD to disk takes like 20 minutes. Feels quicker doing it on the fly but I could be wrong. Thanks.
Woodstock
Veteran User
Posts: 4619
Joined: Tue Aug 27, 2013 6:39 am

Re: command line option to scan dvd and rip chapter by chapter

Post by Woodstock »

"It depends".

If you do one disk a day, one-step use of the GUI with the third-party library is not a big deal.

The GUI does a lot of the scanning "up front"; It isn't trying to determine the disk structure 14 times for 14 output files. Resorting to the CLI is not "cost effective" in your scenario, because you can load the disk, select the title you want to work with, set the output path, chose the chapters, name the output file, and click "Add to queue". Select the new range of chapters, adjust the output file name, click "Add to queue". Repeat as needed. You lose no time to speak of if you start the queue after the first encode is set up, and there is no scripting to figure out.

The disk, of course, needs to keep spinning through all of this, which (to me) is a huge down side. If it were copied to the HD first, there is both a speed advantage and a wear-and-tear advantage.

For me, that scenario is the exception. And any time you're going to be dealing with more than one disk, copying to the hard drive beats real-time ripping hands down. Primarily because you can queue up the second (and subsequent) disks before the encode of the first completes.

Friday, a half-dozen BDs will arrive, with about 20 hours of video in 60 episodes from 3 different anime series. Using a separate rip-to-disk process (MakeMKV), the disks will be back in their containers within 60 minutes; MakeMKV allows me to use multiple drives and minimal CPU time to rip to disk, and handbrake hardly notices the "slowdown".

A batch job will be started to encode the first episode of the first series as soon as it is off the disk, because I already have a batch file created for Heavy Object; Part 1 arrived two months ago, and Part 2 will use the same encode settings. I'll add to that batch job as I find out what parameters the other two series need.

90 minutes into the process, I'll be done with manual labor. If I did things in "real time", I'd be changing the first disk at this point. Instead, I can start watching part 2 of Heavy Object, because handbrake will have finished episodes 13-15 and saved them to the media server. It will complete the rest of the job overnight, without me hanging around to change disks.

(unfortunately, it being Friday, I'll probably binge-watch it... :roll: )
davidm71
Posts: 46
Joined: Sat Dec 31, 2016 2:44 am

Re: command line option to scan dvd and rip chapter by chapter

Post by davidm71 »

Ok. Thanks. Will probably rip to hard drive first and then encode. Like the idea of the CLI because it seems more customizable than the GUI and even though I'm a novice newbie I like to learn..

Thanks
davidm71
Posts: 46
Joined: Sat Dec 31, 2016 2:44 am

Re: command line option to scan dvd and rip chapter by chapter

Post by davidm71 »

So I have a method setup where start with makemkv and then run a script to encode the chapters. Need help though customizing the parameters for x265-10 for animation.

Thanks
Woodstock
Veteran User
Posts: 4619
Joined: Tue Aug 27, 2013 6:39 am

Re: command line option to scan dvd and rip chapter by chapter

Post by Woodstock »

Add "2> logfile.txt" (or pick a different name) to the END of the command line you're using now, and capture the log of the encode. That will show us what you're doing now, which will help with tweaking. Include the command line itself when you post it here.
davidm71
Posts: 46
Joined: Sat Dec 31, 2016 2:44 am

Re: command line option to scan dvd and rip chapter by chapter

Post by davidm71 »

Hi,

Here is code snippet that details my options that I'm using right now. Over all I'm pretty happy with it. Looks good and file sizes are about 80,000 kb per 20 minute episode:

Code: Select all


#Audio options
$audio = ' -a 1 -E fdk_haac high -R auto -B 128 -6 stereo'

#Source options
$source = ' -t 1 --angle 1 -c 0 '

#video options
$video1 =  '  -f mkv  -e x265_10bit -q 28 --encoder-preset medium --non-anamorphic '
$video2 =  ' --no-two-pass --vfr --decomb --modulus 16  --verbose=0'
Post Reply