Raspberry Pi 4: Hardware accelerated video decoding (GPU ...

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

DIY: Video Decode using Hardware Acceleration · Start the raspi-config configurator, typing in a Terminal: · Go to Advanced Options > GL Driver · Select the option ... ManagecookiesWeusecookiestoimproveourservices.Readmoreabouthowweusecookiesandhowyoucanrefusethem.NecessarycookiesThenecessarycookieshelptomakethewebsiteworkproperly.StatisticalcookiesAnonymousstatisticalcookieshelptounderstandhowvisitorsusethewebsite.SavesettingsBlogAboutMe!Contact08Aug-2020RaspberryPi4min|123573#RaspberryPi4:Hardwareacceleratedvideodecoding(GPU)inChromiumRaspberryPi|4min|123573streamingvideoraspberrypi4bhardwareaccelerationvideodecoderTableofcontentHideShowHardwareandSoftwareDIY:VideoDecodeusingHardwareAccelerationEnablehardwareaccelerationinChromiumReducescreentearing(Update20.08.2020)PossibleIssue:RaspberryPiHDCamera-ENOSPCerror Twomonthsago,IwroteatutorialthatexplainshowtogetDRMsupportonChromiumontheRaspberryPi.Ifyoufollowthestepsofthattutorial:RaspberryPi:AmazonPrime,Netflix,etc.andaDRMsolution!youcanusetheChromiumwebbrowsertoplayvideosfromNetflix,Hulu,HBO,Disney+,AmazonPrime,Spotify,Pandora,andmanyothers(seeFig.1&2).Fig.1:PlayingvideosonAmazonPrimeusingChromiumontheRaspberryPiOS.Fig.2:PlayingmusiconSpotifyusingChromiumontheRaspberryPiOS.AnthonyDwroteinthecommentsection:ThatisagreatsolutiontotheDRMproblemonRaspberryPi!HowisthevideoplaybackqualityinChromium?DoyouknowifituseshardwareaccelerationorjusttheCPU?LastweekIhadsometimetorunsometestsandextendedthetutorialtoaddsupportforhardwareaccelerationforthevideodecoding.Toanswerthatquestion,thevideoplaybackqualityisgood,however,perdefaultChromiumusesSoftware(CPU)todecodethevideo.Thismeans,nohardwareacceleration.Fig.3:GraphicsFeatureStatus-ChromiumonRaspberryPi4.But,wewillchangethatonthistutorial!Youmaybealsointerestedinthistutorial:RaspberryPi4:bootingfromanSSDwithenabledTRIMHardwareandSoftwareYouwillneedthefollowinghardwareandsoftwareforthistutorial:DIY:VideoDecodeusingHardwareAccelerationYouneedtoinstallafewlibraries,butfirst,thebasicstepistoupdatethesystemtypingthefollowingonaTerminal: sudoapt-getupdate sudoapt-getupgrade Then,installthelibrariestyping: sudoapt-getinstalllibgles2-mesalibgles2-mesa-devxorg-dev Tobeabletoactivatethehardwareacceleration,firstweneedtoenablethe3Dvideodriver(so-calledFakeKMS),andthensetthememorytoe.g.128MB(thisisusuallyadefaultvalue). Todothat:Starttheraspi-configconfigurator,typinginaTerminal: sudoraspi-configGotoAdvancedOptions>GLDriverSelecttheoptionGL(FakeKMS)OpenGLdesktopdriverwithfakeKMSandClickOKGotoPerformanceOptions>GPUMemory(onoldRaspbian/RaspberryPiOS:AdvancedOptions>MemorySplit)Type128andclickOKSelectFinishandRebootthesystem.Note:ifyou'renewtothisconfigurator,youcannavigatethemenuusingthearrowsandthetabkeyfromyourkeyboard.OnceyourRaspberryreboots,youcancheckthatthe3Ddriversareloadedandworking: cat/proc/device-tree/soc/firmwarekms@7e600000/status cat/proc/device-tree/v3dbus/v3d@7ec04000/status #onRaspberryPi3thev3dbuscommandshouldbe(providedbyAlexisinthecomments): cat/proc/device-tree/soc/v3d@7ec00000/status Ifbothcommandsreturnokay,thenthehardwareaccelerationisworkingandactivated.EnablehardwareaccelerationinChromiumIfopenaChromiumandgotochrome://gpu,youwillstillgetFig.1.Tochangethat,weneedtogotochrome://flagsandsearchforOverridesoftwarerenderinglistGPUrasterizationOutofprocessrasterizationHardware-acceleratedvideodecode(onlyavailableonthenewversionsofRaspberryPiOS)andchangethosesettingstoEnabled(seeFig.4a/4b).Afterrestartingthewebbrowser,youcanrefreshchrome://gpuandyouwillgetFig.5.Fig.4a:Chromiumflags-SettingflagstoactivatetheHardwareAcceleration(oldRaspbian/RaspberryPiOS).Fig.4b:Chromiumflags-SettingflagstoactivatetheHardwareAcceleration(newRaspberryPiOS).Fig.5:GraphicsFeatureStatus-VideoDecode:Hardwareaccelerated.Youcancheckifavideoisdecodedusinghardwareorsoftwarecheckingthechrome://media-internals/URLwhileplayingit.Fig.6showsthesoftwaredecoder(beforethechanges).Fig.7indicatesthattheMmalVideoDecoderdecoderisbeingused(afterthechanges).ThisistheBroadcom’slibraryforH.264hardwareaccelerationontheRaspberryPi.Fig.6:Mediainternals-SoftwareDecoderFig.7:Mediainternals-HardwareDecoderReducescreentearing(Update20.08.2020)Youwillstillgettheoccasional"screentearing".Youcanfindmoreinformationaboutthisontheforumtopic.Thesolutionistodisablethexcompmgrcompositionmanager.Todothat,youcanmove/removethexcompmgr.desktopfiletyping: sudomv/etc/xdg/autostart/xcompmgr.desktop/home/pi/backup.xcompmgr.desktop sudoreboot oryoucanfollowthesesteps:Starttheraspi-configconfigurator,typinginaTerminal sudoraspi-configNavigatetoAdvancedOptions>Compositor>xcompmgrcompositionmanagerChooseNoReboottheRaspberryPi sudorebootThatshouldresolvemostissues!Istillnoticedabitofscreentearing.PossibleIssue:RaspberryPiHDCamera-ENOSPCerrorAfteractivatingtheGPUaccelerationinChromium,IgotthefollowingerrorwhiletryingtotakeaphotowiththeHDcameraandplayingsomeYoutubevideo. #raspistill-o/tmp/capture.jpg mmal:mmal_vc_component_enable:failedtoenablecomponent:ENOSPC mmal:cameracomponentcouldn'tbeenabled mmal:main:Failedtocreatecameracomponent mmal:Failedtoruncameraapp.Pleasecheckforfirmwareupdates IncreasingtheCPUmemoryfrom128to144madetheerrorgoaway: sudoraspi-config #oldRaspbian/RaspberryPiOS: #7AdvancedOptions>A3MemorySplit #newRaspberryPiOS: #4PerformanceOptions>P2GPUMemory Fig.8:ExtendingtheCPUMemoryusingraspi-configIdescribedtheissueaspossible,becauseItriedtoreproduceitanddidnotgettheerroragain.However,Iwroteithere,incasesomeoneneedstodealwithit.Relatedposts#RaspberryPi:AmazonPrime,Netflix,Disney,Spotify-aDRMofficialsolution#RaspberryPiHQCamera:AutofocusfortheTelephotoLens(JiJi)#RaspberryPi4:bootingfromanSSDwithenabledTRIM#RaspberryPi4B:Sometimesit'scooltobehot-orwarm,tobeexact;)-#RaspberryPi4B:Real-TimeSystemusingPreempt-RT(kernel4.19.y)#RaspberryPi4B:HowmuchfasteristhenewCPU?#RaspberryPi4B:Wherewerethequalitycontrols?#TI:Connectingthetm4c1294xltoaov7670CommentsFabien08.13.2020Thankyouforyourarticle! Ihavetryitanditworksfineforuserpi,butforastandarduserwithlessprivileges,chromiumusesffmpegVideoDecoderinstedofMmalVideoDecoder.PErhaps,youhaveasolution?permalinkreplyLen08.14.2020Thanksforthetip.InowhaveChromiumusingthehardwareacceleration,butvideoisstillquitechoppy.Ohwell...permalinkreplyshowallrepliesandrevandenbrink08.14.2020HiThanksforyourexplanationtogethardwaredecodingworking.Ihavearpi3B+.Shouldthisalsowork? IfollowedyourinstructionbutIseeinthedevice-treethatthev3dbusfolderisnotthere. Isthereanotherprocedurefortherpi3B+?RegardsAndrevandenBrinkpermalinkreplyshowallrepliesDavid09.15.2020WorkinglikeacharminaRaspberry4andaRaspberry3B+. Whytheheckisn'titenabledbydefault? Thankyou.permalinkreplyshowallrepliessanjay11.02.2020HELLO, IHAVEPI4,THECHROMIUMBROWERSUSESMMALDECODERWHENPLAYINGYOUTUBE.BUTAMAZONPRIMESTILLUSESSOFTWAREDECODER:DECRYINGVIDEOCODER SOMETHINGWRONG? thanks sanjaypermalinkreplycmoney11.14.2020Interestingly,amazonprimevideoworkedfinebeforeallofthosegpusettings.NowIcan'tundoanyofthoseandI'mgettingtheerrormessagethatIneedtoupdatetheWDLImodulebutIcan'teverupdateit:(permalinkreplyemwtur12.15.2020Worked,ithink-butIlostHDMIsound:-(permalinkreplyshowallrepliesbrentil12.29.2020Sincethiswaspublishedsomeoftheitemshavechanged.InChrome86youhavetoalsoenabletheflag"Hardware-acceleratedvideodecode"Alsoinraspi-configthereisnolongeraMemorySplitmenuunderAdvanced.It'snowunderPerformanceOptions->P2GPUMemory.InoticedanewoptioninChrome86underGPUforusingVulkan,Imightexperimentturningitonlatertotest.permalinkreplyshowallrepliesRick02.26.2021UsingRaspOSDeb10.8,thereare2browserversions,ChromiumandChromium-Browser. Thefilenamesanddependenciesaredifferent.IhadalreadyinstalledChromiumv88beforeIdiscoveredyourtutorials.Yourscriptsfailasthedirectorynamesare/chromiumnot/chromium-browser.IsitpossiblethattheChromiumversionalreadyhasDRMsupport?permalinkreplyMostafa05.23.2021Thankyouforyouramazingnotes.Areyouabletostreamh264fromyourraspberrypicamera?Iused v4l2-ctl-d/dev/video0-vpixelformat=H264-V tosetthecameraencodingtoh264anditreturnsbacktoMJPGassoonasIopenawebapplicationthatusesthecamerasuchasJitsiWebMeetpermalinkreplyTJJaz07.26.2021OntheRaspberryPi4BIhadproblemswithvideosnotplayingandgraphicsonChromepagesloadingall"choppedup".Ifollowedthestepsonthispageuptothe"cat/proc/device-tree/v3dbus/v3d@7ec04000/status"line-got"okay"responsestoeach.WhenIopenedChromium,thewindowwasallchoppedupandunusable.Imadethingsworsethanbefore!permalinkreplyAlForster09.04.2021Sept3,2021-Aftermakingyourchanges,inYouTubeTVIstillget"Sorry,therewasanerrorlicensingthisvideo".ChromeworksfinerunningYouTubeTVonaMacrunningCatalina,butRunningTwisterOSona8gbRaspberryPi4bIgetthaterror.Anysuggestions?permalinkreplyLawrie10.27.2021IfollowedthestepsbutIcan'tenableoutofprocessrasterizationorhardwareaccelerationasthey'rebothintheunavailabletabinexperiments.I'musingpi4,raspbian10,everythinguptodateandthecommandstocheckthehardwareaccelerationreturn"okay"permalinkreplyMIke12.02.2021HelloeverybodyunderDebianBuster,AARCH64,Pi400,Chromiumdoesn'tseemtohavethe"chrome://flags/#enable-accelerated-video-decode"flaganymore.Thehowtomentionedabovedoesn'tworkanaymore,Ijustgetthe"FFMPEGVIdeoDecoder"nottheMojoVideoDecoderanymore.WhatamIdoingwrong?permalinkreplyKRis12.12.2021Imrunningthe"2021-10-30:BasedonDebianversion11(bullseye)"RaspberryPiOS,andiexperiencethesameasMike,thatthe"chrome://flags/#enable-accelerated-video-decode"isnotavailable.It'sfiledinchrome://flagsas"Unavailable"andalsostates"Notavailableonyourplatform".I'mrunningRaspberryPi44GB.permalinkreplyshowallrepliesYourcommenthasbeensubmitted!LeMaRiva|techwillcheckitandpublishit.Thanksforwaiting!Yourcommenthasbeenupdated!LeMaRiva|techwillcheckitandpublishit.Thanksforwaiting!Sometingwentwrong!Reloadthepageandtryagain! CancelPleaseconsidersupportingusbydisablingyouradblocker.TrendingPostsLast7Days#RaspberryPi4:Hardwareacceleratedvideodecoding(GPU)inChromium4min|123573#RaspberryPiHQCamera:AutofocusfortheTelephotoLens(JiJi)7min|46813#Portainer:ManagingDockerEnginesremotelyoverTCPsocket(TLS)4min|26976#MicroPython:VisualStudioCode(VSCode)asIDE3min|62974#RaspberryPi4B:Real-TimeSystemusingPreempt-RT(kernel4.19.y)7min|65660BlogTopicsAnalytics(10)AndroidThings(15)CloudPlatforms(9)General(18)Hacking(5)HomeAutomation(11)M5Stack(18)MicroPython(48)LoRa/LoRaWAN(6)PCB/Boarddesigns(6)ProductReviews(20)RaspberryPi(27)RealTimeSystems(9)TravelPhotoset(2)Single-boardComputers(3) &nbsp&nbsp&nbspSubscribe!TermsofUsePrivacyPolicyDisclaimerSubscribetoourmailinglist:SelectthecontactfrequencyfromLeMaRiva|tech:InformmeeverytimeanewarticleispublishedGetperiodicsummariesandotherinterestingnewsGetnewdealsYoucanunsubscribeatanytimebyclickingthelinkinthefooterofouremails.WeuseMailchimpasourmarketingplatform.Byclickingbelowtosubscribe,youacknowledgethatyourinformationwillbetransferredtoMailchimpforprocessing.LearnmoreaboutMailchimp'sprivacypracticeshere.subscribe BlogAboutMe!Contact



請為這篇文章評分?