X265 Windows example?

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
activoice
Posts: 3
Joined: Fri May 27, 2016 12:16 pm

X265 Windows example?

Post by activoice »

I've been looking for examples for X265 that I can run from a windows command prompt.

I understand the basic syntax but I don't see some of the options for X265 when I look at the FAQ.

Basically I want to translate the options that I use in the GUI into the command line so I can run it as a postprocessing script.

I am not changing the video resolution, no filters, on the video tab the options I have set are
Codec - H265
Quality - 20
Framerate - Same as Source (variable)
X265 Preset - Medium
X265 Tune - None
h.265 Profile - Main
Audio - copy the existing AC3 track

So it would be something like this
handbrakecli -i c:\temp\old.mkv -o c:\temp\new.mkv -e x265 -q 20 --vfr --x265-preset medium --x265-tune none --x265-profile main -E copy:ac3


But I don't see options in the FAQ for x265 tune, x265 preset or x265 profile... so maybe X265 encoding from the command line isn't possible yet? Or maybe it is and I just have the syntax wrong...
Deleted User 11865

Re: X265 Windows example?

Post by Deleted User 11865 »

--encoder-preset, --encoder-tune, --encoder-profile ;)
Deleted User 11865

Re: X265 Windows example?

Post by Deleted User 11865 »

For tune none, you may also not specify any tune, none is the default.
activoice
Posts: 3
Joined: Fri May 27, 2016 12:16 pm

Re: X265 Windows example?

Post by activoice »

Ok so that means it's this?

handbrakecli -i c:\temp\old.mkv -o d:\temp\new.mkv -e x265 -q 20 --vfr --encoder-preset medium --encoder-profile main -E copy:ac3


Also how would I specify a wildcard... like if I want to encode the entire source folder *.mkv to a different destination folder without having to enter a command line for each file name? Or is that not possible?
Woodstock
Veteran User
Posts: 4623
Joined: Tue Aug 27, 2013 6:39 am

Re: X265 Windows example?

Post by Woodstock »

Encoding more than one file requires scripting, external to handbrake. It's easy enough to do, but the details depend upon what command interpreter you are using. A lot of people use PowerShell in Windows, but it can be done with batch files in CMD.

The script would determine what files are in the directory, then call handbrake once for each one.
activoice
Posts: 3
Joined: Fri May 27, 2016 12:16 pm

Re: X265 Windows example?

Post by activoice »

So there's no built in way to say point handbrake to an input directory and an output directory... instead I would have to read in the name of each of the source files and then execute the command line with that source and destination file name..

Thanks for your help Rodeo and Woodstock
Woodstock
Veteran User
Posts: 4623
Joined: Tue Aug 27, 2013 6:39 am

Re: X265 Windows example?

Post by Woodstock »

For the command line, correct - there isn't anything built in.

However, if you search this section, there are examples of scripts written for several different command interpreters that will do what you're asking for.

I can't make specific recommendations because I don't use any of them.... but the ones intended for use with PowerShell would have more options than one written for CMD.EXE.

I use a text editor to create batch files for my needs. Here is an example of a batch file with argument substitution to process a single file from the command line. The input and output paths are hard-coded, because of how I do things:

Code: Select all

title "%~n1" & "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "Z:\Fairy Tail\%~n1.mkv" -t 1 -o "V:\Anime\dubbed\Fairy Tail\%~n1.mkv"  -f mkv --strict-anamorphic  -e x264 -q 20 --vfr  -a 1,2,4 -E faac,copy:ac3,faac -B 160,0,160 -6 dpl2,auto,dpl2 -R Auto,Auto,Auto -D 0,0,0 --gain=0,0,0 --audio-copy-mask none --audio-fallback ffac3 --subtitle 2,1 --markers="C:l\Temp\Fairy Tail HD-chapters.csv" -x ref=1:weightp=1:subq=2:rc-lookahead=10:trellis=0:8x8dct=0 --verbose=1
Called with an argument of "Fairy Tail HD001.mkv", it substitutes "Fairy Tail HD001" everywhere the "%~n1" is found.
Post Reply