-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raspberry Pi 4 HEVC support #714
Comments
No. omxplayer only supports GPU HW codecs. hevc has an arm side decoder. HEVC support will come to VLC in raspbian, and is available in Kodi. |
Came across this after struggling to play 1080p HEVC videos on RPi4. @popcornmix I see patches from your https://github.com/popcornmix/FFmpeg/tree/2711 branch are used by LibreELEC folks to enable HEVC playback with hardware decoding. I've applied them to ffmpeg 4.1.3 (Raspbian) and was able to build it with a few small hacks. Any ideas how to get it working? |
The HEVC hardware uses custom pixel formats that ffmpeg doesn't understand. ffmpeg needs a pixel converter to get frames into standard YUV420P format which will allow ffmpeg to be used for transcode and ffplay. This is being worked on. But that format conversion will be too slow for real time 4K video (and possibly also 1080p). vlc is being worked on to support hw decode and display of the opaque buffers that kodi uses and that is our recommended solution for HEVC playback from the desktop. |
@popcornmix OK I get it. I will try the kodi route. Found your https://github.com/popcornmix/xbmc/tree/leia_pi4 branch. Will try to compile it now. Anything special I should do other than: |
leia_pi4 is a temporary hack using mmal. For kodi 19 we are dropping mmal and using gbm + v4l2.
But if you really want the hacky leia_pi4 support you need to do a little surgery to make it build as it needs firmware mmal headers and pc files but not the opengl ones. I build with:
and I've copied to /home/pi/projects/kodi/vc/lib/pkgconfig |
Trying the leia_pi4 branch first, as I am after HEVC hardware support. Will try kodi 19 later as well. If I get this working, man, I am buying you a beer (or coffee -- whichever you prefer). |
@popcornmix managed to compile leia_pi4 branch. 🎉 In addition to your hacks had to do: mv /opt/vc/include/{GL,GLES,GLES2} /opt/vc/ h.264 1080p files play well, but when I tried one of the h.265 1080p files, kodi segfaults (see attached). 😕 Any pointers?.. |
Probably a permissions issue. Can you add:
to (e.g. line following This may be a default after apt upgrading (at least it's in the pipeline to be pushed out). |
@popcornmix yep, figured it out as well. Gave meself access to all
|
You need quite a high gpu_mem setting for hevc. 320 may be needed for 4k files. |
@popcornmix my man, I owe you a beer... or two... or a coffee, if you don't drink beer. 😄 It's working like a charm and I can play my HEVC 1080p videos. 🎉 Gotta paypal.me link? |
No need for a donation. Glad you got it working! |
@popcornmix OK, well thank you for your help my friend. You've made my day. Would you mind if I made a .deb out of it and posted on the RaspberryPi forums for all the nice people to start abusing their shiny RPi4s? |
Go ahead. I'm sure that would be very useful. |
Have you uploaded it yet somewhere ? Could really use a (working) RPi4 build for kodi. |
@Zerwin follow the white rabbit: https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=246837 |
Hi folks, however: Driver in use:
and hevc playback from a local file:
Thanks, |
Latest kodi in raspbian should just work (uses rascas' build). |
Sounds good, where is the source code for this, I am running GNU/Gentoo Linux here... and my ebuild is currently pointing to github's xbmc/xbmc.git master's branch. |
It's built from https://github.com/popcornmix/xbmc/tree/leia_pi4 |
Hey, thanks for this, I already tried it before, is it supposed to compile on a 64bit architecture? I use aarch64 here. The compile error I get is:
And my cmake configuration looks like: Cheers, P.S. dropped you an email, but not sure if that made it through? |
Compiling kodi on 64-bit isn't something I've tried.
might help (but I suspect that isn't the only change required) |
Thanks for the patch. I tried it, however it still complains about the same negative size of array:
I do not want to further pollute this issue, if you are interested into supporting this for aarch64, then I can open another issue against your xbmc repo. If not, then I will just wait until it works through mesa's gles. Cheers, |
Kodi should build and run with mesa gles from the upstream kodi repo. There is a plan for upstream kodi to work with ffmpeg/v4l2 for hw decode but that is not ready yet. |
That is correct. For me, compiling for gbm or x11 does not bring a lot of a difference when software decoding hevc, thus I am avoiding GBM for now just because it is more handy to have the kodi-x11 binary when running it from inside a DE. When compiling it for for x11, what difference does the following combinations bring: Do I need to have upstream ffmpeg compiled with: Cheers, |
There is a version of vlc with HEVC support available for testing: |
Great, where is the source code for it? To answer my previous question, if compiling kodi with: the configuration script automatically adds OPENGL, as the above is invalid configuration, OPENGLES depends on enabled OPENGL. |
It's a debian package, so get the source from apt: |
Do you happen to know if a change control repository exists? Something like the newclock5 branch in your github xbmc fork? |
The patches used for vlc and ffmpeg live here: |
Thanks, unfortunately mmal is not supported on aarch64, as per CMakeFiles.txt of https://github.com/raspberrypi/userland:
ffmpeg build fails at configure time due to:
|
Hi @popcornmix, I've already upgraded the kernel to 5.4.28 to include the v4l hevc patches. |
You'll need patched ffmpeg anyway - it doesn't support (stateless) v4l2 natively yet. |
Tried to run a 1080p MKV Movie HEVC h.265 via Kodi Got this:
Then this via kodi_crashlog-20201002_173516.log
############### END LOG FILE ################ ############ END Kodi CRASH LOG ############# |
Perhaps related to: |
@cyoussef8 this isn't the place to report kodi issues. |
@popcornmix Increasing the gpu_mem fixed the issue!! THANK YOU SO MUCH! |
@popcornmix may I ask where did you get the information that allowed you to write this patch? I've been googling and binging and duckduckgoing but wasn't able to find anything official about how the hevc hw acceleration should be handled. No documentation, nothing. Your patch is the only thing I was able to find. |
You mean the gpu_mem setting? Many places but if you are using kodi under RpiOS then here:
That setting gets stored on gpu_mem in config.txt |
no I mean how did you implement the hevc support for ffmpeg? What kind of information did you use to get there? It seems that the whole thing is very low level and poorly documented so I'm trying to get my hands on more info so I can understand how it works. |
It was based on test code provided by the guys who designed the hardware. |
Cool. Is this test code available somewhere? |
The test code provided was the first commit in https://github.com/popcornmix/FFmpeg/tree/2711 |
oh I see, ok thanks, I'll take a look at it again |
@popcornmix I'm trying to compile your patched ffmpeg. I have some issues but since there's no way of posting issues there, I'll just go ahead and ask in this thread. I'm getting
The way the hw accelerations are bootstraped in the code is a bit magical and hard to follow for me so I wasn't able to find a solution. My configuration is this
Any ideas? |
That tree is very outdated. New development is being done here: and that would be a better place to start. |
the raspberry pi 4 is now out with hevc hardware decoding. is hevc support is coming to the omxplayer?
The text was updated successfully, but these errors were encountered: