Page 1 of 1

Could use some help with my script

Posted: January 27th, 2017, 12:27 pm
by beardbro
Started working on my first post processing script yesterday and I'm a bit stuck. I'll share my setup to give some background context. I'm running a plex server on windows 10, with couchpotato and sonarr. For a while I had plex doing the transcoding, but as most of you probably know, it saves the transcoded file in a plex versions folder, resulting in 2 videos. As such, I'm using up a lot of unnecessary hard drive space (13TB/16TB, thinking I can probably half that).

So, I started looking into automating with handbrake and kept coming across Don Melton's vidoe-transcoding tool (Apparently only established users can post links, so you'll have to google it). Figured I'll try and set my post processing script up with it. I got the repo setup fine, and ran a couple test inside of powershell, everything is working. Last night I spent a couple hours messing around with post processing script. Started out with a batch file and realized that it's very powerful, so I've switched to a python file. I'm running python 3.5.6.

Since couchpotato and sonarr handle moving/renaming the files, all I really want to do is run the media through a simple "transcode-video --mp4 [video-file]" command, and let everything else remain the same.
  • couchpotato/sonarr/manual download kicked off
    download & unpack completes
    transcode-video runs
    sabnzbd puts transcoded video in download folder
    couchpotato/sonarr handle move/rename
I thought this would be simple. Anyway, after a lot of messing around I've got the script running, but I was having this issue at first

Code: Select all

os.system("transcode-video --mp4 sys.argv[1]")
sabnzd logs

Code: Select all

'transcode-video' is not recognized as an internal or external command, operable program or batch file.
So I looked at some other scripts and thought I should try this instead

Code: Select all

transcode_cmd = "C:/Ruby22/bin/transcode-video"
file = sys.argv[1]
subprocess.run([transcode_cmd, '--mp4', file], stdout=subprocess.PIPE, shell=True)
sabnzd logs

Code: Select all

C:/Ruby22/bin/transcode-video: HandBrakeCLI not available
That was around 2am last night, so I decided to go to sleep. So, any help will be much appreciated. Thanks.

Re: Could use some help with my script

Posted: February 1st, 2017, 4:07 pm
by NoTolerance
Shot in the dark here:

So your error is suggesting that either you don't have the HandBrakeCLI installed or it's missing from your PATH environment variable.
You can download the command line version of HandBrake, called HandBrakeCLI, here:

https://handbrake.fr/downloads2.php
When installing HandBrakeCLI or other downloaded programs, make sure the executable binary is in a directory listed in your PATH environment variable.