[Script] convert episodes or main-feature from DVD or BD or convert multiple files (on any os)

Discussion of the HandBrake command line interface (CLI)
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.
AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Sun Feb 02, 2014 5:07 pm

I've uploaded a new version that supports #source_parentname# as placeholder.

The duplicated arguments are ok.
For example the first --quality 20.0 are settings from hb.rb - the second --quality 19 comes from you (--xtra).
Because I don't parse xtra-arguments or arguments from presetes they will be added to the end to override default-settings from hb.rb

Al

Georges Orwell
Posts: 4
Joined: Thu Jan 30, 2014 9:00 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by Georges Orwell » Sun Feb 02, 2014 7:57 pm

Thx but when i try

Code: Select all

hb.rb --input "d:\test\**\*.mkv" --output "d:\test2\#source_parentname#\#source_basename#.mkv" --main --audio-copy --xtra "--quality 19.0 "
with the input folder who is for example d:/test/4 fantastiques/4 fantastiques.mkv",
the result of the output is d:/test2/test/4 fantastiques.mkv but, i would like to have d:/test2/4 fantastiques/4fantastiques.mkv.

Is that possible ?

Thx

Georges
Last edited by Georges Orwell on Sun Feb 02, 2014 8:20 pm, edited 1 time in total.

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Sun Feb 02, 2014 8:12 pm

Of course it's possible because I've implemented it that way. :-)
I've uploaded a new version - now your converted file should be stored in d:/test2/4 fantastiques/4 fantastiques.mkv

Al

Georges Orwell
Posts: 4
Joined: Thu Jan 30, 2014 9:00 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by Georges Orwell » Sun Feb 02, 2014 8:20 pm

YES !

That works !

Thanks a lot.

Georges.

katzen33
Posts: 2
Joined: Mon Feb 24, 2014 7:28 pm

Re: [Script] rip all episodes or only main-feature from DVD

Post by katzen33 » Mon Feb 24, 2014 8:12 pm

I'm having trouble running the script on a windows machine. I've used your tool for quite a while on my mac but want to use an old machine for encoding now. Using my regular command (slightly edited, because windows doesn't support ca_aac) I get burnt-in subtitles for every file.

Here's my Input:

Code: Select all

C:\Ruby193\bin\ruby.exe hb.rb --input "Z:/Batch Rip Movies/*.mkv" --output "F:\Desktop\Encoded\#source_basename#.m4v" --audio eng,deu --subtitles eng,deu --audio-track encoder=ffaac,mixdown=dpl2 --skip-commentaries --only-first-track-per-language --main --autocrop --bluray --preview
And the tools output:

Code: Select all

[2014-02-24, 19:29:01]  WARN -- hb.rb: "F:/Desktop/HBRB/tools/handbrake/windows/HandBrakeCLI" --input "Z:/Batch Rip Movies/BATMAN DARK KNIGHT RETURNS PT1-1.mkv" --output "F:/Desktop/Encoded/BATMAN DARK KNIGHT RETURNS PT1-1.m4v" --encoder x264 --quality 20.0 --format mp4 --optimize --markers --start-at duration:60 --stop-at duration:60 --title 1 --audio 1,3 --aencoder ffaac,ffaac --mixdown dpl2,dpl2 --ab 160,160 --drc 0.0,0.0 --aname "English (Dolby Pro Logic II)","Deutsch (Dolby Pro Logic II)" --audio-fallback faac --cfr --rate 23.976 --subtitle 1,3  2>NUL
I don't even see the command for burning in the subtitle. Where is my problem? I'm not sure whether there's a problem with the script or handbrake itself. Also: Not setting subtitles will still burn in the first subtitle (japanese in that case).

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Mon Feb 24, 2014 10:58 pm

Do you use a nightly version of handbrake?
According to rodeo they've implemented a new muxer that doesn't support dvd-subtitles.
See here.viewtopic.php?f=11&t=29498#p136240

Feel free to answer the above thread and ask rodeo to get the old behavior back.

katzen33
Posts: 2
Joined: Mon Feb 24, 2014 7:28 pm

Re: [Script] rip all episodes or only main-feature from DVD

Post by katzen33 » Sat Mar 01, 2014 8:48 am

I was using v0.9.9 (the newest) but I just downgraded to 0.9.4, which gave me a bunch of errors, telling me ffaac wouldn't work, so I updated to 0.9.6 and got an error that dpl2 mixdown isn't available, I should use auto. changed that and now it's working. Thanks!

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Sun Apr 13, 2014 12:12 pm

I've uploaded a new version of my scripts.

The changes are mostly in tag_episode.rb to work on windows (if you want to rename your files and have tu use german umlauts you have to set code page 1252 with command chcp 1252).

Al

adolchristin
Posts: 4
Joined: Thu May 16, 2013 8:52 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by adolchristin » Tue Apr 22, 2014 11:35 pm

Any chance to update the script to support a logical not for the title argument? I find myself ripping lots of TV series where I want to rip everything EXCEPT title 1 which is usually the "play all" title.

I love your script; keep up the good work!

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Wed Apr 23, 2014 11:02 am

You can use --min-duration and --max-duration to filter the episodes.

Al

adolchristin
Posts: 4
Joined: Thu May 16, 2013 8:52 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by adolchristin » Wed Apr 23, 2014 2:30 pm

Oh yeah, man, why didn't I think of that.

Thanks!

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Mon Apr 28, 2014 10:30 pm

I've uploaded a new version that supports the argument --temp to specify another temp-direcotry.
The command sets the environment variables TEMP, TMP and TMPDIR - so it should work on windows, linux and osx.

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Thu May 01, 2014 1:27 am

I've uploaded a new version that supports the argument --qsv
If the qsv_h264-encoder is available on your system it is used, if not x264 is used.

I've also posted a benchmark from my system with both encoders: viewtopic.php?f=9&t=30010

Maybe this thread (or the referred) are helpful to setup qsv: viewtopic.php?f=11&t=29498

Al

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Thu May 01, 2014 2:03 am

Cool - it looks like that some of my ideas (already available in hb.rb) will come to Handbrakes GUI. :-)
http://handbrake.fr/news.php

