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.
Description of problem or question:
I have a folder with a lot videos. I want to use HandBrakeCLI to re-encode all of them using the "H.265 MKV 720p30" preset. I also want to:
include all of the audio tracks in the source video and, if necessary, down-mixed them to Stereo
include all of the sub-title tracks in the video and, if there is an SRT file in the folder with the same name as the source, then add that as an English subtitle track
I am looking through the command line options but not able to figure out which ones I need. Any help is greatly appreciated.
HandBrake version (e.g., 1.0.0):
1.0.1
Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):
Ubuntu 18.04
Thank you. This worked for the most part. Goal was to have 2 hour movies be roughly 2 GB and it worked for like 70% of the videos. Need to figure out why the rest are still like 4-6 gigs.
I wish there were some documented "best" settings for HandBrakeCLI to get ~2 GB videos for archival purposes. :/
Quality-based encoding causes the bit rate to vary, sometimes dramatically increasing in the case of complex, high motion, and/or noisy/grainy video. Most likely your larger encodes could benefit from some noise reduction.
You can also specify a target bit rate and 2-pass encoding if you want to achieve a specific size, but we generally do not recommend this except in limited scenarios. Storage is cheap.
And I know storage is cheap but I'm trying to keep some very special videos as backup in a limited storage area as a worst-case scenario in case all my main backups fail.
The script loops through all of the mkv files in a folder. If all of your movies are in Z then you'll either need to update the script to look in Z or change to Z before you run the script.
Also, this script is for Linux and it sounds like you're on Windows. It won't work on Windows.
If you're dealing with ISO files of DVD or Bluray disks, they contain multiple titles on each, which will make it harder for a script to "just" do the "important" files. That is why most people extract the important video to other containers, with MKV being rather popular.
On the MakeMKV forum, users have contributed scripts to read ISO files and create MKV files, which would probably be the best first step in your process. You can specify a minimum length for titles to convert.