Project

General

Profile

Actions

Handbrake Interface Project

Handbrake is a pretty awesome encoder front end. It has a CLI and the idea for this project is to build a control daemon, including an encode queue.

Test and Other Useful Commands

These require curl and jq to be installed.

curl -s -X GET http://brutus:8081/queue | jq

curl -s -X POST -d "{"type": "add", "path": "/mnt/phalanx/key.txt"}" http://brutus:8081/command | jq

The following would clip the first 30 seconds, and then clip everything that is 10 seconds after that:

ffmpeg -ss 00:00:30.0 -i input.wmv -c copy -t 00:00:10.0 output.wmv
ffmpeg -ss 30 -i input.wmv -c copy -t 10 output.wmv

Enhancements

  • Make encode parameters optionally configurable
  • Detect subtitles in source content and handle them appropriately
  • Appropriate user configuration for systemd (so service starts at boot)
  • Install script
    • Need to check for and install prereqs if needed
    • Detect if module install (setup.py install) fails and exit script
  • Create logrotate configuration (cannot stop encode during)
  • Add script to get status of current encode only
  • Improve security (use https mayhaps???)
  • Turn off after configurable period of inactivity
  • Send email when encodes are completed
  • Display time queued in log
  • Include initial and final file sizes in encode complete email

I'm going to attempt to work on this little by little and add things as I go...

Version History

v0.4.0 -- 2/24/2019

  • feature: added initial and final file sizes in encode complete email

v0.3.0 -- 1/25/2019

  • feature: added logrotate configuration for hbkcd.log

v0.2.0 -- 1/24/2019

  • bugfix: queued duration fixed to be encode start minus time added
  • feature: added optional email confirmation when encode is complete
  • feature: added script (hbkcd_status) to get status of current encode
  • feature: modified install.sh script to check for package and Python module dependencies and install any that are missing

v0.1.3 -- 1/23/2019

  • bugfix: order of arguments when calculating elapsed time duration fixed so durations are no longer negative

v0.1.2 -- 1/11/2019

  • Fixed bug in hbkcd_add.sh script that prevented adding paths with spaces
  • Added item queued time to log
  • Created simple install script

v0.1.1 -- 1/8/2019

  • Fixed audio encode option bug when converting to AAC
  • Added per file encode log containing the output of !HandBrake (very useful for debugging issues like the one above)

v0.1.0 -- 1/8/2019

  • Basic daemon with systemd support
  • JSON over HTTP Control interface supports add and list of encode queue
  • Use ffprobe to determine size and framerate of input and set accordingly
  • Encode source video with default parameters (h.265; AAC) using !HandBrake

Install

Also required are HandBrakeCLI and (statically linked) ffprobe.

$ sudo ./install.sh

Old Install Instructions:

  • Packages:
    $ sudo apt install python3-setuptools python3-pip libmagic-dev
    
  • Python modules:
    $ sudo pip3 install python-magic
    
  • Run setup.py:
    $ sudo ./setup.py install
    

Resources

Updated by over 4 years ago · 1 revisions