Cessquill Posted March 7, 2019 Share Posted March 7, 2019 (edited) 13 minutes ago, phasetwo said: Thank you for this script and a massive thank you to everybody involved with this project!👏 Worked flawlessly on 6.7.0-rc4 with an NVIDIA Quadro P600. In case a non-programmer like me will run into the same question I have, here is the exact procedure which worked for me: Copy the script into an editor Modify the "con" value (e.g. "binhex-plexpass") Save as an .sh file Copy to desired folder on Unraid server (if not working on server already) Open terminal from Unraid webgui and enter "bash /path/to/script.sh No problems. Two points... Another user updated on this patch a bit later in this thread. It auto-sets the con variable for you, and only runs if it hasn't done already. I'll update mine shortly with that Forgot to mention that it's best to run it using the User Scripts plugin - you can copy and paste it straight into the plugin and run it there. It's then saved for running in the future. Edit: @JasonM beat me to it. Edited March 7, 2019 by Cessquill realised somebody had already replied 1 Link to comment
phasetwo Posted March 7, 2019 Share Posted March 7, 2019 34 minutes ago, JasonM said: One can also install the CA User Scripts plugin and do this from the web UI, and even set a scheduled run to keep it patched in the event of Plex container updates. 26 minutes ago, Cessquill said: No problems. Two points... Another user updated on this patch a bit later in this thread. It auto-sets the con variable for you, and only runs if it hasn't done already. I'll update mine shortly with that Forgot to mention that it's best to run it using the User Scripts plugin - you can copy and paste it straight into the plugin and run it there. It's then saved for running in the future. Edit: @JasonM beat me to it. Thank you both for these inputs. I will install CA User Scripts. Can the script be run regularly without any undesired effects, or should it only be run after an update of the Plex container? Link to comment
JasonM Posted March 7, 2019 Share Posted March 7, 2019 8 minutes ago, phasetwo said: Thank you both for these inputs. I will install CA User Scripts. Can the script be run regularly without any undesired effects, or should it only be run after an update of the Plex container? As long as you use the current script version as Cessquill indicated, it will check to see if the patch is applied each time it's run. I have mine set to run nightly, after my backup and Docker containers update. 1 Link to comment
Cessquill Posted March 7, 2019 Share Posted March 7, 2019 11 minutes ago, phasetwo said: Thank you both for these inputs. I will install CA User Scripts. Can the script be run regularly without any undesired effects, or should it only be run after an update of the Plex container? Run this version in User Scripts... 1 Link to comment
craigzyc Posted March 7, 2019 Share Posted March 7, 2019 Thank you. Everything works great on either the linuxserver or limetech plex except the script for hardward decode, that only worked on linuxserver. This in combo with my new upgraded internet connection makes me very happy. Using on an MSI GAMING GeForce GTX 1060 6GB GDRR5 192-bit Reposting the correct code for the script: #!/bin/bash #This should always return the name of the docker container running plex - assuming a single plex docker on the system. con="`docker ps --format "{{.Names}}" | grep -i plex`" echo "" echo "<b>Applying hardware decode patch...</b>" echo "<hr>" #Check to see if Plex Transcoder2 Exists first. exists=`docker exec -i $con stat "/usr/lib/plexmediaserver/Plex Transcoder2" >/dev/null 2>&1; echo $?` if [ $exists -eq 1 ]; then # If it doesn't, we run the clause below docker exec -i $con mv "/usr/lib/plexmediaserver/Plex Transcoder" "/usr/lib/plexmediaserver/Plex Transcoder2" docker exec -i $con /bin/sh -c 'printf "#!/bin/sh\nexec /usr/lib/plexmediaserver/Plex\ Transcoder2 -hwaccel nvdec "\""\$@"\""" > "/usr/lib/plexmediaserver/Plex Transcoder";' docker exec -i $con chmod +x "/usr/lib/plexmediaserver/Plex Transcoder" docker exec -i $con chmod +x "/usr/lib/plexmediaserver/Plex Transcoder2" docker restart $con echo "" echo '<font color="green"><b>Done!</b></font>' #Green means go! else echo "" echo '<font color="red"><b>Patch already applied or invalid container!</b></font>' #Red means stop! fi Link to comment
phasetwo Posted March 7, 2019 Share Posted March 7, 2019 36 minutes ago, JasonM said: As long as you use the current script version as Cessquill indicated, it will check to see if the patch is applied each time it's run. I have mine set to run nightly, after my backup and Docker containers update. 34 minutes ago, Cessquill said: Run this version in User Scripts... Thanks! The script by Xaero works great with the User Scripts plugin. Link to comment
pimogo Posted March 7, 2019 Share Posted March 7, 2019 Unraid + Plex + Nvidia GPU HW Transcoding + AVI files: Has anyone experienced issues with running older .avi files (e.g older shows where mkv not available) I ask because for me those files refuse to play in Plex. Upon disabling HW, they play just fine. I understand avi's are problematic and possibly unsupported by HW transcoding, but was hopeful that in such cases those files would just automaticallly fall back on the cpu to transcode. This appears to not be the behavior, as it just fails to play. I've presently disabled HW transcoding , but wold like to switch back once i can resolve this problem. If anyone has experienced this (or can quickly test), i'd be forever grateful. Thanks! Link to comment
mkyb14 Posted March 7, 2019 Share Posted March 7, 2019 Need some quick guidance to make sure I've got this done correctly for Unraid 6.6.7 Stable with a P2000. install Plex by linuxerver.io Install nVidia by linuxserver.io open the plugin's page and select from the left dropdown what.... says nvidia 6.6.6 or 6.7.0rc1-4 ... do I select 6.6.6? or have to update my build to an rc version? Link to comment
phasetwo Posted March 7, 2019 Share Posted March 7, 2019 2 minutes ago, mkyb14 said: Need some quick guidance to make sure I've got this done correctly for Unraid 6.6.7 Stable with a P2000. install Plex by linuxerver.io Install nVidia by linuxserver.io open the plugin's page and select from the left dropdown what.... says nvidia 6.6.6 or 6.7.0rc1-4 ... do I select 6.6.6? or have to update my build to an rc version? Facing the same situation, I chose to upgrade to a RC version. No regrets so far bu I understand if you are reluctant. Link to comment
mkyb14 Posted March 7, 2019 Share Posted March 7, 2019 30 minutes ago, phasetwo said: Facing the same situation, I chose to upgrade to a RC version. No regrets so far bu I understand if you are reluctant. yes, just want someone who's installed it to verify what my next step should be. Stay on 6.6.7 and choose what nvidia drivers from the list? or do I need to upgrade to an rc version. Link to comment
trurl Posted March 7, 2019 Share Posted March 7, 2019 38 minutes ago, mkyb14 said: open the plugin's page and select from the left dropdown what.... says nvidia 6.6.6 or 6.7.0rc1-4 It's a dropdown because it's a choice you can make. The plugin actually installs a customized version of Unraid, whichever version you choose from the dropdown. It is simply the Unraid version you choose with support for NVidia added to it. Link to comment
mkyb14 Posted March 7, 2019 Share Posted March 7, 2019 Just now, trurl said: It's a dropdown because it's a choice you can make. The plugin actually installs a custom version of Unraid, whichever version you choose from the dropdown. ok that makes sense. so it's not loading them on the side, it's a complete change to unraid itself with underlying drivers for nvidia. Link to comment
trurl Posted March 7, 2019 Share Posted March 7, 2019 Just now, mkyb14 said: ok that makes sense. so it's not loading them on the side, it's a complete change to unraid itself with underlying drivers for nvidia. yes Link to comment
Pducharme Posted March 7, 2019 Share Posted March 7, 2019 4 hours ago, JasonM said: As long as you use the current script version as Cessquill indicated, it will check to see if the patch is applied each time it's run. I have mine set to run nightly, after my backup and Docker containers update. Do you call it from within the CA Backup Restore Settings (Path to custom start script) or in User Script? if in UserScript, how to know the backup is completed before running it ? Link to comment
mkyb14 Posted March 8, 2019 Share Posted March 8, 2019 4 hours ago, trurl said: yes Followed the directions, worked like a charm after reboot and plex gui updates. Last question, I have a VM that is for BlueIris, and I'd like to take advantage of the HW GPU for endcoding since I do not have a intel quick assist CPU. With this installed, am I able to pass this through to a windows 10 VM at the same time? Link to comment
mkyb14 Posted March 8, 2019 Share Posted March 8, 2019 4 hours ago, trurl said: yes Followed the directions, worked like a charm after reboot and plex gui updates. Last question, I have a VM that is for BlueIris, and I'd like to take advantage of the HW GPU for endcoding since I do not have a intel quick assist CPU. With this installed, am I able to pass this through to a windows 10 VM at the same time? Link to comment
ramblinreck47 Posted March 8, 2019 Share Posted March 8, 2019 6 hours ago, pimogo said: Unraid + Plex + Nvidia GPU HW Transcoding + AVI files: Has anyone experienced issues with running older .avi files (e.g older shows where mkv not available) I ask because for me those files refuse to play in Plex. Upon disabling HW, they play just fine. I understand avi's are problematic and possibly unsupported by HW transcoding, but was hopeful that in such cases those files would just automaticallly fall back on the cpu to transcode. This appears to not be the behavior, as it just fails to play. I've presently disabled HW transcoding , but wold like to switch back once i can resolve this problem. If anyone has experienced this (or can quickly test), i'd be forever grateful. Thanks! Has anyone replicated this? I have a ton of .avi files and I'm looking to use this Nvidia plugin in the near future when I do my build. If it's a reproducible problem and not fixable, then I might have to rethink my build. 1 Link to comment
halfelite Posted March 8, 2019 Share Posted March 8, 2019 (edited) 8 hours ago, pimogo said: Unraid + Plex + Nvidia GPU HW Transcoding + AVI files: Has anyone experienced issues with running older .avi files (e.g older shows where mkv not available) I ask because for me those files refuse to play in Plex. Upon disabling HW, they play just fine. I understand avi's are problematic and possibly unsupported by HW transcoding, but was hopeful that in such cases those files would just automaticallly fall back on the cpu to transcode. This appears to not be the behavior, as it just fails to play. I've presently disabled HW transcoding , but wold like to switch back once i can resolve this problem. If anyone has experienced this (or can quickly test), i'd be forever grateful. Thanks! 2 hours ago, ramblinreck47 said: Has anyone replicated this? I have a ton of .avi files and I'm looking to use this Nvidia plugin in the near future when I do my build. If it's a reproducible problem and not fixable, then I might have to rethink my build. This is fixable. Remember the HW decoding they are doing is more of a work around. You need to adjust the script to tell it to not play AVI files with the -hwaccel parameter #!/bin/bash marap=$(cut -c 10-14 <<<"$@") if [ $marap == "mpeg4" ]; then exec /usr/lib/plexmediaserver/Plex\ Transcoder2 "$@" else exec /usr/lib/plexmediaserver/Plex\ Transcoder2 -hwaccel nvdec "$@" fi Edited March 8, 2019 by halfelite 1 Link to comment
Xaero Posted March 8, 2019 Share Posted March 8, 2019 (edited) #!/bin/bash # This should always return the name of the docker container running plex - assuming a single plex docker on the system. con="$(docker ps --format "{{.Names}}" | grep -i plex)" echo -n "<b>Applying hardware decode patch... </b>" # Check to see if Plex Transcoder2 Exists first. exists=$(docker exec -i "$con" stat "/usr/lib/plexmediaserver/Plex Transcoder2" >/dev/null 2>&1; echo $?) if [ "$exists" -eq 1 ]; then # If it doesn't, we run the clause below # Move the Plex Transcoder to a different location so we can replace it with our wrapper docker exec -i "$con" mv "/usr/lib/plexmediaserver/Plex Transcoder" "/usr/lib/plexmediaserver/Plex Transcoder2" # For Legibility and future updates - if needed, use a heredoc to create the wrapper: docker exec -i "$con" /bin/sh -c 'xargs -0 printf > "/usr/lib/plexmediaserver/Plex Transcoder";' <<-'EOF' #!/bin/bash marap=$(cut -c 10-14 <<<"$@") if [ "$marap" == "mpeg4" ]; then exec /usr/lib/plexmediaserver/Plex\ Transcoder2 "$@" else exec /usr/lib/plexmediaserver/Plex\ Transcoder2 -hwaccel nvdec "$@" fi EOF # chmod the new wrapper to be executable: docker exec -i "$con" chmod +x "/usr/lib/plexmediaserver/Plex Transcoder" echo '<font color="green"><b>Done!</b></font>' # Green means go! else # If we ended up here, the patch didn't even try to run, presumably because the patch was already applied. echo '<font color="red"><b>Patch already applied!</b></font>' # Red means stop! fi Did some re-tooling of the script to make things a bit more sane, again. The wrapper script is now in a heredoc which allows it to be edited inline normally, rather than having a bunch of awkward escapes and such. Seems to work from my limited testing just now. Also includes the conditional posted above, fwiw. EDIT: If someone way more versed in FFMPEG limitations knows what a good list of exclusions from the nvdec parameter would be - we can certainly work that into the script fairly easy. Just store the formats in a string and test the return of grep against that variable, instead of testing specifically for each format. EDIT2: I just noticed that the resulting wrapper inside the docker loses the formatting in the heredoc. I'll try and fix that eventually. This has no impact on the script actually doing it's job or not. EDIT3: Script above has now been fixed. If copy and paste from here doesn't work from some reason, here's a gist:https://git.io/fhhe3 I'll be updating at that gist from now on, as well. Makes things easier. Edited March 8, 2019 by Xaero 1 Link to comment
JasonM Posted March 8, 2019 Share Posted March 8, 2019 17 hours ago, Pducharme said: Do you call it from within the CA Backup Restore Settings (Path to custom start script) or in User Script? if in UserScript, how to know the backup is completed before running it ? I just use a custom cron schedule in User Scripts to run an hour after the backup runs. My backups don't take nearly that long, so I know the timing is safe and nobody is likely to be watching anything at 4 AM. Link to comment
saarg Posted March 8, 2019 Share Posted March 8, 2019 14 hours ago, mkyb14 said: Followed the directions, worked like a charm after reboot and plex gui updates. Last question, I have a VM that is for BlueIris, and I'd like to take advantage of the HW GPU for endcoding since I do not have a intel quick assist CPU. With this installed, am I able to pass this through to a windows 10 VM at the same time? Read the first posts for this info. Should be mentioned there. Link to comment
Dazog Posted March 9, 2019 Share Posted March 9, 2019 Has anyone figured out how to monitor the gpu usage through netdata docker or telegraf- Grafana? Link to comment
fr0stbyt3 Posted March 9, 2019 Share Posted March 9, 2019 Are there any drawbacks to running the decode patch? For reference, I have a p2000 I would be testing this on. Link to comment
Xaero Posted March 10, 2019 Share Posted March 10, 2019 7 hours ago, fr0stbyt3 said: Are there any drawbacks to running the decode patch? For reference, I have a p2000 I would be testing this on. Currently using a P2000 myself. The decode patch has basically no drawbacks other than being unsupported. Eventually the nvdec support will be a standard plex feature, and the patch will become obsolete at that point. There is one possible downfall for the patch currently, which I need to figure out a "proper" way to approach: If for some reason your docker starts, and the nvidia card/driver is not working, your transcoder will cease to function entirely rendering playback impossible outside of native DirectPlay. This is a pretty impossible circumstance if you've configured everything and the nvenc side of the house works fine - but is certainly of concern because hardware failures occur, and changing to mainline unraid from the unraid-nvidia branch would also break Plex with the current script. 1 Link to comment
Xaero Posted March 10, 2019 Share Posted March 10, 2019 (edited) 12 hours ago, Dazog said: Has anyone figured out how to monitor the gpu usage through netdata docker or telegraf- Grafana? That is something that would need support added for the netdata docker. There's a plugin here:https://github.com/coraxx/netdata_nv_plugin That would allow you to monitor various GPU statistics via netdata. Note that it doesn't monitor the nvdec and nvenc pipelines, so you wouldn't be able to see the transcoding usage - just the memory usage. Edit: Updated my script on gist;https://git.io/fhhe3 Edited March 10, 2019 by Xaero Link to comment
Recommended Posts