Plex on ProxMox Tutorial WITH nVidia Hardware Encoding

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
it has been nearly three years since my last plex installation tutorial and in that video i was just running the plug-in inside of freemass today i'm going to show you how i actually run plex in my house inside of a virtual machine on proxmox with an nvidia graphics card passed through for hardware encoding let's get started today's video is brought to you by lexar and the nm610 pci express nvme drive available in 250 gig 500 gig and one terabyte capacities it makes the perfect upgrade for your laptop or desktop pc featuring nvme 1.3 gen 3x4 and speeds up to three and a half times faster than sata it's the surefire way to supercharge your pc get into your games faster with the lexar nm 610 nvme drive click the link down in the video description to learn more welcome back to craft computing everyone as always i'm jeff you think after spending 10 years as a virtualization admin that i would stop confusing the terms intel vtx and intel vtd but it is a mistake that i do make often enough including last week when i reviewed the hive zeus server right here i claimed that this server does not support pci express passthrough and well i was completely wrong the server does support intel vtd which is direct to io for pci express which means we can run a quadro card inside of a plex server and enable hardware encoding so if you haven't caught on already that is the plan for today i'm going to walk through the installation steps for getting flex installed as a virtual machine on top of a proxmox hypervisor and then we're gonna pass through a pci express card to enable hardware encoding inside of plex let's get this thing started so we're starting here with a brand new installation of proxmox and the nvidia card not installed in the server yet we'll get to that in just a little bit first step is actually getting plex installed into a virtual machine and for that i'm going to use ubuntu server 20.04 first step is to upload the ubuntu server iso into proxmox so we can use it as an installation disk so i'm going to click on my proxmox server right here we're going to go down to the local storage pool click on content and then go to upload content type is going to be an iso image then we're going to select a file and in my case it is in my downloads directory and i'm going to go over to the ubuntu 2004 server iso and hit on upload once that image is uploaded we can go ahead and get started so we're going to right click on our proxmox server and go down to create vm i'm going to give the virtual machine a name of plex dash p400 yp400 well i'll be installing a quadro p400 for the installation media we're going to click on the iso image pull down and then select the ubuntu server iso then click on next for system settings go ahead and leave everything at the default and click on next our plex storage library is actually going to be remote on a file server for this particular virtual machine so i'm actually going to drop the disk size down to just 20 gigabytes as the only thing we'll be storing is the os itself under cpu i'm gonna go ahead and give this server four cores click on next under memory we'll go ahead and give it four gigs so 4096. click on next we're going to leave network settings as default so click on next and then click on finish once your virtual machine has been created go ahead and double click on the virtual machine icon to bring up the vnc window and then power it up it should auto boot to your ubuntu server iso and we can go ahead and get the installation started just a couple of steps to get everything up and running first up i'm going to select english as my main language because well i don't speak anything else i'm going to continue without updating the installer because we will be updating all of our packages later us keyboard layout sounds good to me network setup i'm going to go ahead and use dhcp for now so go ahead and click on done we're going to use the entire hard disk so go ahead and make sure that is selected and then go down and click on done again this screen just shows you how it's going to partition the drive and if everything looks good go ahead and click on done again and then click on continue to apply the settings most of my virtual machines have a username of administrator just out of old habit and this server's name is going to be plex dash p400 again username i'll do the same thing administrator and then i'm going to enter my root password right here i am going to select to install the open ssh server as it does make it easier to install all of the packages later on so go ahead and check that box and then click on done we don't need anything else to run in here so go ahead and skip all of that and then click on done again and now it's just a matter of waiting for ubuntu to finish installing it's a good time to kick back relax and uh enjoy your beer once ubuntu has been installed it's time to start working on the plex side of this equation to do that i'm going to ssh into the ubuntu server and we're going to enter a couple of commands to add the plex repository to ubuntu you can use any client for this but i prefer putty so we're going to enter the ip address of the plex server in my case it is 192.168.1.186. i'm going to enter administrator as my username and the password i entered during the setup next up i'm going to go ahead and split my windows into because we're going to be copying and pasting some commands in this tab right here is the plex support forum and it is how to enable the repository for linux distributions i'm going to go down here to the debian based installations and i'm going to select these two commands and copy them over so first up select that right click and copy click over on your ssh session and just right click and it will insert that command do the same thing for the second command right here and there we go and to install plex it's as simple as typing in sudo apt install plex media server and hit enter and yes we would like to install plex media server once plex is installed i would also recommend doing a sudo apt upgrade to make sure all of the packages on your server are up to date however for the purposes of this tutorial i'm just going to skip that part and if you've done everything correctly we should be able to open a new browser window enter the ip address of our server so 192.168.1.186. pull in 32400 and then slash web and our plex server is up and running once we've confirmed that plex is up and running it's time to connect to a network share so we can start loading in our media and doing that is pretty darn simple first up we're going to run sudo nano forward slash etc forward slash fs tab fs tap will automatically connect your plex server to a network share as soon as it boots up getting it all set up is very straightforward first up i'm going to enter the path to my network share which is slash 192.168.1.226 which is the ip address of my true now server forward slash plex test after that enter a space and then we're going to say where do we want the network share to be mounted on our local file system in this case i'm going to do forward slash plex media which will mount this at the root of our file system space network share type is a cifs or windows based file share then i'm going to define the username and password to connect to the share with so space username equals plex test comma password equals one two three four five six seven eight that's only the password for my test plex user don't actually use that password two last things is space zero and space zero hit control x to exit y to save and enter to save your changes next up i need to create that directory at the root of our file system so the network share actually has a place to mount so sudo mkdir to make the directory forward slash plex media there we go after you've saved the fstab file go ahead and reboot and if you've done everything correctly it should automatically mount your network share into the plex media directory to verify that i'm going to type in cd forward slash flex media and i'm going to type in ls to show the directory contents and you can see the movies folder that i've added previously now that the directory is on the server it's time to actually add our media into plex as a library so we're going to jump back over to our web browser click on settings scroll all the way down to the bottom down to manage and then click on libraries up at the top of the screen click on add library and here is where you select what type of media you're adding to your plex server whether it's movies tv shows music photo libraries in this case i'm going to click on other videos as i'm just adding craft computing videos reason being i don't want any copyright issues on this video and as i'm the copyright owner of everything for craft computing i'm not going to distract myself if you're happy with your choice go ahead and click on next then we're going to browse for the media folder i'm going to make sure i'm at the root of my plex server by clicking on the forward slash right there scroll down to the plex media folder we created earlier and then click on movies click on add and then click on add library now this will automatically start scanning the library for any media that it can add so we're going to go back to our home screen i'm going to click on the other videos library we just created and as you can see it's already starting to add in some of the videos that i've put in there again for the purposes of this tutorial we're going to pretend that each one of my cloud gaming server videos that i've added to the server is its own movie so now let's go ahead and see if this thing works alright the video is indeed playing and is streaming what it looks like at 4k but let's go ahead and verify that by looking at our server activity so if i minimize this video and leave it playing still right there i can go up to the activity button right there click on that click on dashboard and right here you can see all of the media that is currently streaming off of your server and to verify what's actually being done i can go over and show details right now we can see that it is playing in 4k via h.264 direct play jumping back over to our proxmox view you can see that it actually takes about six or seven percent of our cpu just to stream this video without any transcoding at all but what if we don't want to use all of that bandwidth or for example you have something like a smartphone that you're streaming to and you don't necessarily need a 118 megabit video being streamed to it well we can go ahead and force a quality setting up here in quality and then under home streaming i'm going to uncheck use recommended settings and we can set a maximum bitrate that we would like to stream at i'm going to go and select 10 megabit 1080p and then click on save changes now if i close this video go back to home and open it back up all right the video has started playing again and it is noticeably a little bit softer on my screen i'm gonna go and minimize the video again go back to my activity dashboard and here you can see the video is still 4k h264 but now it is being transcoded down to 1080p h.264 and since we have no on-board decoder this is actually using the cpu to process that now while it is streaming just fine we can go over to our proxmox monitor and you can see that all of my four cores are being hit pretty darn hard in fact we're seeing about 95 cpu utilization just to transcode this one video the fans in the server have also very audibly ramped up so if you're going to be relying on cpu transcode you can see it is a pretty heavy workload for cpus that don't have built-in encoders now unless you're happy with your cpus running at 100 anytime you need to transcode your videos it's a good idea to add a hardware video encoder in this case we're going to be adding an nvidia graphics card with nvenc on board and if you're not sure which model to choose from i will have a full list down in the video description essentially if your cpu does not have a hardware video encoder on board it is just brute forcing the codec down to a more reasonable bit rate however having dedicated hardware like an nvidia card or intel's transcode built into kb leg or higher cpus you can do it much more efficiently and at much lower power demand to get started there is a little bit of legwork we have to do on the proxmox host itself so go ahead and shut down your plex virtual machine and let's get this thing rolling to shut down the plex virtual machine i'm going to type in sudo halt dash p and enter my password and down it goes typically when i do tutorial videos like this i try to make it my own steps my own process however when a fantastic guide already exists there's no point in reinventing the wheel and i found the perfect guide for this over on reddit about a year and a half ago a user named cj alas posted the perfect step-by-step guide to getting pci express pass-through working inside of proxmox and we're simply going to go through step by step in his guide again if you want to follow along on your own i will have that linked below down in the video description the first step i recommend is logging into your proxmox server via ssh because we're going to do quite a bit of copy and paste work now one word of caution ssh into your proxmox server you are logged in as root so anything you do just happens there's no confirmation boxes to check or anything like that if you hit enter the change is made first up we're going to scroll all the way down to the very conveniently named step one this is where we're going to enable i o mmu inside of proxmox so we're going to type in nano forward slash etc forward slash default forward slash rub and hit enter i'm going to scroll down to the line that says grub command line linux default equals quiet here i'm going to type in intel underscore io mmu equals on and if you have an amd based proxmox server you'll type in amd underscore iomu equals on we're going to hit control x to exit yes to save and enter to confirm the file name with that saved we're going to type in update dash grub to actually apply those changes step two is loading a couple vfio modules needed for pci express passthrough so again we're going to type in nano and then go to forward slash etc forward slash modules we're going to copy and paste these four values right here so copy that scroll down to a new line right click to paste and then ctrl x to exit yes to save and enter to confirm step three is just another bit of copy and paste so we're gonna copy these two lines right there paste those in and hit enter step four is where we disable proxmox from being able to load the drivers for whatever graphics card we happen to be using in this case an nvidia graphics card now if you've already installed your graphics card into your server this is the part where you need to reboot so you can unload the driver from proxmox however this is the part where i like to stop shut down the server and actually install the card so to shut down proxmox we're going to go over to the proxmox window click on our server and then go to shutdown that server has been on in this room for two hours two and a half hours i've been working on this and doing a couple of other things man that gets you after a while with the server booted back up and the video card installed there's only a couple more steps before we can pass it on to our plex server first up we're going to type in lspci v into our ssh terminal and we're going to find our nvidia graphics card so in my case again i have a quadro p200 and it is showing up right here as an nvidia gp107gl quadro p400 you're gonna want to take note of this number right here because that is what is required for the next step so 82 colon zero zero i'm gonna go back down to the bottom i'm to type in lspci dash n dash s and then 82 colon 0 0 and these two hex values right here are what i need to enable this card for pci express passthrough so i'm going to copy this entire string of text right here [Music] paste that in but i'm not going to hit enter just yet as i need to modify these two values so under the ids equal we're going to do 1 0 d e pull in one c b three put a comma in between them one zero d e colon zero f b nine so those are my values for this particular quadro p400 your values are going to be different so make sure you're paying attention to what the hex values are and what command you're actually entering in i recommend you triple check this one more time just to make sure those hex values are correct and if everything does look good go ahead and hit enter we're going to type in this one last command right here close my ssh window because we are all done with that and we are going to reboot our proxmox server one more time once proxmox has booted back up it is finally time to pci express pass through our quadro card into plex so we're gonna go over to our plex server i'm gonna click on hardware and then we're gonna add a new piece of hardware and we're going to add a pci device under the device pull down menu scroll down until you find your nvidia graphics card and again there's going to be two devices there's the video card itself and then the audio device i usually make sure i pass both of them through so with the gpu selected hit add and then i'm going to add that second device as well scroll down and grab 82.00.1 which is our audio device click on add now fingers crossed we should be able to start our vm whew and there we are if your plex server does not start up or starts up with an error you likely missed a step earlier on go back to that list and make sure you go through each step one by one and make sure everything is entered properly all right home stretch go ahead and ssh back into your plex server i'm going to log in as administrator once again if i can type it in correctly administrator there we go go ahead and run a quick ls pci just to verify that your nvidia card is showing up in this case it's showing up under devices 10 and 11 so there's my vga controller quadro p400 and nvidia audio device lastly we need to install drivers for the nvidia card now the way i do this is i go to the nvidia website i find my cart in their list so in this case we're going to go nvidia quadro nvidia quadrille p400 we're going to select linux 64-bit and i like doing the linux long-lived driver which is essentially the long-term support driver go ahead and hit search now instead of just downloading this package and then transferring it over and data we're just going to w get it into our server the command for that is wget https followed by a very long string of text which i will not repeat here but it's the string for the nvidia website and the download location however the important bit is right in here if i can find my cursor uh it is the version number right there so 450.80.02 and then down here in the file name the same thing 450.80.02 which is the current version on the website i will have this as a copy and paste string down below if you'd rather do it that way and i highly recommend doing that so we're going to go ahead and hit enter it's going to download that file and hopefully there's just one more step before we can actually install the driver you see there's an open source driver that ubuntu will use by default called the nuvo driver i think it's how you pronounce it i'm sure someone will correct me to see if the nuvo driver is indeed running on our server we can type in ls pci dash v go down to our nvidia card which is again right here the quadro p400 and we can see that the kernel driver is using the nuvo driver now we need to install the nvidia driver so nve and c can actually be enabled so we need to disable the nuvo driver first luckily there is a pretty easy way to disable it so we're going to copy these two lines right here which essentially add the nuvo driver to a blacklist inside of the kernel preventing it from loading and again these will be pasted down in the video description we're gonna update one more time and now hopefully reboot one more time rebooted and logged back in let's go and run ls pci dash v again and see all right kernel driver is not running with that sorted there's only two more commands i hope i promise uh first up we actually need a couple of library packages so the nvidia driver can actually compile itself so we're gonna paste in this command right here we're gonna install those and finally we can actually run the nvidia installer and we do that by typing sudo period forward slash and then the nvidia package we downloaded earlier the nvidia installer completes pretty much automatically with just a couple of prompts in between and now finally we can type in lspci dash v and you should see that your p400 or whatever nvidia card you're using is now using the nvidia kernel driver now depending on which nvidia card you went with you might be good to go right here however we do need to make sure the nvidia driver is actually working on this car so if i type in nvidia dash smi that's the nvidia driver tool you can see in my case it says that gpu 10 has an unknown error where it should list the quadro p400 and the current utilization this is essentially the same thing as a code 43 in windows and any fans of virtualization and pcie passthrough know that nvidia doesn't like to pass through to a virtual machine some of the higher end quadro cards the p4000 for example has no problem at all passing through to a virtual machine but even quadro cards like the p400 do block that access so we need to fix that really quick so first up i'm going to shut down the plex server i know i said one more reboot i lied next i'm going to ssh back into my proxmox server next up we're going to navigate to etc pve slash qemu dash server and we're going to modify the 401.conf file that's in there now that is the vm id of my plex virtual machine so nano 401.conf down here under cpu you can see that i haven't configured a cpu type however we're going to give that post and we're also going to enter hidden equals 1. this should block the virtual machine from detecting it's a virtual machine and let the nvidia driver actually run so i'm going to hit ctrl x yes and enter to exit and now let's fire that machine back up all right moment of truth nvidia smi that's what it should look like and finally after all of that work it is about hard time to enable hardware transcoding inside of plex now again as a reminder you do need to be logged into the server you have to have the server claimed and you also have to have a valid plex pass subscription so you do need to pay the monthly fee or have a lifetime subscription so we jumped back onto our plex server i'm going to go up to settings i'm going to scroll down to transcoder and down here these are the two magic buttons use hardware acceleration when available and use hardware accelerated video encoding i'm going to click on save changes and now we should be able to play that exact same video as i did in the intro only this time with hardware transcoding i'm gonna go and minimize that again we're gonna go to our activity monitor and there we go 1080p h.264 but hardware transcoded scrolling down to our real-time metrics here you can see that we're averaging right around 10 or 11 megabits of total bandwidth for the server and down here under cpu you can see there was a little bit of a cpu bump when we started playback of this video but now again we're hovering right around five percent for plex media to actually stream this video and that right there is essentially the difference between transcoding with a cpu and transcoding with a gpu where a cpu has to hit it with basically brute force versus the gpu which has dedicated video encoding hardware and is able to do it without breaking the sweat i'm sure there will be a lot of questions with this video if you have them make sure to drop them in the comment section below and on your way down there make sure to like this video and subscribe to craft computing if you haven't done so already follow me on twitter at craft computing keep up with my daily shenanigans and if you like the content you see on this channel and want to help support me in what i do consider joining the patreon or float plane links are also down in the video description thank you all so much for watching this one and as always i will see you in the next video cheers guys [Music] today's beer is from fort george brewing company in astoria oregon it is their magnemonius ipa a seasonal release clocking in at seven percent a little bit more lemony than i remember it being in years past yeah that's quite a bit different from the last couple of years that i've had normally this is a very very hoppy ipa but it's very tiny it's very pine tree like it's what a lot of people accuse gin and ipas of tasting like uh this year it's it's sapphire gin versus aviation whereas last year's was sapphire very very pine needle intense this year is aviation it's a little bit on the the fruitier lemony side you still get kind of that general hop flavor but uh it's a lot sweeter and a lot lighter pine salt lemon pledge this is still a quite good ipa um it's not quite as christmassy as it was last year like i said it's missing just a little bit more of that pine taste this is still very piney and there's also some unfiltered yeast in this one so uh it's tiny it's very very intense so this is not for your entry level ipa drinker even though it is only a seven percent this right here is a quintessential the over-the-top northwest ipa and i still say that even though it is toned down ever so slightly from the last couple of years it is still very very enjoyable uh just an overall solid ipa even if you're not looking for a christmas themed beer now this is a slightly longer shoot than normal but to all the people who asked do i get drunk every single video that i shoot no it's been two hours
Info
Channel: Craft Computing
Views: 106,576
Rating: undefined out of 5
Keywords: ProxMox, Plex tutorial, Plex Ubuntu Server, Plex Linux server, Plex virtual machine, Plex hardware transcoding, ProxMox PCIe passthrough, proxmox nvidia
Id: -HCzLhnNf-A
Channel Id: undefined
Length: 26min 40sec (1600 seconds)
Published: Mon Dec 14 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.