[Aug 6] Debian Stretch Minimal 64bit (0.7.8) / Ubuntu 18.04 Bionic LXDE Desktop Image (0.7.8) / Ubuntu 18.04 Bionic minimal 64bit / 32bit Image (0.7.8) / Ubuntu 18.04 Bionic Containers Image (0.7.8) / Stretch OpenMediaVault OS Image armhf / Stretch OpenMediaVault OS Image arm64 ( 0.7.8) - ROCK64 | [June 25] Stock Android 8.1 - ROCK64 | [June 19] Armbian (5.42) - ROCK64 | [June 19] Armbian (5.38) - PINE A64(+) / PINE A64-LTS / SOPINE

Project Inspiration | Get Started | IRC Logs | Forum Rules/Policy


How to do hardware decoding of video?
#1
So I have a Rock64 board and I want to leverage its hardware decoding and encoding abilities in an Emby server.  But for a start I'd be happy just to get any sort of hardware decoding working.  I tried out Armbian Stretch and wasn't able to get either of my HEVC test files to play smoothly out of the box.  (vainfo returned an error when trying to get a driver name, so evidently something needs to be installed that's not, but I'm not sure what...)  And there's very little instruction out there that I can find, so I'm not sure if this is an Armbian shortcoming or just a matter of me not knowing how to get all the pieces in place.

I'm interested in ayufan's images, but don't know if it's any easier to get hardware decoding working there than on Armbian...  Has anyone gotten hardware decoding working on these boards?  What OS works best and what needs to be installed/configured to get it working properly?
Reply
#2
(08-08-2018, 04:30 AM)SuperSaiyanCaleb Wrote: So I have a Rock64 board and I want to leverage its hardware decoding and encoding abilities in an Emby server....
I found in Emby server some code with "ffmpeg" and "DRM" API so setup your Emby server to use ffmpeg and DRM as output.
There are only few hw-accelerated possibilities - low-level MPP+DRM, gstreamer or ffmpeg API based players (including web browsers) like mpv (also in Kodi/LibreELEC), rkplayer, rkffplayer ... or simple acceleration testing utility.
Reply
#3
Doesn't Emby use its built-in ffmpeg by default?  How would I go about configuring those two things?  I don't see anything in any of Emby's settings that mentions ffmpeg or drm.  Armbian came with mpv installed, but it wasn't able to decode an HEVC test file I tried using hardware decoding.  The player spat out this error before falling back to software decoding:

Code:
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)

Which seems to suggest to me that there is something I need to install to allow hardware decoding to work...  Are there specific OS images that have all the needed components working out of the box, or is there a particular OS that at least can have the needed components installed/configured with some simple instruction?
Reply
#4
So is there no fleshed out procedure on how to use hardware decoding on this board in Linux yet?
Reply
#5
(08-12-2018, 02:45 AM)SuperSaiyanCaleb Wrote: So is there no fleshed out procedure on how to use hardware decoding on this board in Linux yet?
As I wrote hardware acceleration is fully supported on Rock64 (or many other Rockchip devices with MPP libraries).
The right questions:
  • Is your video player aware of this ?
  • Are you ready to configure your video player (ffmpeg based) to use hardware accelerated decoding ?
    • ffmpeg must be compiled with "--enable-rkmpp" and "--enable-libdrm"
    • video player must request "h264_rkmpp", "hevc_rkmpp", "vp8_rkmpp" or "vp9_rkmpp" decoder from ffmpeg
    • video player must handle/display "AV_PIX_FMT_DRM_PRIME" (DRM DMA buffers) format to render output to DRM plane (best with DRM atomic)
  • Are you ready to enhance/reprogram/redesign your video player to use hardware accelerated decoding chain ?
  • Are you able to contact developers of your video player to make this setup for you (for fee, beer or free) ?
If not, you should use MPV/KODI/rkplayer instead of your "randomly" chosen video player (from hundreds of available video players).
Reply
#6
(08-12-2018, 04:55 AM)mcerveny Wrote:
(08-12-2018, 02:45 AM)SuperSaiyanCaleb Wrote: So is there no fleshed out procedure on how to use hardware decoding on this board in Linux yet?
As I wrote hardware acceleration is fully supported on Rock64 (or many other Rockchip devices with MPP libraries).
The right questions:
  • Is your video player aware of this ?
  • Are you ready to configure your video player (ffmpeg based) to use hardware accelerated decoding ?
    • ffmpeg must be compiled with "--enable-rkmpp" and "--enable-libdrm"
    • video player must request "h264_rkmpp", "hevc_rkmpp", "vp8_rkmpp" or "vp9_rkmpp" decoder from ffmpeg
    • video player must handle/display "AV_PIX_FMT_DRM_PRIME" (DRM DMA buffers) format to render output to DRM plane (best with DRM atomic)
  • Are you ready to enhance/reprogram/redesign your video player to use hardware accelerated decoding chain ?
  • Are you able to contact developers of your video player to make this setup for you (for fee, beer or free) ?
If not, you should use MPV/KODI/rkplayer instead of your "randomly" chosen video player (from hundreds of available video players).

I do not pretend to use some special player, but in the assemblies from Ayufan can not normally use even MPV or SM Player, only through some cunning manipulation.

You can immediately make the person started the video and it is not played immediately in full screen, where it is not clear how to manage it, and about working with the playlist, I'm silent at all
Reply
#7
(08-12-2018, 04:55 AM)mcerveny Wrote: As I wrote hardware acceleration is fully supported on Rock64 (or many other Rockchip devices with MPP libraries).

So I can just slap Armbian on a microSD along with an HEVC-encoded MKV file and it will play as soon as I double-click the file or command mpv to play it? That's a rhetorical question, as I already know the answer is no. That's not a complaint, but apparently our definitions of "fully supported" differ. Since your post here was the first mention I've ever seen of MPP, I did some Googling on that and figured out how to hardware decode an HEVC file using ffmpeg and a null video output! (Currently am on ayufan's LXDE image.) But the same trick would not work with ffplay, and MPV would not play the file even if I specified the mpp decoder on the command line.

So tonight if I have time maybe I will see about switching back over to Armbian and see if I have any more luck with it. Some specific instructions on how to play a file with a given OS image would be awesome though...

Quote:If not, you should use MPV/KODI/rkplayer instead of your "randomly" chosen video player (from hundreds of available video players).

As I said, I'd be delighted to get videos playing on any media player you suggest. Also as I said before, and as continues to be the case so far, MPV hasn't worked. Or maybe I don't know what command to issue... Or what to install... Or what OS image works best... (All those things I was asking about in the first post...) Once I have playback working using the 'fully supported' method, I can see about working out my specific use cases after that. I just want to know what the elusive 'fully supported' method is... Undecided
Reply
#8
(08-14-2018, 07:23 PM)SuperSaiyanCaleb Wrote: ...I just want to know what the elusive 'fully supported' method is...  Undecided
So. The same questions for linux distribution:
  • Does your distribution have right kernel with MPP/DRM support (configured with CONFIG_ROCKCHIP_MPP_SERVICE, CONFIG_ROCKCHIP_MPP_DEVICE, CONFIG_DRM_ROCKCHIP ...) ?
  • Does your distribution have right libraries with compiled support for hardware acceleration (ffmpeg (--enable-rkmpp, --enable-libdrm), libdrm-rockchip, mpp, gstreamer (ROCKCHIPMPP/VPUDEC/RKXIMAGE)) ?
  • Does your distribution have right version of mpv player with compiled MPP/DRM support (mpv (with options --hwdec=rkmpp/--vo=gpu|drm/--gpu-context=drm)) ?
If not, you should not use "randomly" chosen distribution with generic compiled packages.
Try Ayufan combination: https://github.com/ayufan-rock64/linux-build/releases (https://github.com/ayufan-rock64/linux-kernel/releases) + https://launchpad.net/~ayufan/+archive/u.../+packages (read also videoplayback notes)
Try LibreELEC for Rock64: https://test.libreelec.tv/ or http://kwiboo.libreelec.tv/test/
(if does not work buy beer to ayufan, Kwiboo and LongChair and ask for repair)
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Running debian testing, web video blows :( dougunder 2 272 04-22-2018, 03:24 PM
Last Post: dougunder
  Hardware Status Monitoring? Leapo 4 555 03-31-2018, 06:30 PM
Last Post: NicoD
  Available video players with hw decoder support dlu 27 5,919 03-01-2018, 11:45 AM
Last Post: elik745i
Lightbulb MPP+DRM: low level API for video codecs and display (also 4k UHD+HDR+HLG) mcerveny 0 424 01-27-2018, 11:23 AM
Last Post: mcerveny
  H264 hardware encoder not work sueshieh 3 899 11-02-2017, 03:57 AM
Last Post: dalmate
  What is name of gpio hardware on a rock64? gene83 6 452 10-05-2017, 07:57 AM
Last Post: gene83

Forum Jump:


Users browsing this thread: 1 Guest(s)