jmituzas
Posts: 3
Joined: Sat Mar 29, 2014 8:41 pm

Re: [Script] rip all episodes or only main-feature from DVD

Post by jmituzas » Thu May 29, 2014 8:32 pm

First off I have this running on Lubuntu 14.04 from the minimal install. I have installed from repo apt-get install handbrake. My issue is where do I put these handbrake scripts? Can I just place them anywhere, noticed in the readme file that is stated:
extract/install Hanbrake CLI to the appropriate folder in hb.rb-installation-folder under tools/handbrake (e.g. HandbrakeCLI.exe to tools/handbrake/windows)
This is specific to Windows can it just be placed anywhere for Ubuntu/Lubuntu or any Linux for that matter?

Thanks for all of your hard work just want a bit of help to get this working.
Thanks in advance,
jmituzas

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Fri May 30, 2014 7:36 pm

Extract the archive to any folder you want and copy the HandbrakeCLI-Files to tools/handbrake/linux

After that you should be able to use the script.

Al

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Sat May 31, 2014 5:14 pm

I've uploaded a new version, that also searchs in PATH for HandbrakeCLI.

Al

jmituzas
Posts: 3
Joined: Sat Mar 29, 2014 8:41 pm

Re: [Script] rip all episodes or only main-feature from DVD

Post by jmituzas » Mon Jun 02, 2014 7:58 pm

Please I am trying to install this script. I have Ubuntu 14.04 and installed via repo, apt-get install handbrake. When I do whereis handbrake and search the directories, I can't find /tools. If I am on Linux can I just run these scripts from anywhere?

Please let me know I really want to test this out.

Thanks in advance,
Jmituzas

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Mon Jun 02, 2014 8:38 pm

Can you run HandbrakeCLI on command line?
The tools-folder is in the same folder as hb.rb if you want to install it manually.

Al

jmituzas
Posts: 3
Joined: Sat Mar 29, 2014 8:41 pm

Re: [Script] rip all episodes or only main-feature from DVD

Post by jmituzas » Wed Jun 04, 2014 12:07 am

Yes,
I can run HandbrakeCLI, Thanks :)

dobs
Posts: 1
Joined: Thu Jun 05, 2014 11:22 pm

Re: [Script] rip all episodes or only main-feature from DVD

Post by dobs » Thu Jun 05, 2014 11:43 pm

Whats going on here then? cant get it to work..

ubuntu 12.04 server

./hb.rb --input "/home/dobs/*.mkv" --output "/home/dobs/#title#.m4v"

WARN -- hb.rb: processing /home/dobs/title01.mkv (title=, title_alt=, name=title01, size=335.38 MB)
/home/dobs/handbrake script/lib/hb_lib.rb:1112:in `block in convert': undefined method `pos' for nil:NilClass (NoMethodError)
from /home/dobs/handbrake script/lib/hb_lib.rb:809:in `each'
from /home/dobs/handbrake script/lib/hb_lib.rb:809:in `convert'
from ./hb.rb:67:in `block (2 levels) in <main>'
from ./hb.rb:60:in `each'
from ./hb.rb:60:in `block in <main>'
from ./hb.rb:48:in `each'
from ./hb.rb:48:in `<main>'

justintime001
Posts: 5
Joined: Tue May 28, 2013 10:30 pm

Re: [Script] rip all episodes or only main-feature from DVD

Post by justintime001 » Sat Jun 07, 2014 1:14 pm

dobs wrote:Whats going on here then? cant get it to work..

ubuntu 12.04 server

./hb.rb --input "/home/dobs/*.mkv" --output "/home/dobs/#title#.m4v"

WARN -- hb.rb: processing /home/dobs/title01.mkv (title=, title_alt=, name=title01, size=335.38 MB)
/home/dobs/handbrake script/lib/hb_lib.rb:1112:in `block in convert': undefined method `pos' for nil:NilClass (NoMethodError)
from /home/dobs/handbrake script/lib/hb_lib.rb:809:in `each'
from /home/dobs/handbrake script/lib/hb_lib.rb:809:in `convert'
from ./hb.rb:67:in `block (2 levels) in <main>'
from ./hb.rb:60:in `each'
from ./hb.rb:60:in `block in <main>'
from ./hb.rb:48:in `each'
from ./hb.rb:48:in `<main>'

I'm having the same problem it seems. Can't find a way around it: :?:

/Users/me/handbrake/lib/hb_lib.rb:485: warning: Insecure world writable dir /usr/local in PATH, mode 040777
[2014-06-07, 08:04:41] WARN -- hb.rb: processing /Volumes/4TB Seagate/Downloads/movie.avi (title=, title_alt=, name=movie, size=1.62 GB)
/Users/me/handbrake/lib/hb_lib.rb:1112:in `block in convert': undefined method `pos' for nil:NilClass (NoMethodError)
from /Users/me/handbrake/lib/hb_lib.rb:809:in `each'
from /Users/me/handbrake/lib/hb_lib.rb:809:in `convert'
from hb.rb:67:in `block (2 levels) in <main>'
from hb.rb:60:in `each'
from hb.rb:60:in `block in <main>'
from hb.rb:48:in `each'
from hb.rb:48:in `<main>'

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Sat Jun 07, 2014 8:52 pm

What options for hb.rb did you use?
As far as I can see the error comes only if you use option --burnin-forced without having forced subtitles (I think this will work only with DVDs).

I've uploaded a new version, that should prevent the error.

Al

justintime001
Posts: 5
Joined: Tue May 28, 2013 10:30 pm

Re: [Script] rip all episodes or only main-feature from DVD

Post by justintime001 » Sun Jun 08, 2014 1:17 pm

AlBundy wrote:What options for hb.rb did you use?
As far as I can see the error comes only if you use option --burnin-forced without having forced subtitles (I think this will work only with DVDs).

I've uploaded a new version, that should prevent the error.

Al
yeah, that definitely worked. May I ask what you changed? As a software engineer (developing Android apps in Austin, TX) I'm very curious! That was a fast fix!

Btw, I wasn't using any additional options/parameters/xtras at all - not even verbose (which I almost always use). Then I noticed in your post that you had fixed it even though I hadn't told you what commands I gave it. So glad it's working! AND it works with all my old extra commands! very awesome. (I'm using OS X Mavericks btw).

-Justin

AlBundy
Bright Spark User
Posts: 370
Joined: Mon Dec 31, 2012 4:47 am

Re: [Script] rip all episodes or only main-feature from DVD

Post by AlBundy » Sun Jun 08, 2014 3:08 pm

I've added the possibility to burn in the first forced subtitle.
And missed simply a not null check. :-)

The change was in hb_lib.rb line 1112

Al

Post Reply