Hardware Acceleration | Documentation - Jellyfin Project

文章推薦指數: 80 %
投票人數:10人

Hardware acceleration on Raspberry Pi 3 and 4 SearchResultsfor Show/HideTableofContents HardwareAcceleration Jellyfinsupportshardwareacceleration(HWA)ofvideoencoding/decodingusingFFMpeg. FFMpegandJellyfincansupportmultiplehardwareaccelerationimplementationssuchasIntelQuicksync(QSV),AMDAMFandNVIDIANVENC/NVDECthroughVideoAccelerationAPIs. VA-APIisaVideoAccelerationAPIthatuseslibvatointerfacewithlocaldriverstoprovideHWA. QSVusesamodified(forked)versionofVA-APIandinterfacesitwithlibmfxandtheirproprietarydrivers(listofsupportedprocessorsforQSV). OS RecommendedHWAcceleration Linux QSV,NVENC,AMF,VA-API Windows QSV,NVENC,AMF MacOS VideoToolbox RPi V4L2 GraphicsCardscomparisonusingHWA Basedonhardwarevendor: Vendor SupportedHWAcceleration NVIDIA NVENC AMD AMF,VA-API Intel QSV,VA-API Apple VideoToolbox RPi V4L2 EnablingHardwareAcceleration HardwareaccelerationoptionscanbefoundintheAdminDashboardundertheTranscodingsectionofthePlaybacktab. Selectavalidhardwareaccelerationoptionfromthedrop-downmenu,indicateadeviceifapplicable,andcheckEnablehardwareencodingtoenableencodingaswellasdecoding,ifyourhardwaresupportsthis. Thehardwareaccelerationisavailableimmediatelyformediaplayback.Noserverrestartisrequired. OnLinuxyoucancheckavailableGPUusing: lspci-nn|egrep-i"3d|display|vga" orusinglshw: lshw-Cdisplay H.264/AVC10-bitvideos ThehardwaredecodingofH.26410-bitakaHigh10profilevideoisnotsupportedbyanyIntel,AMDorNVIDIAGPU. PleaseconsiderupgradingthesevideostoHEVC10-bitakaMain10profileifyouwanttooffloadyourCPUusageduringtranscoding. IntelGen9andGen11+iGPUs NoteTheIntelGuc/HucfirmwaremustbeenabledforoptionalLow-Powerencoding(pre-Gen11onlysupportsLow-PowerH.264). Instructions: ArchLinux:ArchWiki Debian/Ubuntu:Brainiarc7'sgist WarningForJasperLakeandElkhartLakechips(suchasN5095,N6005andJ6412),Low-Powerencodingmustbeenabled. There'saknownkernelissueonthesechipsinlinux5.15thatcomeswithUbuntu22.04LTSpreventingyoufromusingLow-Power.Youmayneedtoupgradekernelforthis. Thelinux-firmwaresupportisnotincludedinUbuntu20.04.3LTS. AnyUbuntufrom21.10doesincludetherequireddrivers. SupportedAccelerationMethods ImportantInJellyfin10.8fullhardware-acceleratedfiltering(scaling,deinterlacing,tone-mappingandsubtitleburn-in)onIntel,AMDandNVIDIAhardwareareavailable. jellyfin-ffmpegversion4.4.1-2orhigherisrequired,usinganolderororiginalversionofFFmpegmaydisablesomehardwarefilteringimprovements. VA-API NoteInteliGPUandAMDGPUonly. AListofsupportedcodecsforVA-APIcanbefoundontheArchlinuxwiki. WarningAsofJellyfin10.8theofficialDockerimageusesDebian11whichhasacompatibleversionofMesaforAMDGPUHEVCdecoding. EarlierimagesdonotprovideacompatibleversionofMesa. HardwareaccelerationonRaspberryPi3and4 WarningAsofJellyfin10.8hardwareaccelerationonRaspberryPiviaOpenMAXOMXwasdroppedandisnolongeravailable. ThisdecisionwasmadebecauseRaspberryPiiscurrentlymigratingtoaV4L2basedhardwareacceleration,whichisalreadyavailableinJellyfinbutdoesnotsupportallfeaturesotherhardwareaccelerationmethodsprovideduetolackingsupportinFFmpeg. Jellyfinwillfallbacktosoftwarede-andencodingforthoseusecases. ThecurrentstateofhardwareaccelerationsupportinFFmpegcanbecheckedontherpi-ffmpegrepository. NVIDIANVENC NoteMinimumrequireddriverversionsinceJellyfin10.8: Linux:470.57.02 Windows:471.41 Noteverycardhasbeentested. Ifyouwantmorethanthreeparalleltranscodingstreamsonaconsumer(non-Quadro)NVIDIAcard,youcanusethispatchtoremovethelimit. ThepatchisrecommendedforLinuxandWindowsbutmaybreakinthefuture,socheckthecompatibledriverversionsbeforeapplyingit. OnLinuxusenvidia-smitocheckdriverandGPUcardversion. Usefullinks: OfficiallistofsupportedcodecsforrecentNVIDIAGraphicsCards. OfficialNVIDIAffmpegdevelopmentdocs. AMDAMF NoteAMFisavailableonWindowsandLinux. WarningAsofJellyfin10.8fullOpenCLbasedhardwarefilteringinAMFissupportedonWindows10andnewer. AMDhasnotimplementedtheVulkanbasedHWdecoderandscalerinffmpeg,thedecodingspeedmaynotbeasexpectedonLinux. Theclosedsourcedriveramdgpu-proisrequiredwhenusingAMFonLinux. TipMostZenCPUsdonotcomewithintegratedgraphics.YouwillneedadedicatedGPU(dGPU)oraZenCPUwithintegratedgraphicsforhardwareacceleration. IfyourZenCPUissuffixedwithaGorGEinmodelname,youhaveintegratedgraphics. IntelQuickSync NoteIntelQuickSync(QSV)isderivedfromVA-APIonLinuxandD3D11VAonWindows,whichcanutilizeIntel'sfixedfunctionhardwareandEU(executionunits)todovideoencoding,decodingandprocessing. ImportantTouseQSVonLinuxwithrecentInteliGPUsthenonfreeIntelmediadriverisrequiredforfullhardwareacceleration. Ifyouareusingjellyfin-ffmpegversion4.4.1-2orhigheritisincludedandyoudonotneedtoinstallitseperatly. BroadwellornewergenerationisrequiredforQSVonLinux,otherwiseyouhavetouseVA-API. Usefullinks: OfficiallistofsupportedcodecsforrecentIntelGraphicsCards. IntelQSVBenchmarksonLinux Collectionofusefullinksandinformation TipIfyourJellyfinserverdoesnotsupporthardwareacceleration,butyouhaveanothermachinethatdoes,youcanleveragerffmpegtodelegatethetranscodingtoanothermachine. CurrentlyLinux-onlyandrequiresSSHbetweenthemachines,aswellassharedstoragebothformediaandfortheJellyfindatadirectory. Commonsetups Eachhardwareaccelerationtype,aswellaseachJellyfininstallationtype,hasdifferentprerequisitesforenablinghardwareacceleration. ItisalwaysbesttoconsulttheFFMpegdocumentationontheaccelerationtypeyouchooseforthelatestinformation. HardwareaccelerationonDocker(Linux) NoteThisaregeneralinstructions,formorespecificinstructionspleascheckthenextsections! InordertousehardwareaccelerationinDocker,thedevicesmustbepassedtothecontainer. Toseewhatvideodevicesareavailable,youcanrunsudolshw-cvideoorvainfoonyourmachine. VA-APImayrequiretherendergroupaddedtothedockerpermissions. Therendergroupidcanbediscoveredin/etc/groupsuchasrender:x:122:. Youcanusedockerruntostarttheserverwiththerequiredpermissionsanddevices. Anexamplecommandisshownbelow. dockerrun-d\ --volume/path/to/config:/config\ --volume/path/to/cache:/cache\ --volume/path/to/media:/media\ --user1000:1000\ --group-add=122\#Changethistomatchyoursystem --net=host\ --restart=unless-stopped\ --device/dev/dri/renderD128:/dev/dri/renderD128\ --device/dev/dri/card0:/dev/dri/card0\ jellyfin/jellyfin Alternatively,youcanusedocker-composewithaconfigurationfilesoyoudon'tneedtorunalongcommandeverytimeyourestartyourserver. version:"3" services: jellyfin: image:jellyfin/jellyfin user:1000:1000 group_add: -122 network_mode:"host" volumes: -/path/to/config:/config -/path/to/cache:/cache -/path/to/media:/media devices: #VAAPIDevices(examples) -/dev/dri/renderD128:/dev/dri/renderD128 -/dev/dri/card0:/dev/dri/card0 NVIDIAhardwareaccelerationonDocker(Linux) InordertoachievehardwareaccelerationusingDocker,severalstepsarerequired. Prerequisites: GNU/Linuxx86_64withkernelversion>3.10 Docker>=19.03 NVIDIAGPUwithArchitecture>Fermi(2.1) NVIDIAdrivers>=361.93 NVIDIAContainerToolkitneedstobeinstalled FollowtheinstructionsinthelinkabovetoinstalltheNVIDIAContainerToolkitforyourLinuxdistribution. Startyourcontainerbyaddingthisparameter: --gpusall\ Acompleteruncommandwouldlooklikethis: dockerrun-d\ --name=jellyfin\ --gpusall\ -p8096:8096\ -p8920:8920\ -v/config:/config\ -v/media:/media\ -v/cache:/cache\ --restartunless-stopped\ jellyfin/jellyfin Orwithdocker-compose>1.28,addthedeploysectiontoyourJellyfinservice: services: jellyfin: image:jellyfin/jellyfin #...yourJellyfinconfig deploy: resources: reservations: devices: -capabilities:[gpu] Therearesomespecialstepswhenrunningwiththefollowingoption: --user1000:1000 Youmayneedtoaddthisusertothevideogrouponyourhostmachine: usermod-aGvideo Oncethecontainerisstartedyoucanagainvalidateaccesstothehostresources: dockerexec-itjellyfinnvidia-smi Ifyougetdriverinformation,everythingisfinebutifyougetanerrorlikecouldn'tfindlibnvidia-ml.solibraryinyoursystemyouneedtorunthefollowingcommand: dockerexec-itjellyfinldconfig Afterthat,youshouldensuretheNVIDIAdriverloadscorrectly. NoteTheofficialJellyfinDockerimagealreadysetstherequiredenvironmentvariablestoallowaccesstotheGPUsviatheNVIDIAcontainerruntime. Ifyouarebuildingyourownimagedon'tforgettoincludeNVIDIA_DRIVER_CAPABILITIES=allandNVIDIA_VISIBLE_DEVICES=allintoyourcontainer'senvironment. VA-APIhardwareaccelerationonDebian/Ubuntu ConfiguringVA-APIonDebian/Ubunturequiressomeadditionalconfigurationtoensurepermissionsarecorrect. ConfigureVA-APIforyoursystembyfollowingthedocumentationofyourOSand/orvendor. Verifythatarenderdeviceisnowpresentin/dev/dri,andnotethepermissionsandgroupavailabletowritetoit,inthiscaserender: $ls-l/dev/dri total0 drwxr-xr-x2rootroot100Apr1316:37by-path crw-rw----1rootvideo226,0Apr1316:37card0 crw-rw----1rootvideo226,1Apr1316:37card1 crw-rw----1rootrender226,128Apr1316:37renderD128 NoteOnsomereleases,thegroupmaybevideoorinputinsteadofrender. Makesurethatjellyfin-ffmpegversion4.4.1-2orhigherisinstalled. Checktheoutputof/usr/lib/jellyfin-ffmpeg/vainfo. AddtheJellyfinserviceusertotheabovegrouptoallowJellyfin'sFFMpegprocessaccesstothedevice,andrestartJellyfin. sudousermod-aGrenderjellyfin sudosystemctlrestartjellyfin ConfigureVA-APIaccelerationintheTranscodingpageoftheAdminDashboard. Enterthe/dev/dri/renderD128deviceaboveastheVAAPIDevicevalue. Watchamovie,andverifythattranscodingisoccurringbywatchingtheffmpeg-transcode-*.txtlogsunder/var/log/jellyfinandusingradeontop(AMDonly)orsimilartools. IntelQuickSync(QSV)hardwareaccelerationonDebian/Ubuntu QSVisbasedonVA-APIdeviceonLinux,sopleaseconfirmwhetheryouhavecompletedtheVA-APIconfigurationfirst. Makesurethatjellyfin-ffmpegversion4.4.1-2orhigherisinstalled(itshipsthecurrentversionofintel-media-driver(iHD)whichisrequiredforQSV). VerifythattheiHDdriverisproperlyloadedandrecognizesyouriGPU. sudo/usr/lib/jellyfin-ffmpeg/vainfo|grepiHD ConfigureQSVaccelerationintheTranscodingpageoftheAdminDashboard. Watchamovie,andverifythattranscodingisoccurringbywatchingtheffmpeg-transcode-*.txtlogsunder/var/log/jellyfinandusingintel_gpu_top(canbeinstalledwiththeintel-gpu-toolspackage). VA-APIandQSVhardwareaccelerationonLXCorLXDcontainer WarningThishasbeentestedwithLXC3.0andmayormaynotworkwitholderversions. Followthestepsabovetoaddthejellyfinusertothevideoorrendergroup,dependingonyourcircumstances. InstalltherequireddriversonthehostOS AddyourGPUtothecontainer. lxcconfigdeviceaddgpugpugid= Makesureyouhavetherequireddeviceswithinthecontainer: $lxcexecjellyfin--ls-l/dev/dri total0 crw-rw----1rootvideo226,0Jun402:13card0 crw-rw----1rootvideo226,0Jun402:13controlD64 crw-rw----1rootvideo226,128Jun402:13renderD128 ConfigureJellyfintousevideoaccelerationandpointitattherightdeviceifthedefaultoptioniswrong. Tryandplayavideothatrequirestranscodingandrunthefollowing,youshouldgetahit. psaux|grepffmpeg|grepaccel Youcanalsotryplayingavideothatrequirestranscoding,andifitplaysyou'regood. Usefulresources: LXDDocumentation-GPUinstanceconfiguration NVIDIACUDAinsideaLXDcontainer VA-APIandQSVhardwareaccelerationonLXConProxmox ImportantJellyfinneedstoruninaprivilegedLXCcontainer. Youcanconvertanexistingunprivilegedcontainertoaprivilegedcontainerbytakingabackupandrestoringitaspriviledged. InstalltherequireddriversontheProxmoxhost AddyourGPUtothecontainerbyediting/etc/pve/lxc/.conf(youmayneedtochangetheGIDsintheexamplesbelowtomatchthoseusedonyouhost). WarningThishasbeentestedonProxmoxVE7.1-onpreviousversionsyoumayneedtochangecgroup2tocgroup. InteliGPU: lxc.cgroup2.devices.allow:c226:0rwm lxc.cgroup2.devices.allow:c226:128rwm lxc.mount.entry:/dev/dri/card0dev/dri/card0nonebind,optional,create=file lxc.mount.entry:/dev/dri/renderD128dev/dri/renderD128nonebind,optional,create=file NVidiaGPU: lxc.cgroup2.devices.allow:c195:*rwm lxc.cgroup2.devices.allow:c243:*rwm lxc.mount.entry:/dev/nvidia0dev/nvidia0nonebind,optional,create=file lxc.mount.entry:/dev/nvidiactldev/nvidiactlnonebind,optional,create=file lxc.mount.entry:/dev/nvidia-uvmdev/nvidia-uvmnonebind,optional,create=file lxc.mount.entry:/dev/nvidia-modesetdev/nvidia-modesetnonebind,optional,create=file lxc.mount.entry:/dev/nvidia-uvm-toolsdev/nvidia-uvm-toolsnonebind,optional,create=file Shutdownandstartyourcontainer. Installtherequireddriversinyourcontainer. Addthejellyfinusertothevideo,renderand/orinputgroupsdependingonwhoownsthedeviceinsidethecontainer. ConfigureJellyfintousehardwareaccelerationandpointitattherightdeviceifthedefaultoptioniswrong. Tryandplayavideothatrequirestranscodingandrunthefollowing,youshouldgetahit. psaux|grepffmpeg|grepaccel Youcanalsotryplayingavideothatrequirestranscoding,andifitplaysyou'regood. AMDAMFencodingonUbuntu18.04or20.04LTS Installtheamdgpu-proclosedsourcegraphicsdriverbyfollowingtheinstallationinstructions. Theninstallamf-amdgpu-pro. sudoaptinstallamf-amdgpu-pro Checkifjellyfin-ffmpegcontainsh264_amfencoder: $cd/usr/lib/jellyfin-ffmpeg/ $./ffmpeg-encoders|greph264_amf V.....h264_amfAMDAMFH.264Encoder(codech264) NoteIfnotavailable,updateyourjellyfin-ffmpegtothelatestversionandtryagain. ChooseAMDAMFvideoaccelerationinJellyfinandchecktheEnablehardwareencodingoption. Watchamovie,thenverifythath264_amfencoderisworkingbywatchingtheffmpeg-transcode-*.txttranscodinglogsunder/var/log/jellyfinandusingradeontoporsimilartools. AMDAMFencodingonArchLinux AMDdoesnotprovideofficialamdgpu-prodriversupportforArchLinux,butfortunately,athird-partypackagedamdgpu-pro-installerisprovidedinthearchlinuxuserrepository. Clonethisrepositoryusinggit. gitclonehttps://aur.archlinux.org/amdgpu-pro-installer.git Enterthatfolderandmaketheinstallationpackageandinstallit. cdamdgpu-pro-installer makepkg-si Gotostep3ofConfiguringAMDAMFencodingonUbuntu18.04or20.04LTSabove. OpenCL/CUDA/IntelVPPTone-Mapping HardwarebasedHDR10/HLG/DoVitone-mappingwithNVIDIANVENC,AMDAMF,IntelQSVandVA-APIisdonethroughOpenCLorCUDA.DoViProfile5and8tone-mappingrequiresjellyfin-ffmpegversion5.0.1-5orhigher. IntelhardwarebasedVPPHDR10tone-mappingissupportedonIntelQSVandVA-APIonLinux. VPPispreferedwhenbothtwotone-mappingoptionsarecheckedonIntel. OS/Platform NVIDIANVENC AMDAMF IntelQSV IntelVA-API AMDVA-API Software Linux ✔️ ✔️ ✔️ ✔️ ✔️ WIP Windows ✔️ ✔️ ✔️ N/A N/A WIP Docker ✔️ ✔️ ✔️ ✔️ ✔️ WIP NoteTone-mappingonWindowswithIntelQSVandAMDAMFrequiresWindows10ornewer. ImportantMakesurethehardwareaccelerationiswellconfiguredbeforeconfiguringtone-mappingwiththisinstructions. OnWindows:InstallthelatestNVIDIA,AMDorInteldrivers. OnLinuxorDocker: ForNVIDIAcardsnofurtherconfigurationisnecessary. ForAMDcards,installamdgpu-prowithopenclarguments(seeConfiguringAMDAMFencodingonUbuntu18.04or20.04LTSformoredetails): sudo./amdgpu-pro-install-y--opencl=pal,legacy sudousermod-aGvideo$LOGNAME sudousermod-aGrender$LOGNAME ForInteliGPUs,youhavetwotypesoftone-mappingmethods:OpenCLandVPP.Thelatteronedoesnotsupportfinetuningoptions. OpenCL:Followtheinstructionsfromintel-compute-runtime. IfyouareusingtheofficialDockerimageortheonefromlinuxserverthisstepcanbeskipped. VPP:Makesurejellyfin-ffmpeg4.4.1-2orhigherisinstalled. Previousversionsdidnotshipintel-media-driverthusitwasrequiredtobeinstalledmanually. Whenrunningondocker,theprivilegedflagisrequiredfortheOpenCLdevicetoberecognized. Youcandothisbyadding--privilegedtoyourdockercommandorprivileged:truetoyourdockercomposefile. WarningTone-mappingonIntelVA-APIandQSVrequiresaniGPUthatsupports10-bitdecoding,suchasi3-7100orJ4105. ImportantDonotusetheintel-opencl-icdpackagefromyourdistro'srepositorysincetheywerenotbuiltwithRELEASE_WITH_REGKEYSenabled,whichisrequiredforP010pixelinteropflags. Debugging:ChecktheOpenCLdevicestatus.Youwillseecorrespondingvendornameifitgoeswell. Useclinfo:Installclinfobeforeusingit.sudoaptinstall-yclinfoonDebian/Ubuntuorsudopacman-SyclinfoonArch.Thensudoclinfo. Usejellyfin-ffmpeg:/usr/lib/jellyfin-ffmpeg/ffmpeg-vdebug-init_hw_deviceopencl VerifyingTranscodes Toverifythatyouareusingtheproperlibraries,runthiscommandagainstyourtranscodinglog. ThiscanbefoundatAdminDashboard>Logs,and/var/log/jellyfinifinstalledviatheaptrepository. grep-A2'Streammapping:'/var/log/jellyfin/ffmpeg-transcode->.log Thisreturnedthefollowingresults. ... Streammapping: Stream#0:0->#0:0(hevc(native)->h264(h264_qsv)) Stream#0:1->#0:1(aac(native)->mp3(libmp3lame)) ... Stream#0:0usedsoftware(VAAPIDecodecanalsosaynative)todecodeHEVCandusedHWAtoencode. ... Streammapping: Stream#0:0->#0:0(h264(hevc_qsv)->h264(h264_qsv)) Stream#0:1->#0:1(flac(native)->mp3(libmp3lame)) ... Stream#0:0usedHWAforboth.hevc_qsvtodecodeandh264_qsvtoencode. ImprovethisDoc InThisArticle



請為這篇文章評分?