Converting a GUI preset to CLI for batching

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.
Post Reply
Frank
Novice
Posts: 64
Joined: Fri Apr 20, 2007 9:06 am

Converting a GUI preset to CLI for batching

Post by Frank »

As Mac Handbrake GUI [Version 6902svn x86_64 (2015021401)] still doesn't support presets involving the CC subtitles setting being applied to a batch of Transport Stream encodes, I'd like to try and do this via CLI.

Now that I'm trying the CLI, I can see how much the GUI insulates me from all sorts of detail. So, in brief, if this is the encoding setting of my current capture off the cable STB… how would I convert this into an appropriate CLI string?

Code: Select all

[snip]
[01:10:25] sync: expecting 99646 video frames
[01:10:25] job configuration:
[01:10:25]  * source
[01:10:25]    + /Volumes/DCT Edits/To Trim/PBS.ts
[01:10:25]    + title 1, chapter(s) 1 to 1
[01:10:25]  * destination
[01:10:25]    + /Users/frank/Desktop/PBS.m4v
[01:10:25]    + container: MPEG-4 (libavformat)
[01:10:25]      + optimized for HTTP streaming (fast start)
[01:10:25]  * video track
[01:10:25]    + decoder: mpeg2video
[01:10:25]      + bitrate 18500 kbps
[01:10:25]    + filters
[01:10:25]      + Detelecine (pullup) (default settings)
[01:10:25]      + Decomb (default settings)
[01:10:25]      + Framerate Shaper (0:27000000:900900)
[01:10:25]        + frame rate: same as source (around 29.970 fps)
[01:10:25]      + Crop and Scale (1280:720:0:0:0:0)
[01:10:25]        + source: 1920 * 1080, crop (0/0/0/0): 1920 * 1080, scale: 1280 * 720
[01:10:25]    + Output geometry
[01:10:25]      + storage dimensions: 1280 x 720
[01:10:25]      + pixel aspect ratio: 1 : 1
[01:10:25]      + display dimensions: 1280 x 720
[01:10:25]    + encoder: H.264 (libx264)
[01:10:25]      + options: ref=4:b-adapt=2:direct=auto:me=tesa:merange=30:slices=4:vbv-bufsize=30000:vbv-maxrate=40000:rc-lookahead=50:trellis=2
[01:10:25]      + quality: 22.00 (RF)
[01:10:25]  * subtitle track 1, Closed Captions (track 0, id 0x0) Text [CC] -> Passthrough
[01:10:25]  * audio track 1
[01:10:25]    + decoder: English (AC3) (5.1 ch) (track 1, id 0x1390)
[01:10:25]      + bitrate: 384 kbps, samplerate: 48000 Hz
[01:10:25]    + AC3 Passthru
[01:10:25]  * audio track 2
[01:10:25]    + decoder: English (AC3) (5.1 ch) (track 1, id 0x1390)
[01:10:25]      + bitrate: 384 kbps, samplerate: 48000 Hz
[01:10:25]    + mixdown: Dolby Pro Logic II
[01:10:25]    + encoder: AAC (Apple AudioToolbox)
[01:10:25]      + bitrate: 160 kbps, samplerate: 48000 Hz
[01:10:25] file is MPEG Transport Stream with 188 byte packets offset 0 bytes
[01:10:25] thread 10dbd6000 started ("Reader")
[01:10:25] thread 10dc59000 started ("Detelecine (pullup)")
[01:10:25] reader: first SCR 914 id 0x138f DTS 34114
[01:10:25] thread 117e3e000 started ("Decomb")
[01:10:25] thread 117ec1000 started ("Framerate Shaper")
[01:10:25] thread 117f44000 started ("Crop and Scale")
[01:10:25] thread 117fc7000 started ("AudioSynchronization")
[01:10:25] thread 11804a000 started ("AudioSynchronization")
[01:10:25] thread 1180cd000 started ("Video decoder (libavcodec)")
[01:10:25] thread 118150000 started ("Closed Caption (608) decoder")
[01:10:25] encx264: min-keyint: 30, keyint: 300
[01:10:25] encx264: encoding at constant RF 22.000000
[01:10:25] encx264: unparsed options: ref=4:b-adapt=2:direct=auto:me=tesa:merange=30:slices=4:vbv-bufsize=30000:vbv-maxrate=40000:rc-lookahead=50:trellis=2
[01:10:25] encx264: opening libx264 (pass 0)
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[01:10:25] mpeg2video: "Chapter 1" (1) at frame 0 time 3003
x264 [info]: profile High, level 4.1
Reading the HandbrakeCLI --help shows so many options, I'm not certain what to follow.

Thanks for any tips or suggestions...
User avatar
Ritsuka
HandBrake Team
Posts: 1655
Joined: Fri Jan 12, 2007 11:29 am

Re: Converting a GUI preset to CLI for batching

Post by Ritsuka »

Actually it does, it's in the defaults panel, you can open it by pressing the "Configure defaults" button in the Subtitles tab.
Frank
Novice
Posts: 64
Joined: Fri Apr 20, 2007 9:06 am

Re: Converting a GUI preset to CLI for batching

Post by Frank »

Ritsuka… Great news, thank you! I'll try and figure out if that will work on the MacGUI side for what I'm doing.

Nonetheless, my original question remains… how do I convert the encoding strings I'm using now into a CLI string?

Thanks again for your help!
mduell
Veteran User
Posts: 8196
Joined: Sat Apr 21, 2007 8:54 pm

Re: Converting a GUI preset to CLI for batching

Post by mduell »

I'd start with reading the CLI help (./HandBrakeCLI --help) info, it details all the options, just match up the same options you picked in the GUI. Literally just go line by line through the job configuration and find the matching CLI options.

Did you go to the advanced panel and randomly mash buttons to get those x264 options? They're... very strange.
Frank
Novice
Posts: 64
Joined: Fri Apr 20, 2007 9:06 am

Re: Converting a GUI preset to CLI for batching

Post by Frank »

mduell —

thanks, will try again with the --help CLI info again. So the encode log and settings do provide all the info I need then? i.e. GUI doesn't have additional options that the CLI doesn't?

random mashup? nah. Originally based on JoeTheZombiePS3 settings from way back. Was experimenting with different settings, speeds etc. when I posted my plea/request for help. Trying to figure out a way to get the absolute smallest file to play on PS3 and AppleTV without much regard to speed of encoding.That's just an encode I was working on when I originally posted.
mduell
Veteran User
Posts: 8196
Joined: Sat Apr 21, 2007 8:54 pm

Re: Converting a GUI preset to CLI for batching

Post by mduell »

Not as far as I know of. There are things you can do with the CLI you can't do with the GUI, like the rotation filter.

You'd be better off using x264 profile/advanced options to impose your playback device specific requirements (slices, vbv, refs) and then using the x264 presets/tunes to get your desired level of compression efficiency/encoding speed. The x264 devs who created them are much more familiar with the efficiency/speed tradeoffs that can be made most worthwhile. For example huge merange and tesa are quite slow for little gain.
RonJohn
Novice
Posts: 54
Joined: Thu Jul 08, 2010 12:27 pm

Re: Converting a GUI preset to CLI for batching

Post by RonJohn »

Run "HandBrake -z" to get a dump of the parameters used by the various built-in presets. Then use that as the starting point for your batch script.

Regarding CC subtitles, I'd run "HandBrake -t0 --scan -i XXXX" to see what HB thinks the CC subtitles are, and then use some combination of "--subtitle" and "--subtitle-default" to put it in the destination file..
Post Reply