Project

General

Profile

HandbrakeCommandDaemon » History » Version 1

Anonymous, 12/19/2021 04:55 PM
adding original page

1 1
h1. Handbrake Interface Project
2
3
"Handbrake":https://handbrake.fr/ 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. 
4
5
h2. Test and Other Useful Commands
6
7
These require @curl@ and @jq@ to be installed.
8
<pre>
9
curl -s -X GET http://brutus:8081/queue | jq
10
11
curl -s -X POST -d "{"type": "add", "path": "/mnt/phalanx/key.txt"}" http://brutus:8081/command | jq
12
</pre>
13
14
The following would clip the first 30 seconds, and then clip everything that is 10 seconds after that:
15
<pre>
16
ffmpeg -ss 00:00:30.0 -i input.wmv -c copy -t 00:00:10.0 output.wmv
17
ffmpeg -ss 30 -i input.wmv -c copy -t 10 output.wmv
18
</pre>
19
20
h2. Enhancements
21
22
 * Make encode parameters optionally configurable
23
 * Detect subtitles in source content and handle them appropriately
24
 * Appropriate user configuration for systemd (so service starts at boot)
25
 * -Install script-
26
 ** -Need to check for and install prereqs if needed-
27
 ** Detect if module install (@setup.py install@) fails and exit script
28
 * -Create logrotate configuration (cannot stop encode during)-
29
 * -Add script to get status of current encode only-
30
 * Improve security (use https mayhaps???)
31
 * Turn off after configurable period of inactivity
32
 * -Send email when encodes are completed-
33
 * -Display time queued in log-
34
 * -Include initial and final file sizes in encode complete email-
35
36
I'm going to attempt to work on this little by little and add things as I go... 
37
38
h2. Version History
39
40
*v0.4.0 -- 2/24/2019*
41
42
 * feature: added initial and final file sizes in encode complete email
43
44
*v0.3.0 -- 1/25/2019*
45
46
 * feature: added logrotate configuration for @hbkcd.log@
47
48
*v0.2.0 -- 1/24/2019*
49
50
 * bugfix: queued duration fixed to be encode start minus time added
51
 * feature: added optional email confirmation when encode is complete
52
 * feature: added script (hbkcd_status) to get status of current encode
53
 * feature: modified @install.sh@ script to check for package and Python module dependencies and install any that are missing
54
55
*v0.1.3 -- 1/23/2019*
56
57
 * bugfix: order of arguments when calculating elapsed time duration fixed so durations are no longer negative
58
59
*v0.1.2 -- 1/11/2019*
60
61
 * Fixed bug in @hbkcd_add.sh@ script that prevented adding paths with spaces
62
 * Added item queued time to log
63
 * Created simple install script
64
65
*v0.1.1 -- 1/8/2019*
66
67
 * Fixed audio encode option bug when converting to AAC
68
 * Added per file encode log containing the output of !HandBrake (very useful for debugging issues like the one above)
69
70
*v0.1.0 -- 1/8/2019*
71
72
 * Basic daemon with systemd support
73
 * JSON over HTTP Control interface supports add and list of encode queue
74
 * Use ffprobe to determine size and framerate of input and set accordingly
75
 * Encode source video with default parameters (h.265; AAC) using !HandBrake
76
77
h2. Install
78
79
Also required are HandBrakeCLI and (statically linked) ffprobe.
80
81
<pre>
82
$ sudo ./install.sh
83
</pre>
84
85
h3. Old Install Instructions:
86
87
* Packages:
88
<pre>
89
$ sudo apt install python3-setuptools python3-pip libmagic-dev
90
</pre>
91
* Python modules:
92
<pre>
93
$ sudo pip3 install python-magic
94
</pre>
95
* Run @setup.py@:
96
<pre>
97
$ sudo ./setup.py install
98
</pre>
99
100
h2. Resources
101
102
* https://trac.ffmpeg.org/wiki/FFprobeTips
103
* https://stackoverflow.com/questions/13069634/python-daemon-and-systemd-service
104
* https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6