Closed dorgan closed 7 years ago
@dorgan Woof. This is a hard one because I can't see the setup on your device.
The error code of 255
is just a generic failure passed through from HandBrakeCLI
itself.
But, this is very likely a permissions or path error. Possibly both. Why? Because that's usually what happens when you switch users. So, you really need to verify that the runtime environment—the permissions and path—are the same for both users.
One thing you should stop doing is using fully qualified paths for calling executables in your script because internally those programs won't do that for whatever they call. They'll just depend on $PATH
being setup correctly.
Other than that, I'm not sure how much I can help with this. Sorry about that.
Ok I will remove the fully qualified path. And add some debugging such as outputting $PATH and see if I can track it down that way. Guess I could also come up with a crib that check for .ts files, which is what Plex creates and then converts to .mkv.
On Wed, Sep 20, 2017 at 9:59 PM Don Melton notifications@github.com wrote:
@dorgan https://github.com/dorgan Woof. This is a hard one because I can't see the setup on your device.
The error code of 255 is just a generic failure passed through from HandBrakeCLI itself.
But, this is very likely a permissions or path error. Possibly both. Why? Because that's usually what happens when you switch users. So, you really need to verify that the runtime environment—the permissions and path—are the same for both users.
One thing you should stop doing is using fully qualified paths for calling executables in your script because internally those programs won't do that for whatever they call. They'll just depend on $PATH being setup correctly.
Other than that, I'm not sure how much I can help with this. Sorry about that.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/donmelton/video_transcoding/issues/167#issuecomment-331029283, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcX01ggaTNObHN6dShsAUWqQQKt_fxcks5skcMIgaJpZM4PerYL .
@dorgan Sounds like a good plan! Let me know how it goes. I'll leave this open so you can discuss your findings. They may be helpful to others. And I'm sure I'll learn something from it.
Good hunting!
Don't know if this will help but here's a script I use to process files. I create a script for each movie but the only think I edit is the crop information. If it finds a CSV file it adds that to the command line as the chapter names.
Because of how I lay out my rips folder structure, the movies are in a directory that is the full name of what I want the Plex movie to be named. So while it may convert an MKV named "title00.mkv" it'll name it after the directory it's in "Dredd (2012).m4v", it then moves the file into my Plex library.
It assumes the find command will return one mkv file, it doesn't loop through them all.
I retain the script for each movie to save the crop information if I ever want to re-rip.
#!/bin/bash
plexmovies="/Volumes/Data/Media/Plex/Movies/"
# use chapterinfo to show number of chapters in mkv
# use detect-crop to get crop numbers below
crop="0:0:240:240"
mkvfile=$(find . -iname "*.mkv")
mkvfilename=$(basename "$mkvfile")
# csv file contains chapter names
csvfile=$(find . -iname "*\.csv")
csvfile=$(basename "$csvfile")
curdir=${PWD##*/}
outfile="$curdir.m4v"
if [ "$csvfile" != "" ]; then
transcode-video --crop $crop "$mkvfilename" --chapter-names "$csvfile" --m4v -o "$outfile"
else
transcode-video --crop $crop "$mkvfilename" --m4v -o "$outfile"
fi
thisdir=$(basename -s ".m4v" "$outfile")
plexdest="$plexmovies$thisdir/"
if [ ! -d "$plexdest" ]; then
mkdir "$plexdest"
fi
mv "$outfile" "$plexdest"
Thanks, @kvanh! That could be helpful to @dorgan.
I do something similar, but I keep the crop information, e.g. 0:0:240:240
, in a separate file indexed by the name of the video. That way the script doesn't have to change for each video.
OK so I have check permissions as well as tried out a different script, which utilizes FFMPEG. @kvanh the whole point of this script is it works on any faile and is something that plex runs after each recording. I tried to add some verbose output to get more information as to whats going on and still this is the only output I get based on the following script:
Sep 25 16:19:55 organ-media1 sh[31966]: Starting
Sep 25 16:19:55 organ-media1 sh[31966]: CMD: transcode-video --quick "/video/TV/.grab/84d3a060aa1170aad4216feb532284502cc58f50/Eyewitness News at 4pm (2013) - 2017-09-25 00 00 00 - Episode 09-25.ts" -o "/video/TV/.grab/84d3a060aa1170aad4216feb532284502cc58f50/Eyewitness News at 4pm (2013) - 2017-09-25 00 00 00 - Episode 09-25.mkv"
Sep 25 16:19:55 organ-media1 sh[31966]: transcode-video 0.17.3
Sep 25 16:19:55 organ-media1 sh[31966]: Copyright (c) 2013-2017 Don Melton
Sep 25 16:19:56 organ-media1 sh[31966]: /usr/local/bin/transcode-video: HandBrakeCLI failed during execution
Sep 25 16:19:56 organ-media1 sh[31966]: ERROR # 255 : Failed to convert file /video/TV/.grab/84d3a060aa1170aad4216feb532284502cc58f50/Eyewitness News at 4pm (2013) - 2017-09-25 00 00 00 - Episode 09-25.ts
Script:
#!/bin/bash
# ------------------------------------------------------------------
PGMNAME=HandBrakeCLI
check_errs()
{
if [ "${1}" -ne "0" ]; then
echo "ERROR # ${1} : ${2}"
exit ${1}
fi
}
BASEPATH=$(dirname "$1")
BASEFILE=$(basename "$1")
FILENAME="${BASEFILE%%.*}"
echo "Starting"
echo "CMD: transcode-video --quick \"$1\" -o \"$BASEPATH/$FILENAME.mkv\""
transcode-video -v "$1" -o "$BASEPATH/$FILENAME.mkv"
check_errs $? "Failed to convert file $1"
echo "Removing original file."
#rm -f "$1"
check_errs $? "Failed to remove original file $1"
echo "Cleaning up"
#rm -f "$BASEPATH/$FILENAME.mkv.log"
echo "Renaming new video to old name"
mv "$BASEPATH/$FILENAME.mkv" "$1"
check_errs $? "Failed to rename new file to original file name $1"
OK so I put together another script that uses HandBrakeCLI directly and noticed its outputting the following:
Sep 25 16:37:23 organ-media1 sh[31966]: ********************************************************
Sep 25 16:37:23 organ-media1 sh[31966]: Transcoding, Converting to H.264 w/Handbrake
Sep 25 16:37:23 organ-media1 sh[31966]: ********************************************************
Sep 25 16:37:24 organ-media1 sh[31966]: HandBrakeCLI: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by HandBrakeCLI)
Sep 25 16:37:24 organ-media1 sh[31966]: HandBrakeCLI: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libbluray.so.2)
Sep 25 16:37:24 organ-media1 sh[31966]: HandBrakeCLI: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libbluray.so.2)
Sep 25 16:37:24 organ-media1 sh[31966]: HandBrakeCLI: relocation error: /usr/lib/x86_64-linux-gnu/libavfilter.so.6: symbol avpriv_do_elbg, version LIBAVCODEC_57 not defined in file libavcodec.so.57 with link time reference
Sep 25 16:37:24 organ-media1 sh[31966]: ********************************************************
When I had this error with FFMPEG I have to compile from source. However running transcode-video form the command line works just fine both as the user I log in as and as the plex user it works just fine.
GOT IT. Handbrake must have been messed up via shared libraries or something. Installed handbrake via the official PPA for ubuntu and its working.
So currently i have a DVR transcode script
And when i execute that on a file as the plex user it works just fine. However when plex tries to do it, it is getting the following error /usr/local/bin/transcode-video: HandBrakeCLI failed during execution the exit code is 255