Jump to content

Repository for v4l2request hardware video decoding (rockchip, allwinner)


Recommended Posts

On 7/23/2024 at 6:35 PM, alejor said:

Hi, I tried this with armbian bookworm and orange pi zero 3 worked flawlessly with h264 hwdec. Now... Armbian image are Ubuntu Noble 24.04, can you please create or recompile packages for that 24.04 distro? or give some instructions to create those packages? thank you!

That will take some time to set the whole setup; unfortunately it is not easy task to bring up a system which could be used easily to rebuild the packages, but will do in the future. Can't say when though.

Link to comment
Share on other sites

Hello all,

 

I tried the apt repo install instructions in the first post... but it seems that my armbian bookworm is still installing its own .deb package and not the one from the apt.undo.it repo

 

Is there an obvious step that I am missing?

 

What version of mpv should I have if I installed successfully?

 

Thank you in advance!!

 

(my target is orange pi zero 3)

 

P.S. I see that the debian repo (through my web browser) does not provide mpv.deb, but Ubuntu Jammy does... does this mean that the armbian-bookworm mpv.deb does not need the patches?

I also see that the available debs are 11 months old... perhaps if you could point to some instructions that work, we could do it ourselves and share the outcome.

Link to comment
Share on other sites

17 hours ago, robertoj said:

P.S. I see that the debian repo (through my web browser) does not provide mpv.deb, but Ubuntu Jammy does... does this mean that the armbian-bookworm mpv.deb does not need the patches?

Exacty, mpv in debian bookworm already has full support for drm-prime, so there is no need for a patched version of that

 

17 hours ago, robertoj said:

I also see that the available debs are 11 months old... perhaps if you could point to some instructions that work, we could do it ourselves and share the outcome.

the instructions that work are there, in the meantime it can be that mpv changed some default, actually I didn't check recently

Link to comment
Share on other sites

Quote

Hi, I tried this with armbian bookworm and orange pi zero 3 worked flawlessly with h264 hwdec.

I haven't been able to get it working, I also have the Orange Pi Zero 3 using the Debian 12 (Bookworm) [Build Date: Oct 14, 2024] image with the Minimal/IOT option.

I tried using mpv with the instructions at the beginning of the post on the Gnome and XFCE desktops, but both have the same negative result (sometimes the screen is black or shows a frame of the video, it can never be put into play and I can move through the time scroll to see other frames, but it is unusable).
 

The worst of all is that I do get the message "Using hardware decoding (drm)".
 

The only configurations I do after installing the image are:

sudo apt update && sudo apt upgrade -y

sudo apt-get install armbian-config mesa-utils chromium

# Install a Desktop
sudo armbian-config

# After rebooting and entering the desktop
sudo wget http://apt.undo.it:7241/apt.undo.it.asc -O /etc/apt/trusted.gpg.d/apt.undo.it.asc
echo "deb http://apt.undo.it:7241/debian bookworm main" | sudo tee /etc/apt/sources.list.d/apt.undo.it.list
sudo apt update
sudo apt install ffmpeg-v4l2request mpv
sudo mkdir -p /etc/mpv
echo -e "hwdec=drm\ndrm-drmprime-video-plane=primary\ndrm-draw-plane=overlay" | sudo tee /etc/mpv/mpv.conf

mpv video.mp4

 

This is the output on the XFCE desktop (but with the same negative result):

hiperdoo@orangepizero3:~/Downloads$ mpv --ao=pulse video.mp4
 (+) Video --vid=1 (*) (h264 1920x1080 60.000fps)
 (+) Audio --aid=1 (*) (aac 2ch 44100Hz)
File tags:
 Artist: LG Global
 Title: 2021 LG OLED l  Ink Art 4K HDR 60fps
Using hardware decoding (drm).
AO: [pulse] 44100Hz stereo 2ch float
VO: [gpu] 1920x1080 drm_prime[nv12]
AV: 00:00:00 / 00:00:45 (1%) A-V:  0.006 Dropped: 7


I would be very grateful if someone could enlighten me on what other steps are required.

Link to comment
Share on other sites

On 10/29/2024 at 3:42 PM, HiperDoo said:

I haven't been able to get it working, I also have the Orange Pi Zero 3 using the Debian 12 (Bookworm) [Build Date: Oct 14, 2024] image with the Minimal/IOT option.

I tried using mpv with the instructions at the beginning of the post on the Gnome and XFCE desktops, but both have the same negative result (sometimes the screen is black or shows a frame of the video, it can never be put into play and I can move through the time scroll to see other frames, but it is unusable).

The last reported success was with Debian Bookworm, in a comment from July 23... can you repeat the experiment with an OS image from before that date?

(I don't have access to my orange pi zero 3 for a few days)

Link to comment
Share on other sites

I confirm that ffmpeg-v4l2request works for opiz3, with OS image Armbian_community_24.8.0-trunk.6_Orangepizero3_bookworm_current_6.6.31_minimal.img.xz

 

I started with the freshly booted OS image, added my DTS for ili9341 SPI LCD (see other thread in community-allwinner), rebooted, and followed all the steps in the original post.

 

The final steps to play an mp4 in tty:

Spoiler
roberto@orangepizero3:/etc/mpv$ mpv --drm-connector=help
Available connectors for card 0 (/dev/dri/card0):
  HDMI-A-1 (disconnected)

Available connectors for card 1 (/dev/dri/card1):
Cannot retrieve DRM resources: Operation not supported

Available connectors for card 2 (/dev/dri/card2):
  SPI-1 (connected)

roberto@orangepizero3:~$ mpv --vo=drm --drm-connector=2.SPI-1 mj_remember_time.mp4 
 (+) Video --vid=1 (*) (h264 320x240 29.970fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 44100Hz)
[vo/drm] VT_GETMODE failed: Inappropriate ioctl for device
[vo/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
[vo/drm] Warning: Selecting a connector by index with drm-connector is deprecated. Use the drm-device option instead.
[W][01376.024877] pw.conf      | [          conf.c:  939 try_load_conf()] can't load config client.conf: No such file or directory
[E][01376.025153] pw.conf      | [          conf.c:  963 pw_conf_load_conf_for_context()] can't load default config client.conf: No such file or directory
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM default
[ao/alsa] Playback open error: No such file or directory
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
[ao/jack] cannot open server
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM default
[ao/sdl] could not open audio: ALSA: Couldn't open audio device: No such file or directory
[ao] Failed to initialize audio driver 'sdl'
Could not open/initialize audio device -> no sound.
Audio: no audio
VO: [drm] 320x240 yuv420p
V: 00:01:12 / 00:09:16 (13%) Dropped: 949

Exiting... (Quit)

 

 

Also works with mplayer (more efficient)

Spoiler
roberto@orangepizero3:~$ mplayer -vo fbdev2:/dev/fb0 mj_remember_time.mp4 
Creating config file: /home/roberto/.mplayer/config
MPlayer UNKNOWN-12 (C) 2000-2023 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing mj_remember_time.mp4.
libavformat version 59.27.100 (external)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xffff94336330]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang eng
VIDEO:  [H264]  320x240  24bpp  29.970 fps  100.4 kbps (12.3 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 59.37.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:
 major_brand: isom
 minor_version: 512
 compatible_brands: isomiso2avc1mp41
 encoder: Lavf58.19.102
Load subtitles in ./
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, floatle, 48.0 kbit/1.70% (ratio: 5999->352800)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
[AO_ALSA] alsa-lib: confmisc.c:855:(parse_card) cannot find card '0'
[AO_ALSA] alsa-lib: conf.c:5180:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
[AO_ALSA] alsa-lib: confmisc.c:422:(snd_func_concat) error evaluating strings
[AO_ALSA] alsa-lib: conf.c:5180:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
[AO_ALSA] alsa-lib: confmisc.c:1334:(snd_func_refer) error evaluating name
[AO_ALSA] alsa-lib: conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
[AO_ALSA] alsa-lib: conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
[AO_ALSA] alsa-lib: pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM default
[AO_ALSA] Playback open error: No such file or directory
Failed to initialize audio driver 'alsa'
[AO SDL] Samplerate: 44100Hz Channels: Stereo Format floatle
[AO SDL] using aalib audio driver.
[AO SDL] Unsupported audio format: 0x1d.
[AO SDL] Unable to open audio: No available audio device
Failed to initialize audio driver 'sdl:aalib'
Could not open/initialize audio device -> no sound.
Audio: no sound
Starting playback...
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
[swscaler @ 0xffff9442ecc8]bicubic scaler, from yuv420p to bgra using C
[swscaler @ 0xffff9442ecc8]using unscaled yuv420p -> bgra special converter
VO: [fbdev2] 320x240 => 320x240 BGRA 
V:  79.6   0/  0  7%  3%  0.0% 0 0 


MPlayer interrupted by signal 2 in module: sleep_timer
V:  79.6   0/  0  7%  3%  0.0% 0 0 

Exiting... (Quit)

 

 

Next up, I try again with the latest armbian OS image

 

Please ask what information I can get from my working setup, and see what's the roadblock in the latest armbian

 

Update: I confirm that the ffmpeg-v4l2request package is not working for the latest armbian Armbian_community_24.11.0-trunk.351_Orangepizero3_bookworm_current_6.6.54_minimal

 

Spoiler
roberto@orangepizero3:~$ mpv --vo=drm --drm-connector=2.SPI-1 mj_remember_time.mp4
 (+) Video --vid=1 (*) (h264 320x240 29.970fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 44100Hz)
[vo/drm] VT_GETMODE failed: Inappropriate ioctl for device
[vo/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
[vo/drm] Warning: Selecting a connector by index with drm-connector is deprecated. Use the drm-device option instead.
[W][00422.993910] pw.conf      | [          conf.c:  939 try_load_conf()] can't load config client.conf: No such file or directory
[E][00422.994202] pw.conf      | [          conf.c:  963 pw_conf_load_conf_for_context()] can't load default config client.conf: No such file or directory
AO: [alsa] 44100Hz stereo 2ch float
VO: [drm] 320x240 yuv420p
AV: 00:00:00 / 00:09:16 (0%) A-V: -0.000

Exiting... (Quit)

 

 

mplayer does not work either

Spoiler
roberto@orangepizero3:~$ mplayer -vo fbdev2:/dev/fb0 mj_remember_time.mp4
Creating config file: /home/roberto/.mplayer/config
MPlayer UNKNOWN-12 (C) 2000-2023 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing mj_remember_time.mp4.
libavformat version 59.27.100 (external)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xffff9a866330]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang eng
VIDEO:  [H264]  320x240  24bpp  29.970 fps  100.4 kbps (12.3 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 59.37.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:
 major_brand: isom
 minor_version: 512
 compatible_brands: isomiso2avc1mp41
 encoder: Lavf58.19.102
Load subtitles in ./
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, floatle, 48.0 kbit/1.70% (ratio: 5999->352800)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
AO: [alsa] 44100Hz 2ch floatle (4 bytes per sample)
Starting playback...
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
[swscaler @ 0xffff9a95ecc8]bicubic scaler, from yuv420p to bgra using C
[swscaler @ 0xffff9a95ecc8]using unscaled yuv420p -> bgra special converter
VO: [fbdev2] 320x240 => 320x240 BGRA 
A:   0.0 V:   0.2 A-V: -0.166 ct: -0.013   0/  0 ??% ??% ??,?% 0 0 


MPlayer interrupted by signal 2 in module: sleep_timer
A:   0.0 V:   0.2 A-V: -0.166 ct: -0.013   0/  0 ??% ??% ??,?% 0 0 

Exiting... (Quit)

 

 

I can only think of using apt to install an older mpv.deb (+dependencies), if starting from the newest Armbian OS...

 

Or forcing apt to never upgrade the mpv.deb and related deb dependencies, if I start with the older Armbian OS

 

As a temporary measure, only needed while ffpmeg gets the patches officially, and the Debian servers include that new version too, right?

 

Reference: https://unix.stackexchange.com/questions/242014/how-to-install-the-previous-version-of-a-deb-package-and-pin-it

 

Another thing to try is to compile an Armbian image (latest), with bleeding edge linux kernel, as I see success for other people in Linux 6.7

https://forum.armbian.com/topic/29794-how-to-install-armbian-in-h618/?do=findComment&comment=204697

 

Jock, if I want to build my own ffmpeg with v4l2-request, is this a good recommendation?

"You also need to build with --enable-v4l2-request --enable-libudev"

https://artemis.sh/2023/03/06/ffmpeg-v4l2-requests-4.4.3.html

Link to comment
Share on other sites

Fortunately, I was able to upload this file:

Armbian_community_24.8.0-trunk.6_Orangepizero3_bookworm_current_6.6.31_minimal.img.xz

https://drive.google.com/file/d/1nlvUPLOdIz706EWWv4c2BzPQxkzilZHG/view?usp=drive_link

 

If anyone has a similar file for the orange pi zero 2w, please share it too

 

I found that mpv.deb remains the same version from armbian 24.8 to 24.11 (from may to october 2024)... and the only thing that got upgraded is linux 6.6.31 to 6.6.54

Freezing the kernel in 6.6.31 could be a good move too

 

I also just finished compiling armbian with the latest kernel... I will try this next time I can.

Link to comment
Share on other sites

If you start with the old image with linux 6.6.31 and:

Spoiler
roberto@orangepizero3:~$ sudo apt-mark hold armbian-bsp-cli-orangepizero3-current armbian-firmware armbian-firmware-full linux-image-current-sunxi64
roberto@orangepizero3:~$ apt-mark showhold
armbian-bsp-cli-orangepizero3-current
armbian-firmware
armbian-firmware-full
linux-image-current-sunxi64
roberto@orangepizero3:~$ sudo apt update
...
roberto@orangepizero3:~$ sudo apt upgrade
roberto@orangepizero3:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  armbian-bsp-cli-orangepizero3-current armbian-firmware linux-image-current-sunxi64
The following packages will be upgraded:
  base-files bash bluetooth bluez curl distro-info-data initramfs-tools initramfs-tools-core libbluetooth3 libc-bin libc-l10n libc6 libcurl3-gnutls
  libcurl4 libexpat1 libglib2.0-0 libgnutls30 libgssapi-krb5-2 libk5crypto3 libkrb5-3 libkrb5support0 libndp0 libpam-systemd libpython3.11-minimal
  libpython3.11-stdlib libseccomp2 libssl3 libsystemd-shared libsystemd0 libudev1 linux-dtb-current-sunxi64 linux-u-boot-orangepizero3-current locales nano
  openssh-client openssh-server openssh-sftp-server openssl python3.11 python3.11-minimal systemd systemd-resolved systemd-sysv u-boot-tools udev
  wpasupplicant
46 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 33.7 MB of archives.
After this operation, 420 kB of additional disk space will be used.
Do you want to continue? [Y/n]

 

It will update everything except the kernel (remains in 6.6.31)

 

And mpv, mplayer continue working with h264 hardware acceleration :)

 

 

When trying the newest kernel version 6.10.9, it didn't work for me:

Spoiler
roberto@orangepizero3:~$ mpv --vo=drm --drm-connector=0.SPI-1 mj_remember_time.mp4 
 (+) Video --vid=1 (*) (h264 320x240 29.970fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 44100Hz)
[vo/drm] VT_GETMODE failed: Inappropriate ioctl for device
[vo/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
[vo/drm] Warning: Selecting a connector by index with drm-connector is deprecated. Use the drm-device option instead.
[W][00545.128113] pw.conf      | [          conf.c:  939 try_load_conf()] can't load config client.conf: No such file or directory
[E][00545.128426] pw.conf      | [          conf.c:  963 pw_conf_load_conf_for_context()] can't load default config client.conf: No such file or directory
AO: [alsa] 44100Hz stereo 2ch float
VO: [drm] 320x240 yuv420p
AV: 00:00:00 / 00:09:16 (0%) A-V: -0.000

Exiting... (Quit)

 

mplayer didn't work either

 

I will try compiling and installing ffmpeg from source...

 

Link to comment
Share on other sites

I just had the chance to test an old Allwinner H3 (OrangePi One) with kernel 6.6.44 and can confirm that mpv fails to work correctly with hardware decoding, both via terminal and also in weston, both on kernel 6.6.44 and 6.10.8.

On rockchip64 instead it works pretty well in both terminal and weston on kernel 6.6.57.

 

I guess something broke in the kernel for allwinner platforms 😕

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines