Git Product home page Git Product logo

plexpostproc's People

Contributors

apassiou avatar ashleyprimo avatar dorgan avatar nebhead avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plexpostproc's Issues

tweaks to the script?

Great script, thank you. It seems that the filename contains the same extension, even after conversion. So I end up with a .ts file even after creating an .mkv file. Is this intentional?

Also, I'm having some permissions issues, is there a way to make sure the script runs as super-user?

(QUESTION)

Hi ,

i use plex on unraid with a docker and i need to reinstall handbrake in the plex docker each time the plex as a new version has install.

My question 1 : how i can fix this ?
My question 2: I can use the handbraker docker in unraid ?

your script is magic but i need to install handbrake in the plex docker with the terminal ..
thx

Failed to Move

Just updated to the new sript and at first I was getting error 1, then it would run constantly, now i'm getting a failed to move error.

"Finished transcode,ERROR # 1 : Failed to move converted file: /tmp/tmp.zzWHyMdI08.mkv"

Made sure it was CHMOD +x, 777 and owned by plex:plex

I must have missed something simple...

Ubuntu 18.04

Queue the encoder!

I was having issues with five or more HandBrakeCLI processes getting kicked off and bogging my system down, or also encodes getting lost in a reboot. I've added a queue system that you might want to check out. I also thought adding an encode log would be nice.

I've thrown together the following shell scripts and call encodequeue.sh with a cron job (*/30 * * * *
home/[user]/PlexPostProc/encodequeue.sh). The execdir variable will need to be changed in the shell scripts. Call enqueue.sh from Plex.

enqueue.sh

#!/bin/sh
execdir="/home/[user]/PlexPostProc"

if [ ! -z "$1" ]; then

    echo "$execdir"/PlexPostProc.sh $1>>"$execdir"/queue.txt

else
   echo "Usage: $0 FileName"
fi

encodequeue.sh

#!/bin/sh
execdir="/home/[user]/PlexPostProc"
#
timestamp=$(date "+%Y%m%d-%H%M%S")
if pgrep -x "HandBrakeCLI" > /dev/null
then
    echo "HanBrakeCLI is already working"
else
    echo "HanBrakeCLI stopped, let's do some work?"
    # run first line of queue
    encodejob=$(head -n 1 "$execdir/queue.txt")
    if [ -n "$encodejob" ]; then
        echo "$timestamp: $encodejob" >> "$execdir/encode.log"
        echo "Running: $encodejob"
        $encodejob
    # remove line from queue
        sed '1d' "$execdir/queue.txt" > "$execdir/tmpfile"; mv "$execdir/tmpfile" "$execdir/queue.txt"
    fi
fi

Hardware encoding

Does your post processing script allow for usage of intel quicksync?

Feature Request - Not Issue

You think about possibly adding Comskip to this script, so it removes the commercials first than transcodes the file? That would be great. I'm still testing this out at the moment.

Thanks, keep up good work.

Permissions

i'm missing something dumb here. When Plex runs the script it fails, when I run the script as my login user I get a permission denied on cleanup.

the containing folder of the .ts file is set to plex:plex and I added my login user to the plex group and still permission denied.

any help is much appreciated!

ppplock file issue

Script works (however I heavily customized ffmpeg string for my own needs, such as downconverting to stereo, AAC 112kbps and lowering framerate from 60 to 24 in order to save space).

However looking at the workaround function, mine was stuck in forever waiting loop waiting for .ppplock files to go away. I dont know how or why I had some in the directory (there was zero activity on Plex) but script only finished when I manually deleted them via ssh.

I modified this block in 2 ways:

  1. increased check time to 60 seconds from 5, as to not spam the log.
  2. added a timeout, where after 2 hours it will give up and proceed to the end of the script. I figure 2 hours is more than enough for whatever created ppplock legitimately to be done. And I want to avoid a situation where my DVR recordings never show up because the conversion script is stuck.
  # [WORKAROUND] Wait for any other post-processing scripts to complete before exiting.
   timeout_counter=120
   while [ true ] ; do
     if ls "$TMPFOLDER/"*".ppplock" 1> /dev/null 2>&1; then
       if  [[ $timeout_counter -eq 0 ]]; then
           echo "Timeout reached, ending wait" | tee -a $LOGFILE
           break
       fi
       echo "$(date +"%Y%m%d-%H%M%S"): Looks like there is another scripting running.  Waiting." | tee -a $LOGFILE
       timeout_counter=$((timeout_counter-1))
       sleep 60
     else
       echo "$(date +"%Y%m%d-%H%M%S"): It looks like all scripts are done running, exiting." | tee -a $LOGFILE
       break
     fi
   done

writes out as mkv instead of mp4

Hi
I noticed that the script was actually writing the new file out as mkv rather than mp4 so checking the script I see that the below line:

mv -f "$TEMPFILENAME" "${FILENAME%.ts}.mkv" # Move completed temp to original filename

should be
mv -f "$TEMPFILENAME" "${FILENAME%.ts}.mp4" # Move completed temp to original filename

QUESTION: Any way to keep subtitles?

I'd love to be able to keep subtitles in my file after processing but I'm not sure how to keep them in. Any of the options I've found online for both handbrake and ffmpeg have both either caused it to not output a file or didn't output the file with subs. Any ideas?

support 480?

i don't care about resolution for my dvr recordings - i just want them crushed down as much as possible - if i set res to 480 will that break the script?

feature request - add HW accelleration

i'm tinkering and trying to see if i can get it working - but currently am unable to test because my nvidia quadro is sitting on the shelf and won't be delivered until my buddy travels across contry - figured it would make life much easier when using h265 as your encoding choice

thought i might reach out to see if you are already looking at using hwaccel - but im a wicked ffmpeg novice and since i don't have a test bed yet ....

Possible to NOT delete the original file for trouble shooting?

I'm having a weird issue where my DVR recordings are not complete. Each recording is missing chunks within the episode it records. The beginning and end are intact but there are plays where the video seems to skip several minutes of the show (almost as if ComSkip were running on the video and doing a terrible job - except I'm not using ComSkip). Can I set this script to NOT erase the original so that I can check where in the process the breakdown is happening?

Postprocessing not working on Mac

I'm using the FFMPEG branch and the post processing script fails. Exits with an error code 127 and just copies the unconverted file into my library. Has anyone seen this before and know of a solution?

Nov 21, 2017 08:00:58.706 [0x70000c283000] DEBUG - Job running: '/Users/colinsteele/PlexPostProc/PlexPostProc.sh' '/Volumes/Plex/Plex/Videos/TV Shows/.grab/88ecb30f6e0a3c720622d9c92a6a8fb936094309/Parking Wars (2008) - S06E07 - Episode 7.ts'
Nov 21, 2017 08:00:58.718 [0x70000c283000] DEBUG - Jobs: '/Users/colinsteele/PlexPostProc/PlexPostProc.sh' exit code for process 62152 is 127
Nov 21, 2017 08:00:58.718 [0x70000c283000] ERROR - DVR:Recorder: Postprocessing script '/Users/colinsteele/PlexPostProc/PlexPostProc.sh' exited with error code 127.
Nov 21, 2017 08:00:58.722 [0x70000ccbf000] DEBUG - DVR:Grabber: Postprocessing, we're going to put `Parking Wars - E7 - Episode 7` in `/Volumes/Plex/Plex/Videos/TV Shows/Parking Wars (2008)/Season 06/Parking Wars (2008) - S06E07 - Episode 7.ts`
Nov 21, 2017 08:00:59.458 [0x70000ccbf000] DEBUG - DVR:Grabber: Operation for Parking Wars - E7 - Episode 7 completed with status error (An error occurred while postprocessing the recording)
Nov 21, 2017 10:32:07.957 [0x70000c71e000] DEBUG - Request: [127.0.0.1:55249 (Loopback)] PUT /livetv/dvrs/13/prefs?startOffsetMinutes=0&endOffsetMinutes=0&useUmp=false&postprocessingScript=%2FUsers%2Fcolinsteele%2FPlexPostProc%2FPlexPostProc.sh&increasedRefreshes=false (11 live) GZIP Signed-in Token (Man0f5tee1e)
Nov 21, 2017 10:32:07.979 [0x70000b63b000] DEBUG - Completed: [127.0.0.1:55249] 200 PUT /livetv/dvrs/13/prefs?startOffsetMinutes=0&endOffsetMinutes=0&useUmp=false&postprocessingScript=%2FUsers%2Fcolinsteele%2FPlexPostProc%2FPlexPostProc.sh&increasedRefreshes=false (11 live) GZIP 21ms 3066 bytes (pipelined: 1)

