Search This Blog

Monday, 13 September 2010

Aussies - Do you want to get our software Free and help a good cause?

Are you from Down Under? Do you want to support YoungCare Australia?

If you make a donation of at least $50 AUD to my niece Mira Koopman (who lives in Australia), you can get a free license of our software. When you make your donation on Mira's Anything-a-Thon donation page, and mention "GDP" somewhere in your published comments, I will be happy to give you a free license of our software.

This offer is valid until October 1st, 2010.

About YoungCare

Currently over 6,500 young Australians are forced to live in aged care facilities, simply because there are few alternatives.

Youngcare's aim is to raise awareness of this national issue by driving change to create real choices in care options for young Australians with full-time care needs. To find out more, visit: www.youngcare.com.au

Gert Rijs,
Owner of GdP Software

Saturday, 11 September 2010

Automatic Video Transcoding with HandbrakeCLI

Q&A

A customer, Kai, asked a few questions on our forum how he could configure WatchDirectory's Start any Program task to run Handbrake on newly detected video files. He was able to figure out most of it himself (what do *I* know about video conversion?) after a few tips.

HandBrake is a highly popular open-source, GPL-licensed, multiplatform, multithreaded video transcoder, available for MacOS X, Linux and Windows. It includes a command line version, called HandbrakeCLI which allows for easy automation when used together with WatchDirectory or File Viking's Run Action.

Settings

Here you see Kai's setting for his WatchDirectory task. He uses a rather long line for "Parameters for this program", so here is the plain text version:

-i "%WD_FILE%" -f mp4 -w 720 -l 400 -e x264 -b 1000 -2
     -a 1 -E faac -6 dpl2 -R 48 -B 128 -D 0.0 -v 1
     -o "C:\Converted Videos\%WD_FILE_B%.mp4"

I added a few linebreaks, but obviously they should be on 1 line. You will notice he uses 2 variables:

  • %WD_FILE% - this will be replaced by the full path of the detected file by WatchDirectory.
  • %WD_FILE_B% - this will be replaced by just the name of the detected file.

The full list of supported variables

Important Setting

When you are transcoding videos with Handbrake and WatchDirectory like this, please be aware that video transcoding is a very slow, time consuming process. WatchDirectory has no way of knowing if a program started by it is "hanging" or just busy working. In this case Kai has set "Wait for program to exit" to 14400 seconds (4 hours), which should be more than enough if you run this on a reasonably modern computer. If you set this too low, WatchDirectory will "kill" the Handbrake process prematurely.

If you disable "Wait for program to exit" and multiple video's are detected by WatchDirectory, WD will start multiple Handbrake processes to transcode multiple video files. This is only advised for the most powerful computers.

If you use File Viking

File Viking's Run Action can also run HandbrakeCLI, but its environment variables have slightly different names:

  • %FV_FILE% - this will be replaced by the full path of file you dropped on the File Viking basket.
  • %FV_FILE_B% - this will be replaced by just the name of the dropped file.

File Viking currently always waits for the program to exit, there is no need to set a timeout.