This script is intended to be used as MythTV user job.
myth_make_x264.pl works similar to Mythbrake.
You will get a x264 / x265 encoded file in a matroska (.mkv) container.
The script has gone under heavy changes which were done as a "fast" solution for some problems which came up with mythtranscode as cutting tool. So the script is now always choosing projectx for cutting SD material and ffmpeg for HD material (which by the way now is supported by the script :)) Cutting HD recordings will not be precise if you have to cut a lot out of the middle of the recording. Chopping off content from the beginning and ending of a recording works pretty well. I borrowed some code for this from another script on the wiki (lossless transcode + subtitles) and altered some values. The script isn't as clean as it was beforehand, but should do its work :)
If you use different encoding qualities for different kind of recordings (like I do), you may start this script with the --quality option.
For example, I defined two user jobs
# -> x264 (LQ) /root/bin/myth_make_x264.pl --chanid=%CHANID% --starttime=%STARTTIME% --directory=%DIR% --file=%FILE% --quality=22 # -> x264 (HQ) /root/bin/myth_make_x264.pl --chanid=%CHANID% --starttime=%STARTTIME% --directory=%DIR% --file=%FILE% --quality=19
Take a look at the Handbrake documentation for more info on the quality setting of handbrake.
Important!
Take a close look at the "Config" section of the script and fit it to your needs / requirements.
I tried to document everything in detail in the comments.
myth_make_x264.pl --chanid=[int value] --starttime=[int value] --directory=[string value] --file=[string value] --quality=[int value] --verbose --chanid MythTV CHANID [REQUIRED] --starttime MythTV STARTTIME [REQUIRED] --directory MythTV storage directory [REQUIRED] --file MythTV filename of recording [REQUIRED] --quality Constant Quality factor [51..0] used by handbrake Look up 'https://trac.handbrake.fr/wiki/ConstantQuality' for more information [OPTIONAL] defaults to $videoQualityDefault --threads Number of threads x264 will utilize for encoding Look up 'http://mewiki.project357.com/wiki/X264_Settings#threads' for more information [OPTIONAL] integer / floating point number, defaults to 'auto' --noCrop Disable auto image cropping by handbrake [OPTIONAL] toggle --verbose Write output of mythtranscode, handbrake and mkvmerge to logfile [OPTIONAL] toggle For installation as mythtv user job, it may be called like this: ../myth_make_x264.pl --chanid=%CHANID% --starttime=%STARTTIME% --directory=%DIR% --file=%FILE% --threads=1
Changing ownership of target file
The init script for your distribution will usually start mythbackend as non-privileged user (eg. mythtv). I run mythbackend as root, which allows this user job to set ownership of the final encoded file to another user.
If you wish to skip changing ownership after encoding, just empty the variable $fileOwner like this:
my $fileOwner = "";
If you dislike running mythbackend as root but would like to use this feature, you might want to setup sudo for your mythtv user and allow him to chown files in your target directory.
sudo mini-howto
Execute visudo command (you will have to be root to do this):
# visudo
Your sudoers file will show up in your preferred editor. Just add a line for your mythtv user which allows him to change ownership of files in your target directory without password.
mythtv ALL=NOPASSWD: /bin/chown *\:* /data/movies/x264/[^..]*
Save and quit your editor.
Page 2 of 3