[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.
Trogburn
Posts: 4
Joined: Sat Sep 19, 2015 10:16 pm

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

Post by Trogburn »

AlBundy wrote:I hope that your drc overrides my default because your value will be added later in command line.
You could try an encode with 0 and another with a very high value and compare the results.
Ok, I just did a test recording with --xtra "--drc 0.0" and another test recording with --xtra "--drc 4.0". This puts the first recording at the minimum DRC value via the command line, and the second recording at the maximum DRC value via the command line, to compare the results as you mentioned. The verbose INFO in the windows command prompt doesn't provide me with any guaranteed indicators that it succeeded so I am going to play each file here shortly, and then edit this post to let you know the actual results. What I should see, if it works, and overrides the default 0.0 value correctly in your script, is the first recording will still have LARGE gaps between the softest and loudest sounds in my movie (easily seen during action sequences / swells in soundtrack / etc), while the second recording will have the gaps between the softest and loudest sounds in the movie reduced significantly.
AlBundy wrote:What do you mean with that?
I was (and still am) curious if there is a way in the hb.rb settings/script to work with the GAIN? If I am in the Handbrake GUI there is an audio setting for most encoders called Gain that you can tweak to help amplify the encoding (since most encodings come out softer on sound level). And in Handbrake CLI to use this for the encoder, you type --gain <float>, like --gain 3.5. So, can we do the same directly in hb.rb or do I need to pass this via the --xtra tag as well? The main reason I am asking is I am not seeing it show up in the hb.rb section when I attempt to use it in the same manner... (shown in screenshot below - it would appear next to drc 0.0 I am guessing).

Image
Last edited by Trogburn on Mon Sep 21, 2015 4:09 am, edited 1 time in total.
AlBundy
Bright Spark User
Posts: 377
Joined: Mon Dec 31, 2012 4:47 am

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

Post by AlBundy »

--xtra is ok to add the gain parameter.
You don't see gain in my arguments because I don't set a value.

You can enable writing the encode log to get the output of handbrake.

Al
Trogburn
Posts: 4
Joined: Sat Sep 19, 2015 10:16 pm

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

Post by Trogburn »

Trogburn wrote:and then edit this post to let you know the actual results.
So instead of editing my last post as planned, since you had already responded before I got back to it with my tested results, I will just reply here. I verified that the Override is working correctly for DRC. I tested DRC 0.0 and DRC 4.0 (the max value) both via --xtra --drc <value> and there is a noticeable difference in the video during scenes where the audio is quieter on 0.0 (on 4.0 it is louder / normalized).

A good example if anyone wants to do this test as well and has the movie I was using (500 Days of Summer) is around 30-33 minutes in, when the guy is doing the dance montage down the street (which is very loud), and then enters his work building and co-workers are talking / almost whispering (the elevator shutting + him talking + the co-workers are all very quiet). So on DRC 0.0, you will notice the drastic difference in volume, but on DRC 4.0 you will see the volume levels normalized quite a bit.
AlBundy wrote:--xtra is ok to add the gain parameter.
You don't see gain in my arguments because I don't set a value.
As for GAIN, I tested this as well at the same time, and both my movies were boosted with GAIN 5.0, and I can verify that my audio stream was loud enough for my receiver to run at 26. When GAIN is set to 0.0 (default), I typically have to set my receiver to over 34+ for movies, especially during the quieter scenes.

Thanks for your help OP! Again, this script is a HUGE help, and I appreciate all the great work here!

For anyone looking for helpful final scripts, here are the two I am going to be using now for DVDs based on this research.

NON-DISNEY ANIMATION MOVIES + ALL OTHER MOVIES:

Code: Select all

hb.rb --input "H:\TEST\*\*.mkv" --main --titles 1 --output "I:\MOVIES (FS - Rips & Re-encodes)\#source_parentname#\#source_basename#.mkv" --autocrop --no-loose-anamorphic --skip-commentaries --quality 20 --decomb --detelecine --only-first-track-per-language --audio-track encoder=av_aac,mixdown=stereo,language=eng,arate=auto,bitrate=320 --xtra "-f mkv -e x264 --drc 2.5 --gain 5.0 --vfr -x level=4.1:no-fast-pskip:ref=4:bframes=8:b-adapt=2:direct=auto:me=umh:subme=10:merange=24:analyse=all:trellis=2:psy-rd=1.0,0.15:no-dct-decimate=1:deblock=-1,-1:vbv-bufsize=13000:vbv-maxrate=13000:crf=21:rc-lookahead=50 --verbose=1"
DISNEY ANIMATION MOVIES:

Code: Select all

hb.rb --input "H:\TEST\*\*.mkv" --main --titles 1 --output "I:\MOVIES (FS - Rips & Re-encodes)\#source_parentname#\#source_basename#.mkv" --autocrop --no-loose-anamorphic --skip-commentaries --quality 20 --decomb --detelecine --only-first-track-per-language --audio-track encoder=av_aac,mixdown=stereo,language=eng,arate=auto,bitrate=320 --xtra "-f mkv -e x264 --drc 2.5 --gain 5.0 --vfr -x level=4.1:no-fast-pskip:ref=4:bframes=8:b-adapt=2:direct=auto:me=umh:subme=10:merange=24:analyse=all:trellis=2:psy-rd=0.4,0.00:no-dct-decimate=1:deblock=1,1:vbv-bufsize=13000:vbv-maxrate=13000:crf=21:rc-lookahead=50 --verbose=1"
Keep in mind that these are my final scripts for DVDs. I would definitely tweak them a bit for BluRays (quality for instance should probably be adjusted).
alakar
Posts: 2
Joined: Sat Apr 22, 2017 10:45 pm

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

Post by alakar »

This breaks for me since the upgrade to HandBrake 1.x.x
Any chance we could get an updated version of the script?
AlBundy
Bright Spark User
Posts: 377
Joined: Mon Dec 31, 2012 4:47 am

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

Post by AlBundy »

I've committed a new change to github to work with latest handbrakecli.

Al
alakar
Posts: 2
Joined: Sat Apr 22, 2017 10:45 pm

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

Post by alakar »

Is there an easy way to allow for an x265 encoder option?
AlBundy
Bright Spark User
Posts: 377
Joined: Mon Dec 31, 2012 4:47 am

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

Post by AlBundy »

You can already add --encoder x265 to your command line.
Meybe this is enough - if not I can add more arguments.
ktverdun
Posts: 4
Joined: Sun Apr 21, 2013 2:42 pm

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

Post by ktverdun »

I've been using this handbrake script for years and it has been a great timesaver to skip having to use the handbrake ui.

I thought I would upgrade to the latest handbrakecli to take advantage of the newer presets, but cannot get hb_rb to recognize any presets in newer CLIs.

I've run through an upgrade to the latest version of everything to make sure all items were in sync based on the readme instructions:
  • Ruby+Devkit 2.5.3-1 (x64)
  • HandBrakeCLI-1.2.0-win-x86_64
  • The latest build from hb_rb
  • Run all of the ruby gems recommended in the readme
  • Tried rebooting too just to be on the safe side.
None of the handbrake presets work. If I revert back to a handbrakecli version that is older than 1.x.x, I have no issues and am able to use the old presets.

Is there a trick to getting the presets to work with the newer CLIs? My understanding from this thread is that the fix in 2017 was made to allow use of the new handbrakecli presets.
AlBundy
Bright Spark User
Posts: 377
Joined: Mon Dec 31, 2012 4:47 am

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

Post by AlBundy »

I've pushed some changes to github - maybe they'll work.
The problem is that older versions of handbrake printed the list of cli-arguments.
Now I have to create the arguments from the exported json file with an older manicure.rb (to support older versions too).

You can give it a try if you want.
AlBundy
Bright Spark User
Posts: 377
Joined: Mon Dec 31, 2012 4:47 am

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

Post by AlBundy »

Did you try?
ktverdun
Posts: 4
Joined: Sun Apr 21, 2013 2:42 pm

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

Post by ktverdun »

Yes, that fix worked! Thank you!
Replop
Posts: 2
Joined: Sat Nov 02, 2019 4:02 pm

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

Post by Replop »

Hello and thanks a lot for this good too.
I had everything working just fine before but vas To fully reinstall my distro. Now I can encode but I canot have the french subtitles added.

Input are mkv with multiples subtitles tracks but when I do a --check subtitles are lit listed. Do you know if I'm doing something wrong here ? I will edit my post when I'm home.

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

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

Post by AlBundy »

Maybe different version of HandbrakeCLI or an issue with your file?
Replop
Posts: 2
Joined: Sat Nov 02, 2019 4:02 pm

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

Post by Replop »

Hey AlBundy sorry for the delay on the reply, just a new father here :)

