We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

66 posts
6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 18476
Joined: Wed Dec 04, 2013 11:27 am

Re: All about accelerated video on the Raspberry Pi (check my notes)?

Thu Oct 21, 2021 6:29 am

Gavinmc42 wrote:
Thu Oct 21, 2021 1:05 am
but i suspect the DRM api in linux doesnt allow spreading a framebuffer over 2 outputs?
so it might be converting your frame into a 3d texture, and then rendering 2 scenes, one per monitor?
Yep, like I said "magic".
Play half height 4K vids?
I don't have time to watch 4K or low res movies, to busy learning how the Pi's can do it at all.
Hmm, a USB DVD player on the shopping list, purely for testing of course ;)
DRM quite happily lets you set a source rectangle, as that is how X handles extended desktops. It renders the complete desktop as a single buffer, and then tells each DRM device which bit to display.
Gavinmc42 wrote:I don't remember any portable Pi based DVD players.
Ah, MPEG2 and license file, that's why I am clueless re DVD.
As of February 14 2020, MPEG-2 Patents have expired worldwide, with the exception of only Malaysia.
Does that mean Pi's can now play MPEG2s without license?
That codec is old, low res these days, a Zero should be able to play it.
https://github.com/chetbox/raspberry-pi-dvd-player
Non stop learning with Pi's.
A Pi2 decodes SD MPEG2 on the CPU without breaking a sweat - my TV viewing Pi is a Pi3 doing SD MPEG-2 or HD H264 off tvheadend DVB-S2 and DVB-T2.
Pi 0/1 need the codec licence. It is still licenced as otherwise you need to region lock Pis to stop sale in Malaysia where patents still apply. If we could make MPEG2 free to use then we would as it's an admin hassle.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

cleverca22
Posts: 9593
Joined: Sat Aug 18, 2012 2:33 pm

Re: All about accelerated video on the Raspberry Pi (check my notes)?

Thu Oct 21, 2021 10:32 am

from what i know of the hardware, the pi4 is also capable of mpeg2 hw decode

but its so fast that you dont need the hw accel
so its simpler to just run away from that patent fee mess, and disable it in software

Gavinmc42
Posts: 8346
Joined: Wed Aug 28, 2013 3:31 am

Re: All about accelerated video on the Raspberry Pi (check my notes)?

Fri Oct 22, 2021 2:10 am

from what i know of the hardware, the pi4 is also capable of mpeg2 hw decode
But disabled, turned off or not used.
When does Malaysian Patents expire?
Turn on MPEG2 decode then?
https://bryanquigley.com/pages/mpeg2-pa ... acker.html
Could be a long wait.

How much power saving is there using the hardware to decode MPEG2?
If MPEG2 support has been remove from Pi4, is it permanent?
Mpeg2 is probably so light in CPU power to decode it won't make much power difference.

A good test for AV1 decoding are these, Meridian plays with a few glitches in Chromium 90
https://linuxreviews.org/AV1
Dollhouse is too much for a 2GHz Pi400, but it did decode some images and sound.
I think 3 CPUs are being used as Meridian runs at about 75% on the CPU usage display.
Chromium is also using libaom not dav1d?

It also looks like VLC is maybe using libaom too.
Might have grab the source and compile it now that I have the latest dav1d installed.
Some configuring needs to be done or is it auto?

Grabbed as many AV players as I could, many are too old to recognized AV1.
Looking for a simple AV player that can handle just the dav1d AV1 decoder.
Might have to make one myself, more learning ;)
That could lead to a small standalone YT AV1 vid player.

Hope AV1 decoding hardware is in the next Pi :D
Broadcom have that tech already, BCM7218X.....
Pi4's get a bit toasty, AV1 in hardware on a Pi5 would make sense.

Interesting white paper on Broadcam, render to 960x540, blit to 940x1080 and then use the hardware scaler to make it 1920x1080.
This makes me wonder how they get 4K on a Pi4.
How to test 4K without 4K screen?
H.264 will do 4K from storage? H.265 will do 8K, 4K steaming, H.266 will do even lower bit rate 4K,8K,16K streaming?