60 fps converting to 24 fps

I just started using this script today.

I've noticed that it's converting my MPEG2 OTA recordings from 60fps down to 24. I'm guessing that's not the intended behavior?

Getting Error 127 when using this file.

Hi,

I am using Debian 10 / Not using Docker so directory install Plex Media Server version Version 1.20.1.3252

I am getting this error when I try and use this file.
20210802-220206: Starting transcode of /media/nas/TV/TV/.grab/7b923c65a4363383d3a2d730606ff161462de4d6-4488fda215b35da7d4567b111aaa1b37ed1039b1/T$
You have selected HandBrake
ERROR # 127 : Failed to convert using Handbrake.

What am I doing wrong here?

Thank you

LICENSE.md file

Hi, I just forked the repo after finding this and am going to try to make some contributions.

What license is this software under? I would assume anything will do. GPL, MIT, Unlicense, CC. perhaps even the WTFPL?

Problems with multiple encodes

I'm having an issue with Plex and this script (the ffmpeg one). When I try and record 1 DVR channel this works. When I try to simultaneously record 2 different DVR channels, the second recorded episode folder has no file. Plex gives an error saying silly script deleted the file.

I can see that both files are being written to by Plex in the .grab folder, and then when the first file is converted and written it seems to kill off the second ffmpeg as the .grab file for the second recording just disappears.

Failed to Move Converted File

I just switched to using the flatpak Handbrake so I could keep the subtitles and moved my Plex libraries to /Plex/TV Shows (or movies or music etc.). However, when I'm trying to use this script, I keep getting the error, "ERROR # 1 : Failed to move converted file: /tmp/tmp.lCUfgU3rAd.mkv" and plex says that it couldn't move the recorded media to the destination. The Handbrake log shows the file as completing its encoding, so it seems like it's an issue with the script moving the file back. Plex has ownership and I chmod 777 all the folders its working in, so it seems like it's not a permissions issue, not sure what could be the problem.

How to pass it the Plex Filename

So I have got the script figured out the point where if i run it manually and put the location and filename of the file after the PlexPostProc.sh it will convert it without issues. If I put the location of the script in my Plex PostProcessing settings for the DVR (including the full Linux path and filename which has been chmod 777) it will error code 1 every time. When I look at the plex log it just seems like the filename is not being passed from plex to the script so how is that supposed to be done? I have googled until my eyes are bleeding for Plex Post Processing switches, parameters, etc and find nothing.

QUESTION: Subtitle Passthru?

I don't know much about Handbrake, but I am trying to tweak your .sh to work for Windows using a VERY simple .bat.

Looking at the Handbrake parameters, will it pass thru the subtitles (aka - Closed Captioning) that PlexDVR/HDHomeRun put into the .ts?

Looks like there is another script running

Nice little script but it doesn't work for me. It never ends. The log just says Looks like there is another scripting running. Waiting,,,,,, and it never ends. this happens when it is just a single encode...no multiple streams going.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.