Here is the version of HandBrakeCLI installed on the system :
HandBrake 1.2.1

Tried on multiple files and the same happens... Files I'm sure got subtitles in the container by having them available on The media player.
AlBundy
Bright Spark User
Posts: 377
Joined: Mon Dec 31, 2012 4:47 am

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

Post by AlBundy »

if you add the argument --verbose you should get more output.

And you can also try to load your file in Handbrake (CLI or GUI) to check if handbrake shows subtitles.
Krautkiller
Posts: 4
Joined: Mon Jan 27, 2020 2:46 pm

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

Post by Krautkiller »

Hi there,

can someone tell me how to get "user"-Presets working witch were made with actual Handbrake Version (1.3.1)?

Iam totally new to this "script" here, sorry for maybe silly questions ;)
AlBundy
Bright Spark User
Posts: 377
Joined: Mon Dec 31, 2012 4:47 am

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

Post by AlBundy »

Can you try to clone the github-repo?
According to my last commits I've already added experimental support for newer versions.
Krautkiller
Posts: 4
Joined: Mon Jan 27, 2020 2:46 pm

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

Post by Krautkiller »

Hi Al,

indeed ive found the file "hb.presets" to do my own preset, but i struggle with converting audio (deu,eng) into to different formats.

Track1 = German into AC3
Track1 = German into AV_AAC
Track2 = English into AC3
Track2 = English into AV_AAC

