- 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)?
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: ↑Thu Oct 21, 2021 1:05 amYep, like I said "magic".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?
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 ;)
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.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.Does that mean Pi's can now play MPEG2s without license?As of February 14 2020, MPEG-2 Patents have expired worldwide, with the exception of only Malaysia.
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.
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.
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)?
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
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
Re: All about accelerated video on the Raspberry Pi (check my notes)?
But disabled, turned off or not used.from what i know of the hardware, the pi4 is also capable of mpeg2 hw decode
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
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)?
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
Re: All about accelerated video on the Raspberry Pi (check my notes)?
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
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:
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
FFmpeg compile time on the weekend.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.
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
Raspberries are not Apples or Oranges
Re: All about accelerated video on the Raspberry Pi (check my notes)?
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.
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
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!]
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.
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.
Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]
Just a reference to updated ffmpeg v4l2m2m encoder code, for those looking: viewtopic.php?p=1933445#p1933445
Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]
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.
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.
Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]
It's super early days, but perhaps consider https://github.com/egnor/pivid ?kleurbleur wrote: ↑Sun Feb 06, 2022 9:46 amOn 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.
- 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!]
That does look interesting.egnor wrote: ↑Wed Sep 21, 2022 5:16 pmIt's super early days, but perhaps consider https://github.com/egnor/pivid ?
- cooperbang
- Posts: 20
- Joined: Thu Dec 29, 2022 12:09 pm
Re: STICKY: All about accelerated video on the Raspberry Pi [thanks all contributors!]
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.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.
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!]
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.cooperbang wrote: ↑Wed Jan 04, 2023 11:45 amShould it be possible to play 4k60p videos with VLC and Raspberry Pi 4 (Full KMS)?
What settings are necessary to activate hardware decoding?
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!]
Thanks for clarification.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.
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!]
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).
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!]
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?
Is there a list of applications supporting hardware accelerated video playback?
What about ffplay or mpv? Are there any experiences?
Return to "Graphics programming"
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- Raspberry Pi Official Magazine
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Media centres
- Gaming
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Keyboard computers (400, 500, 500+)
- Raspberry Pi Pico
- General
- SDK
- MicroPython
- Other RP2040 boards
- Zephyr
- Rust
- AI Accelerator
- AI Camera - IMX500
- Hailo
- Software
- Raspberry Pi OS
- Raspberry Pi Connect
- Raspberry Pi Desktop for PC and Mac
- Beta testing
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion