Automates video encoding using HandBrakeCLI.
- Download a release from the Releases area and extract to
C:\VideoEncodingAutomation\or another location of your choosing. - Put HandBrakeCLI somewhere, e.g.
C:\VideoEncodingAutomation\HandbrakeCLI.exe. - Put ffmpeg binaries (.exe, .dll, etc) in
C:\VideoEncodingAutomation\ffmpeg\. I like the full build (gpl) shared version for win64 from here. - Put MediaInfo CLI somewhere, e.g.
C:\VideoEncodingAutomation\MediaInfo.exe. - Download starter encoder configurations from here. Create a folder somewhere that you have a lot of disk space, and extract the encoder configurations there. You should now have a simple directory structure, e.g.
C:\
-> Encode
-> in
-> q18
-> q20
-> q23
-> q23-allaudio-allsubs
-> q23-allsubs
-> q23-SmartCrop
-> q23-SmartCrop-allaudio-allsubs
-> q23-SmartCrop-allsubs
-> q26
The way this works is you drop video files into any of these input folders (q18, q20, etc) and the VideoEncodingAutomation process will automatically transcode the video according to the settings defined in encoder.txt within the folder. Output goes in an out folder next to the in folder.
As an example, here is the encoder.txt from q23-SmartCrop.
{
"Encoder": "handbrake",
"VideoEncoder": "x265",
"VideoEncoderPreset": "medium",
"Quality": 23,
"HandbrakeCrop": "Smart",
"AudioTrackSelection": {
"AllTracks": false,
"AllTracksNoCommentary": false,
"AllEnglish": false,
"AllEnglishNoCommentary": false
},
"SubtitleTrackSelection": {
"AllTracks": false
},
"LimitedRange": false,
"StartTimeSeconds": 0,
"DurationSeconds": 0,
"KeepInputForDebuggingAfterward": false
}"Encoder": "handbrake"instructs the app to use handbrake (currently this is the only allowed value of the field)VideoEncodercan be"x265"or"x264"or"av1"VideoEncoderPresetcan be any of the encoder presets defined by the codec. See HandBrakeCLI documentation.Qualityis the constant rate factor number defined by the codec. See HandBrakeCLI documentation. Forx264andx265, the range is0-51(lower is better quality), and a commonly used range is18-23. Forav1, the range is0-63(lower is better quality) and a commonly used range is24-28.HandbrakeCropdefines a value for HandbrakeCLI's--cropargument. It could be"0:0:0:0"to do no cropping,"280:280:0:0"to remove 280 rows from the top and bottom,""to let handbrake crop automatically, or"Smart"to use my own custom cropping calculations which are especially conservative (high priority on preserving all image data, even at the cost of some black rows remaining).KeepInputForDebuggingAfterwardis for debugging or testing purposes. If it is false, the input videos are DELETED after transcoding has completed. When using"KeepInputForDebuggingAfterward": true, it is advised to also setLimitedRangeto true in order to use the"StartTimeSeconds"and"DurationSeconds"arguments in order to transcode small samples of video in relatively little time.
- Run
VideoEncodingAutomation.exeonce, and then close it.Settings.cfgwill be created. - Open
Settings.cfgand configure as needed.
<?xml version="1.0"?>
<Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<videoStorageDir>C:\Encode\</videoStorageDir>
<handbrakePath>HandBrakeCLI.exe</handbrakePath>
<webPort>14580</webPort>
<mediaInfoCLIPath>MediaInfo.exe</mediaInfoCLIPath>
</Settings>- Run
VideoEncodingAutomation.exeagain. You can view the web interface viahttp://localhost:14580/
I haven't tried in a long time, but this application may still work on Linux via mono if you are so inclined.
Open the .sln file with the latest Visual Studio Community Edition. You'll need to get a copy of my BPUtil library and repair the project references to this.