Jump to content
linuxserver.io

[Plugin] Linuxserver.io - Unraid Nvidia

1426 posts in this topic Last Reply

Recommended Posts

2 Stupid question but thought I would ask anyway, I am on 6.7 RC5 and don't see a build for that. So, I assume the answer is to wait? Which build, Nvidia or Stock? Again, assume Nvidia Build?

 

Thanks

Share this post


Link to post
2 minutes ago, Govnah said:

2 Stupid question but thought I would ask anyway, I am on 6.7 RC5 and don't see a build for that. So, I assume the answer is to wait? Which build, Nvidia or Stock? Again, assume Nvidia Build?

1. Wait (or go with 6.6.6, or 6.7.0-rc4)

2. NVidia

Share this post


Link to post

I have a 1060 and installed the plugin. Using the nvidia-smi command, I can see that it is hw transcoding a 4k video in plex, but CPU usage is still really high.  It is transcoding from 4k HDR to 1080p. Any thoughts?

 

1256881170_ScreenShot2019-02-27at8_03_17AM.thumb.png.ae19bd2adc4b3a357e9ad419f0286117.png

 

Screen Shot 2019-02-27 at 8.04.00 AM.png

Edited by Blumpkin

Share this post


Link to post
5 minutes ago, Blumpkin said:

I have a 1060 and installed the plugin. Using the nvidia-smi command, I can see that it is hw transcoding a 4k video in plex, but CPU usage is still really high.  It is transcoding from 4k HDR to 1080p. Any thoughts?

 

 

Screen Shot 2019-02-27 at 8.03.17 AM.png

Screen Shot 2019-02-27 at 8.04.00 AM.png

Plex is still using the CPU for decoding.

Look at htop and you will probably see Plex Transcoder there too

Share this post


Link to post
3 minutes ago, Blumpkin said:

I have a 1060 and installed the plugin. Using the nvidia-smi command, I can see that it is hw transcoding a 4k video in plex, but CPU usage is still really high.  It is transcoding from 4k HDR to 1080p. Any thoughts?

Plex by default currently only hardware encodes, not decodes.  Have you patched Plex to hardware decode?  If so, the CPU usage could be the audio stream.  Somebody else may know more - I'm only going by info in this thread.

Share this post


Link to post
1 minute ago, Caedis said:

Plex is still using the CPU for decoding.

Look at htop and you will probably see Plex Transcoder there too

Run the decoder patch posted a few pages back. If done correctly, you should be seeing close to 1gb of usage per stream on Nvidia-smi. 

Share this post


Link to post
6 hours ago, saarg said:

Can you post a screenshot of the plugin page? 

Attached is a screen shot. I also found this in the logs. I am thinking I fell victim to a fake GTX 1050TI.....

Quote

Feb 26 19:25:38 NASBOX kernel: nvidia-nvlink: Nvlink Core is being initialized, major device number 246
Feb 26 19:25:38 NASBOX kernel: nvidia 0000:03:00.0: vgaarb: changed VGA decodes: olddecodes=none,decodes=none:owns=io+mem
Feb 26 19:25:38 NASBOX kernel: NVRM: The NVIDIA GPU 0000:03:00.0 (PCI ID: 10de:1c82)
Feb 26 19:25:38 NASBOX kernel: NVRM: installed in this system is not supported by the
Feb 26 19:25:38 NASBOX kernel: NVRM: NVIDIA 410.78 driver release.
Feb 26 19:25:38 NASBOX kernel: NVRM: Please see 'Appendix A - Supported NVIDIA GPU Products'
Feb 26 19:25:38 NASBOX kernel: NVRM: in this release's README, available on the operating system
Feb 26 19:25:38 NASBOX kernel: NVRM: specific graphics driver download page at www.nvidia.com.
Feb 26 19:25:38 NASBOX kernel: nvidia: probe of 0000:03:00.0 failed with error -1
Feb 26 19:25:38 NASBOX kernel: NVRM: The NVIDIA probe routine failed for 1 device(s).
Feb 26 19:25:38 NASBOX kernel: NVRM: None of the NVIDIA graphics adapters were initialized!
Feb 26 19:25:38 NASBOX kernel: nvidia-nvlink: Unregistered the Nvlink Core, major device number 246

 

nvidia.jpg

Share this post


Link to post
14 minutes ago, dr_jared88 said:

Attached is a screen shot. I also found this in the logs. I am thinking I fell victim to a fake GTX 1050TI.....

 

nvidia.jpg

Didn't know there were fake ones around. Could it be either a hardware incompability or bad card? 

It also depends on where you bought the card. 

Share this post


Link to post
On 2/23/2019 at 7:08 PM, Cessquill said:

Put this together earlier.  If it's correct, it's a User Script that applies the Plex hardware decoding patch...


#!/bin/bash

con="plex"

echo ""
echo "<font color='red'><b>Applying hardware decode patch...</b></font>"
echo "<hr>"

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='red'><b>Done!</b></font>"

Disclaimer: I know very little about bash, docker commands or what the above patch actually does.  It's just pieced together from working out how I think it's done manually and converting that into a script.

 

If it can be improved (or if it's dangerously wrong), please let me know.  If it's fine, I'll put it in the User Scripts area.

 

Notes:

  • Should be run when Plex is installed/updated
  • From the command line, run "docker ps" to see what your plex container is called.  Set that as the "con" variable in your script (mine is "plex")
  • This script is only required until Plex officially supports hardware decoding
  • It preforms the same as recommended earlier in this thread, namely...
    • Renames the file "Plex Transcoder" to "Plex Transcoder2"
    • Creates a new "Plex Transcoder" file with the suggested contents
    • Changes permissions on both "Plex Transcoder" and "Plex Transcoder2" files (not sure it's required on Transcoder2 - seemed to work for me without)
    • Restarts the Plex container (not sure if required, but doing it anyhow)
  • Probably best nothing is playing whilst the script is run
  • You'll need to have Plex running for the script to work.  Would require different code if stopped (would probably be safer to stop the container first, make the changes then start again, but here we are)
  • Run "nvidia-smi dmon -s u" from the terminal (not within Plex container) to check whether the decoding is working.  Set a video to play in a transcoded state, and the 3rd and 4th columns from the end should be non-zero

Good luck!

 

I have tried the script, and it seems to run well, but I am not getting any hardware decoding. All 0 in that column. Any other suggestions? Using a 1060.

Share this post


Link to post
1 hour ago, Blumpkin said:

 

I have tried the script, and it seems to run well, but I am not getting any hardware decoding. All 0 in that column. Any other suggestions? Using a 1060.

Same here with a P4000. I'm on the Plex official Docker. I plan to try the LSIO container this weekend.

Share this post


Link to post
14 minutes ago, JasonM said:

Same here with a P4000. I'm on the Plex official Docker. I plan to try the LSIO container this weekend.

 

You both added the check in the plex server settings to enable hardware transcoding?

Share this post


Link to post
Just now, JasonM said:

Correct. Encode works great. Just no decode. CPU is doing it.

Also, FWIW, before this plugin, I was passing the Intel QuickSync device to the contianter and getting hardware acceleration.

Share this post


Link to post
15 hours ago, saarg said:

 

I barely tested transcoding during development and some troubleshooting, so don't have too much experience about it. Never tried the decoding patch for plex. 

But audio is not handled by the GPU at all as far as I know. 

Thanks for your response.

Share this post


Link to post

Just a quick question regarding updating to a new version (I'm pretty new to unRAID, just finished my first build a few days ago). I'm currently on unRAID NVIDIA 6.6.6 and HW encoding and decoding with my P400 works fine in Plex (thanks to this thread). But my question is if I want to upgrade to a new version of unRAID NVIDIA, do I need to pull the stock image first and then the NVIDIA image or just the NVIDIA image?

Share this post


Link to post
16 hours ago, saarg said:

We are not going to patch plex in our container. 

Understood - though you wouldn't be patching anything - just a wrapper script (which is what most containers use for startup anyways)
Just a suggestion, after all. Eventually mainline Plex will support nvdec either way so not a big deal to work around until then.

Share this post


Link to post
24 minutes ago, Govnah said:

Curious if a Quadro K2000D is compatible?

While yes, its not the best quality nor compatablilty for file formats.

Share this post


Link to post
1 hour ago, JasonM said:

Correct. Encode works great. Just no decode. CPU is doing it.

Yup, same.

 

1 hour ago, JasonM said:

Same here with a P4000. I'm on the Plex official Docker. I plan to try the LSIO container this weekend.

 

I have tried the official and binhex, to no avail. Emby seems to do it fine, though.

Edited by Blumpkin

Share this post


Link to post
1 hour ago, JasonM said:

Correct. Encode works great. Just no decode. CPU is doing it.

This can be done, go to page 12 I think it was for decoding settings. 

 


mv 'Plex Transcoder'  'Plex Transcoder2'
apt-get update && apt-get install nano
nano 'Plex Transcoder'

**

(in file

#!/bin/sh
exec /usr/lib/plexmediaserver/Plex\ Transcoder2 -hwaccel nvdec "$@"
)

**

chmod +x 'Plex Transcoder'

chmod +x 'Plex Transcoder2'

Share this post


Link to post
2 minutes ago, lasewun said:

This can be done, go to page 12 I think it was for decoding settings. 

 


mv 'Plex Transcoder'  'Plex Transcoder2'
apt-get update && apt-get install nano
nano 'Plex Transcoder'

**

(in file

#!/bin/sh
exec /usr/lib/plexmediaserver/Plex\ Transcoder2 -hwaccel nvdec "$@"
)

**

chmod +x 'Plex Transcoder'

chmod +x 'Plex Transcoder2'

I've done that, and used to the script. Both produce the same results, using the official container.

Share this post


Link to post
2 minutes ago, Blumpkin said:

I've done that, and used to the script. Both produce the same results, using the official container.

How are your sure its not decoding? It most likely is but cant be reported in PLEX dashboard.

Use this command and send a screenshot of it when you have a transcode going.

nvidia-smi dmon -s u

Share this post


Link to post
Just now, lasewun said:

How are your sure its not decoding? It most likely is but cant be reported in PLEX dashboard.

Use this command and send a screenshot of it when you have a transcode going.

nvidia-smi dmon -s u

Yes, that's the command I used. All 0s in the decode column. Emby does it fine, though.

Share this post


Link to post
22 minutes ago, Blumpkin said:

Yes, that's the command I used. All 0s in the decode column. Emby does it fine, though.

Try change quality to another. I found SD doesn't work. But diferent 720 or 1080 formats work.

Share this post


Link to post
#!/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

EDIT:
Just corrected some flawed assumptions on the logic above.
Using grep -i to grab container name so that it matches without case sensitivity. 
Using a variable to capture the return value of the stat, since docker exec -it can't be used and docker exec -i always returns 0.
Flipped -eq 0 to -eq 1 since that was the inverse of the intended behavior.

Only weird thing is something prints "plex" lowercase and I don't know where. 

EDIT2:
Figured that out, docker restart $con prints the name of the container once it's restarted. Could redirect the output to /dev/null, though.

Edited by Xaero

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.