
Show HN: Pi4 dual display/4K and HEVC/H265 support - dividuum
https://info-beamer.com/blog/dual-display-or-4k-and-hevc-on-the-pi-4
======
dividuum
Hey. It took around two months of digging into (sometimes undocumented) APIs
to get this one working on the Pi4. The player software ("info-beamer pi") can
now use DRM/dispmanx/MMAL to place videos, either decoded using the
traditional H264 decoder or the new HEVC decoder, on one or two displays
connected to the Pi4. The raw software is also used at the core of the custom
info-beamer OS that is used in the "as a service" digital signage solution. On
the linked page there's a demo package that you can install with a few clicks
on your own Raspberry Pi if you want to try everything out. Happy to answer
questions.

------
kup0
Is there a non-hosted version of this?

~~~
dividuum
Kind of. Originally, info-beamer for the Pi started as a standalone binary
intended to run on Raspbian. This product (info-beamer pi) is still available
and has also been updated to support HEVC playback. See here: [https://info-
beamer.com/product/info-beamer-pi](https://info-beamer.com/product/info-
beamer-pi)

As for usability: It's really "raw". So you have to manually create the
content/code directory and start the tool pointing it to that directly.
There's no UI, remote management or any other advanced features that you might
expect. That's also the reason info-beamer hosted go started in the first
place: The technical knowledge required to run the software was to much. The
hosted solution fixes all this and adds a complete OS, trivial installation
and remote management system around info-beamer pi.

~~~
kup0
Thanks for the reply and detailed explanation. I've been messing around with
dashboards/signage just in a personal capacity (hobby/fun) which was what
initially spawned my question.

------
solstice
I've got nothing of substance to comment on the technical aspects of the
project but I find it amusing that Germans create a lot of pseudo-English
words (Denglisch) such as "beamer" (projector) and "handy" (mobile phone). I
wonder how confusing this might be to anglophone people.

~~~
dividuum
In hindsight I should probably named everything differently, but I didn't
expect the software to turn into a company at some point when I initially
started it over 8 years ago for a hacker conference (see
[https://github.com/dividuum/info-beamer](https://github.com/dividuum/info-
beamer)).

The main challenge was to understand how to use the HEVC decoder. There's no
documentation at the moment, so the only source of information is this patched
FFmpeg release:
[https://github.com/popcornmix/FFmpeg/commits/2711](https://github.com/popcornmix/FFmpeg/commits/2711)

Basically the decoder interacts with /dev/argon-hevcmem to control the HEVC
hardware decoder. You let it decode into video core controlled memory and can
then use the MMAL toolkit
([http://www.jvcref.com/files/PI/documentation/html/](http://www.jvcref.com/files/PI/documentation/html/))
to feed buffers through a scheduler and finally into the dispmanx layers
handled by the hardware video scaler. That way the frames end up more or less
directly on the screen. Except for the decoding part, the same pipeline of
scheduler and presentation can also be used with the older H264 based encoder
that's directly addressable using MMAL.

~~~
wronglebowski
This seems like a large oversight given people usually decide to use the Pi
for better documentation and support. The Pi 4 is being marketed as a "Real"
desktop replacement option and I find it very surprising HEVC decoding
documentation is this poor. So basically FFmpeg communicates with the HEVC
hardware decoder via a bunch of rough code? Is this stable?

~~~
dividuum
To be fair, these kind of low level stuff is usually handled by only a handful
people, so investing a lot of time in proper documentation might be a lot of
work for something useful by few users. The same is also true for DRM and in
general the modern graphical APIs on stock Linux. It was surprisingly
difficult to understand how all that works together. I had to rely mostly on
example code. Even the man pages are incomplete. I guess it's the same
situation: The kernel devs build an API, a few people (maybe even the same
people) from Xorg or wayland use it and that's it.

On the other hand, the initial Pi firmware for earlier models came with a
bunch of bundled examples in the hello_pi directory that were incredibly
useful in understanding how everything worked. (see
[https://github.com/raspberrypi/firmware/tree/master/opt/vc/s...](https://github.com/raspberrypi/firmware/tree/master/opt/vc/src/hello_pi)).
Right now the forum and maybe the firmware issue tracker is the only source of
information. In general, the direction of using more standardized APIs like
DRM, Mesa 3D for GL and so on seems like a good idea regardless. I guess we'll
just have to give all that more time.

The HEVC decoder is using a patched FFmpeg with direct communication with the
hardware API. In the future there will be an V4L2 API and corresponding method
in FFmpeg (see
[https://www.raspberrypi.org/forums/viewtopic.php?t=247897](https://www.raspberrypi.org/forums/viewtopic.php?t=247897)).
But that's not completed yet and there's no release date announced. I would
guess once that's out, the whole decoding process will be a bit cleaner than
it is today. But so far I works pretty well. I ran into a ton of firmware
lockups during development, but most of those are fixed now. One thing I
didn't manage to do yet is to decode two videos at the same time. That's
something the H264 decoder could do. See also
[https://www.raspberrypi.org/forums/viewtopic.php?f=70&t=2520...](https://www.raspberrypi.org/forums/viewtopic.php?f=70&t=252061)