so i will end up with 4 Tracks.

ah, btw... ive found a typo in your hb_lib.rb

--audio-mixdown sets: --audio-track encoder=ca_aac,mixdown=....
so the script stops when read "ca_aac ;)
AlBundy
Bright Spark User
Posts: 377
Joined: Mon Dec 31, 2012 4:47 am

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

Post by AlBundy »

Not sure but you can try to add --audio-track multiple times.
Krautkiller
Posts: 4
Joined: Mon Jan 27, 2020 2:46 pm

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

Post by Krautkiller »

Ive tested this before my post. The script use only the first argument:

--audio 2,1 --aencoder ac3,ac3 --mixdown auto,auto --ab 640,640

when doing it manually with the cli this argument is working well:

--audio 2,2,1,1 --aencoder ac3,av_aac,ac3,av_aac --mixdown auto,stereo,auto,stereo --ab 640,320,640,320

:(
Krautkiller
Posts: 4
Joined: Mon Jan 27, 2020 2:46 pm

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

Post by Krautkiller »

anybody here with some ideas?
AlBundy
Bright Spark User
Posts: 377
Joined: Mon Dec 31, 2012 4:47 am

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

Post by AlBundy »

Currently I can not check this but you can try to add deu,deu,eng,eng as languages.

If I remember correctly I support multiple audio-encodings but I'm not 100% sure....
AlBundy
Bright Spark User
Posts: 377
Joined: Mon Dec 31, 2012 4:47 am

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

Post by AlBundy »

I've commited a change so now you can add --audio-copy --audio-mixdown for example.
The change was introduced in the last commit to support new versions of HandbrakeCLI but I'm not sure if this change was intended.
So maybe I have to revert this change and find another solution but for now it should work.
Eelisland
Posts: 9
Joined: Thu Jan 23, 2014 2:21 pm

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

Post by Eelisland »

Hello Al, hope you doin well :)
Been using a previous version of your script for years, hundreds of encoding later i updated everything on a new machine and try the last git hb.rb.
Not shure to understand about preset, since Handbrake use json and not plist anymore we can't use our own custom presets ? Only Handbrake built in preset that hb.rb remind on unknown specified preset ?
i was used to add a preset.plist in same folder as hb.rb (with gem plist installed) with few custom settings like very_slow encoding and audio codec.
Thanks
AlBundy
Bright Spark User
Posts: 377
Joined: Mon Dec 31, 2012 4:47 am

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

Post by AlBundy »

Handbrake used plist before and provided a script to get arguments for each preset.
But if I remember correctly this is not supported anymore.

I'm still using an older version of handbrake cli because newer versions do not support qsv for my cpu.
Post Reply