shannah / handbrake-watcher

CLI tool to watch folders and convert media files using Handbrake
24 stars 9 forks source link

Handbrake Watcher

Created by Steve Hannah

Synopsis

Handbrake Watcher is a command line tool that monitors a folder and all of its subfolders for media files with a designated extension (default .mkv) and transcodes them using the HandbrakeCLI command-line tool into a different codec (default mp4 with the 'High Profile').

Installation

Windows

You will first need to install a package manager called npm if you do not have it already. Download Once npm is installed on your computer, open a command prompt and run the following command:

> npm install -g handbrake-watcher

Once npm has installed Handbrake Watcher, you need to download the command line interface for Handbrake. Download Save the executable file in the directory where you will be running the Handbrake Watcher.

Mac/Linux You will first need to install a package manager called npm if you do not have it already. Download

$ sudo npm install -g handbrake-watcher

Once npm has installed Handbrake Watcher, you need to download the command line interface for Handbrake. Download On Mac, run the .dmg file and move the executable file, named HandbrakeCLI, to where you will be running the Handbrake Watcher.

Usage:

Open a terminal window and navigate to the directory you wish to watch. First create a 'handbrake.properties' file. Paste the contents as shown below.

source.extension=mp4 mkv
destination.extension=avi
handbrake.options.preset=Fast 1080p30

This will look for any .mp4 or .mkv file in the directory you are in and Handbrake the files into AVI format. Save and quit the file, then run:

$ handbrake-watcher

This will start the daemon, which will scan the entire directory and subdirectories every 5 minutes. When it is finished converting a file, it will delete the original. If it sees that a file was recently modified, it will not start executing Handbrake on the file until the file has not been modified in a long time.

Custom Configuration Options:

You can customize the operation of the watcher by placing a config file named 'handbrake.properties' in the directory that is being watched. Properties may also be overridden on the command line using -Dpropname=propvalue

If you are passing in properties through the command line and they are giving error messages or not applying, then put them into the 'handbrake.properties' file as shown in the Usage section.

The following configuration options are supported:

An example of a 'handbrake.properties' file is:

source.extension=mp4 mkv
destination.extension=avi
handbrake.options.preset=Fast 1080p30

Ignoring Directories

You can tell handbrake-watcher to ignore directories by adding an empty file named ".handbrake-ignore" inside the directory you wish to ignore.