The more I learn about codecs the less I know.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

cleverca22
Posts: 9593
Joined: Sat Aug 18, 2012 2:33 pm

Re: All about accelerated video on the Raspberry Pi (check my notes)?

Fri Oct 22, 2021 2:29 am

Gavinmc42 wrote:
Fri Oct 22, 2021 2:10 am
But disabled, turned off or not used.
If MPEG2 support has been remove from Pi4, is it permanent?
my understanding is that the same hw block is used for vc1, mpeg2, and h264 encode/decode
its purely a matter of the closed-source firmware including the routines needed to drive it in mpeg2 mode, and allowing it on a pi4

Gavinmc42
Posts: 8346
Joined: Wed Aug 28, 2013 3:31 am

Re: All about accelerated video on the Raspberry Pi (check my notes)?

Fri Oct 22, 2021 3:09 am

With added H265 hardware block in the VC6.
All secret sauce recipes.
Not sure what the H265 block could be repurposed for.
https://en.wikipedia.org/wiki/High_Effi ... deo_Coding

Hmm DCT/DST are handy math functions for FFTs.
Hellopi/hellofft is/is not using these blocks?
Ahh, that's the old OMX/MMAL.
https://github.com/popcornmix/FFmpeg/tree/2711

Back to Ffmpeg, I tried but ffplay did not like AV1 files.
Looks like ffmpeg source is going on be siting on my SSD :D
libdav1d allows libavcodec to decode the AOMedia Video 1 (AV1) codec. Requires the presence of the libdav1d headers and library during configuration. You need to explicitly configure the build with --enable-libdav1d.
FFmpeg compile time on the weekend.

Messing with that dav1d source Arm assembler to use the H.265 blocks?
Wonder if anyone is doing that?
Documentation for H265?
AV1 seems to be comparable with H266, tweaking it just a bit more for Pi's would be good.
Look at the h265 source part of ffmpeg?
More to learn :lol:
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Gavinmc42
Posts: 8346
Joined: Wed Aug 28, 2013 3:31 am

Re: All about accelerated video on the Raspberry Pi (check my notes)?

Fri Oct 22, 2021 5:15 am

Yippee, time to get serious with Vulkan again.
https://www.phoronix.com/scan.php?page= ... Vulkan-1.1
As far as I know 1.2 is just software, no difference in hardware.
If some of the hardware is emulated in 1.1 it might take some time.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

kleurbleur
Posts: 12
Joined: Sun Feb 06, 2022 9:37 am

Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]

Sun Feb 06, 2022 9:46 am

On the RPi4 and the latest Bullseye I am in need of playing back video files smoothly and reliably from Python for exhibitions and other (semi-) permanent installations. The advice that VLC is the way to go might be fine for people trying to watch a movie now and then, the reality is that VLC is not yet where it should be for the kind of playback I need. Problems involve smooth looping playback, fullscreen on second displays and general bugs that make VLC not start at all.
This is on the current 32bit version of Bullseye, on the 64bit it is even worse for the upcoming time to come.

The only solution that worked for me is to switch back to the FKMS driver, do an rpi-update and use omxplayer.

hydra3333
Posts: 333
Joined: Thu Jan 10, 2013 11:48 pm

frog-o
Posts: 3
Joined: Wed May 18, 2022 11:56 am

Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]

Thu May 19, 2022 7:52 pm

I don't know if it be any use to you ,but I started a form post at
viewtopic.php?p=2003692#p2003692 . IMHO Knowing how to update the video drivers,firmware and user space library IMHO is very Important for accelerated video, Really IMHO we need a book to cover this completely. I hope it be like and made sticky one day but I am not no LINUS.

egnor
Posts: 84
Joined: Fri Aug 06, 2021 6:04 am

Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]

Wed Sep 21, 2022 5:16 pm

kleurbleur wrote:
Sun Feb 06, 2022 9:46 am
On the RPi4 and the latest Bullseye I am in need of playing back video files smoothly and reliably from Python for exhibitions and other (semi-) permanent installations. The advice that VLC is the way to go might be fine for people trying to watch a movie now and then, the reality is that VLC is not yet where it should be for the kind of playback I need. Problems involve smooth looping playback, fullscreen on second displays and general bugs that make VLC not start at all.
It's super early days, but perhaps consider https://github.com/egnor/pivid ?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8471
Joined: Wed Aug 17, 2011 7:41 pm

Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]

Thu Sep 22, 2022 11:35 am

egnor wrote:
Wed Sep 21, 2022 5:16 pm
It's super early days, but perhaps consider https://github.com/egnor/pivid ?
That does look interesting.

cooperbang
Posts: 20
Joined: Thu Dec 29, 2022 12:09 pm

Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]

Wed Jan 04, 2023 11:45 am

GL with Full KMS ("dtoverlay=vc4-kms-v3d" in config.txt)
This is the recommended setting and the default for Bullseye.
In this mode, DRM and KMS directly manage the GPU without relying on proprietary VideoCore VPU firmware.
V4L2 still wraps MMAL as above.
The X server renders to DRM and uses KMS to switch modes, using "fbturbo" as above.
OpenGL is available via the "VC4" and "V3D" Mesa drivers as above.
KMS/DRM can be used for hardware compositing (overlay planes), but only by one display client at a time.
DispmanX and OMX are NOT available, as the kernel has taken over the GPU. Programs like omxplayer do not run.
MMAL is still available (?? somehow ??).
VLC uses MMAL for hardware decompression, and runs reasonably well.
Chrome can use MMAL for video playback but it needs to be enabled.
I ́ve tried to play 4k 60fps (h.265) videos with VLC 3.0.18-0 (Raspberry Pi OS Bullseye) but it seems hardware decoding doesn ́t work.
The videos are stuttering and CPU usage of all cores is close to 100%.

Should it be possible to play 4k60p videos with VLC and Raspberry Pi 4 (Full KMS)?
What settings are necessary to activate hardware decoding?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8471
Joined: Wed Aug 17, 2011 7:41 pm

Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]

Wed Jan 04, 2023 12:12 pm

cooperbang wrote:
Wed Jan 04, 2023 11:45 am
Should it be possible to play 4k60p videos with VLC and Raspberry Pi 4 (Full KMS)?
What settings are necessary to activate hardware decoding?
You should be getting hw decode in any case (with default settings) but playback in a desktop window (especially when video size and/or window size is above 1080p) will have poor performance. That just down to inefficiencies of X. It could improve in the future with wayland.

Running full screen will have better performance as the decoded video frames can be directly displayed in hardware.

cooperbang
Posts: 20
Joined: Thu Dec 29, 2022 12:09 pm

Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]

Wed Jan 04, 2023 1:31 pm

dom wrote: You should be getting hw decode in any case (with default settings) but playback in a desktop window (especially when video size and/or window size is above 1080p) will have poor performance. That just down to inefficiencies of X. It could improve in the future with wayland.

Running full screen will have better performance as the decoded video frames can be directly displayed in hardware.
Thanks for clarification.
Is it necessary to stop lightdm / X Server completely to get full decoding performance or is it enough to start VLC in fullscreen mode e.g. with "cvlc -f video.mp4"?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8471
Joined: Wed Aug 17, 2011 7:41 pm

Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]

Wed Jan 04, 2023 1:48 pm

Fullscreen mode of VLC should have hardware display whether launched from inside X or outside.

Performance may be a little better when launched from outside X, due to fewer GUI processes and less RAM in use (and you'll certainly be able to run with less cma). But I think the performance difference is generally small (compared to windowed vs full screen).

cooperbang
Posts: 20
Joined: Thu Dec 29, 2022 12:09 pm

Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]

Fri Jan 13, 2023 12:51 pm

Are Kodi and VLC the only applications supporting accelerated videos on RPi 4?

Is there a list of applications supporting hardware accelerated video playback?
What about ffplay or mpv? Are there any experiences?

66 posts

Return to "Graphics programming"

AltStyle によって変換されたページ (->オリジナル) /