HW x264 decoding In Firefox 116

mpv --hwdec=auto /home/daiaji/桌面/VID_20230227_163234.mp4
 (+) Video --vid=1 (*) (h264 3840x2160 30.030fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
[vo/gpu/drm] VT_GETMODE failed: Inappropriate ioctl for device
[vo/gpu/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
[vo/gpu/drm] No connected connectors found
[vo/gpu-next/drm] Can't handle VT release - signal already used
[vo/gpu-next/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
[vo/gpu-next/drm] No connected connectors found
Error opening/initializing the selected video_out (--vo) device.
Video: no video

Exiting... (Errors when loading file)

I have tried flatpack clapper based on gstreamer and have got a 20% of CPU usage for rk3566 and 1080p Big Buck Bunny while mpv use almost 100% .

I have tried with gnome-web also based on gstreamer but CPU usage is like in firefox, 75%.

I am out of ideas as I do not have or am familiar with that device.

try, mpv --vo=gpu --hwdec=rkmpp --gpu-api=opengl-es (–gpu-context=drm|x11|waylandvk)

ffmpeg -decoders | grep "rkmpp"
ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-librist --disable-vulkan --enable-rkmpp --host-cflags='"-fPIC"'
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
 V..... av1_rkmpp_decoder    av1 (rkmpp decoder ) (codec av1)
 V..... h263_rkmpp_decoder   h263 (rkmpp decoder ) (codec h263)
 V..... h264_rkmpp_decoder   h264 (rkmpp decoder ) (codec h264)
 V..... hevc_rkmpp_decoder   hevc (rkmpp decoder ) (codec hevc)
 V..... mpeg1_rkmpp_decoder  mpeg1 (rkmpp decoder ) (codec mpeg1video)
 V..... mpeg2_rkmpp_decoder  mpeg2 (rkmpp decoder ) (codec mpeg2video)
 V..... mpeg4_rkmpp_decoder  mpeg4 (rkmpp decoder ) (codec mpeg4)
 V..... vp8_rkmpp_decoder    vp8 (rkmpp decoder ) (codec vp8)
 V..... vp9_rkmpp_decoder    vp9 (rkmpp decoder ) (codec vp9)
ffplay -vcodec h264_rkmpp_decoder /home/daiaji/桌面/VID_20230227_163234.mp4
ffplay version n6.0 Copyright (c) 2003-2023 the FFmpeg developers
  built with gcc 12.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-librist --disable-vulkan --enable-rkmpp --host-cflags='"-fPIC"'
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/daiaji/桌面/VID_20230227_163234.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2023-02-27T08:32:43.000000Z
    com.android.version: 12
    com.android.manufacturer: Xiaomi
    com.android.model: M2012K11AC
  Duration: 00:00:07.47, start: 0.000000, bitrate: 49993 kb/s
  Stream #0:0[0x1](eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/bt470bg/smpte170m, progressive), 3840x2160, 50412 kb/s, 30.03 fps, 30.03 tbr, 90k tbn (default)
    Metadata:
      creation_time   : 2023-02-27T08:32:43.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
    Side data:
      displaymatrix: rotation of -90.00 degrees
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s (default)
    Metadata:
      creation_time   : 2023-02-27T08:32:43.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]
[h264_rkmpp_decoder @ 0xffff8c064750] Picture format is yuv420p.
[h264_rkmpp_decoder @ 0xffff8c064750] Failed to initialize MPP context (code = -1).
[h264_rkmpp_decoder @ 0xffff8c064750] Failed to initialize RKMPP Codec.
   2.14 M-A: -0.000 fd=   0 aq=   39KB vq=    0KB sq=    0B f=0/0

It seems that there is a malfunction

maybe panfrost driver issue, which kernel version?

uname -a
Linux ARM 6.5.3-1-MANJARO-ARM #1 SMP PREEMPT Fri Sep 15 12:28:28 UTC 2023 aarch64 GNU/Linux
sudo journalctl -k -b -p err..alert --no-pager
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: debugfs: File ':interrupt-controller@fee00000' in directory 'domains' already present!
9月 28 10:40:37 ARM kernel: OF: graph: no port node found in /i2c@ff3d0000/typec-portc@22
1月 18 16:50:25 ARM kernel: brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4356-sdio for chip BCM4356/2
1月 18 16:50:25 ARM kernel: brcmfmac: brcmf_c_process_txcap_blob: no txcap_blob available (err=-2)
1月 18 16:50:25 ARM kernel: brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4356/2 wl0: Apr  9 2021 00:40:07 version 7.35.349.104 (775a9ab CY) FWID 01-64b609e0
1月 18 16:50:26 ARM kernel: Bluetooth: hci0: BCM: firmware Patch file not found, tried:
1月 18 16:50:26 ARM kernel: Bluetooth: hci0: BCM: 'brcm/BCM4356A2.friendlyarm,nanopc-t4.hcd'
1月 18 16:50:26 ARM kernel: Bluetooth: hci0: BCM: 'brcm/BCM4356A2.hcd'
1月 18 16:50:26 ARM kernel: Bluetooth: hci0: BCM: 'brcm/BCM.friendlyarm,nanopc-t4.hcd'
1月 18 16:50:26 ARM kernel: Bluetooth: hci0: BCM: 'brcm/BCM.hcd'
10月 05 18:19:49 ARM kernel: hdmi-audio-codec hdmi-audio-codec.4.auto: Only one simultaneous stream supported!
10月 05 18:19:49 ARM kernel: hdmi-audio-codec hdmi-audio-codec.4.auto: ASoC: error at snd_soc_dai_startup on i2s-hifi: -22

GT King Pro. As far as i can tell using “ffplay” there is NO vpu hw acceleration eventthough it indicated:

[h264_v4l2m2m @ 0xffff90020920] driver 'meson-vdec' on card 'Amlogic Video Decoder' in mplane mode

All 6 CPU cores are above 80%. Does ffplay need to “vo=gpu” to enable vpu hw acceleration?

 jfl@jfl-gtkpro    ffplay -vcodec h264_v4l2m2m '/run/media/jfl/EADAD935DAD8FEAF/Manjaro-Arm-XFCE/Mnjro-Aarm-XFCE-Documents/Two Steps From Hell - Unleashed-15ZqpVOjZEc.mp4'
ffplay version n6.0-164-g61733f14a6 Copyright (c) 2003-2023 the FFmpeg developers
  built with gcc 12.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --disable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --disable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan --disable-ffnvcodec --disable-nvdec --disable-nvenc --disable-vdpau --disable-mmal --enable-neon --enable-sand --enable-v4l2-request --enable-libudev --enable-epoxy --enable-vout-drm --enable-vout-egl
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/run/media/jfl/EADAD935DAD8FEAF/Manjaro-Arm-XFCE/Mnjro-Aarm-XFCE-Documents/Two Steps From Hell - Unleashed-15ZqpVOjZEc.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:05:41.50, start: 0.000000, bitrate: 5698 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 5559 kb/s, 60 fps, 60 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
[h264_v4l2m2m @ 0xffff90020920] Using device /dev/video0
[h264_v4l2m2m @ 0xffff90020920] driver 'meson-vdec' on card 'Amlogic Video Decoder' in mplane mode
[h264_v4l2m2m @ 0xffff90020920] requesting formats: output=H264/none capture=NM12/none
   jfl@jfl-gtkpro   

Whereas with "mpv --gpu-context=wayland --hwdec=v4l2m2m vpu hw acceleration is available.

 jfl@jfl-gtkpro    mpv --gpu-context=wayland --hwdec=v4l2m2m '/run/media/jfl/EADAD935DAD8FEAF/Manjaro-Arm-XFCE/Mnjro-Aarm-XFCE-Documents/Two Steps From Hell - Unleashed-15ZqpVOjZEc.mp4' 
 (+) Video --vid=1 (*) (h264 1920x1080 60.000fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 44100Hz)
[vo/gpu/wayland] GNOME's wayland compositor lacks support for the idle inhibit protocol. This means the screen can blank during playback.
Using hardware decoding (v4l2m2m).
AO: [pulse] 44100Hz stereo 2ch float
VO: [gpu] 1920x1080 drm_prime[nv12]
AV: 00:00:10 / 00:05:41 (3%) A-V:  0.000 Dropped: 19 Cache: 204s/150MB

Exiting... (Quit)
mpv --gpu-context=wayland --hwdec=v4l2m2m VID_20230227_163234.mp4
 (+) Video --vid=1 (*) (h264 3840x2160 30.030fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
Failed to open VDPAU backend libvdpau_rockchip.so: cannot open shared object file: No such file or directory
[vo/vdpau] Error when calling vdp_device_create_x11: 1
[vo/xv] Warning: this legacy VO has bad quality and performance, and will in particular result in blurry OSD and subtitles. You should fix your graphics drivers, or not force the xv VO.
Unsupported hwdec: v4l2m2m
[ffmpeg/video] h264_rkmpp_decoder: Failed to initialize MPP context (code = -1).
[ffmpeg/video] h264_rkmpp_decoder: Failed to initialize RKMPP Codec.
Could not open codec.
Decoder init failed for h264_rkmpp_decoder
Unsupported hwdec: v4l2m2m
AO: [pipewire] 48000Hz stereo 2ch floatp
[autorotate] Inserting rotation filter.
VO: [xv] 2160x3840 yuv420p
AV: 00:00:00 / 00:00:07 (0%) A-V:  0.000
Audio device underrun detected.
AV: 00:00:00 / 00:00:07 (1%) A-V:  0.176
Audio device underrun detected.
AV: 00:00:00 / 00:00:07 (1%) A-V:  0.324
Audio device underrun detected.

Audio/Video desynchronisation detected! Possible reasons include too slow
hardware, temporary CPU spikes, broken drivers, and broken files. Audio
position will not match to the video (see A-V status field).

AV: 00:00:00 / 00:00:07 (2%) A-V:  0.530
Audio device underrun detected.
AV: 00:00:00 / 00:00:07 (2%) A-V:  0.717
Audio device underrun detected.
AV: 00:00:00 / 00:00:07 (3%) A-V:  0.888
Audio device underrun detected.
AV: 00:00:00 / 00:00:07 (3%) A-V:  1.077
Audio device underrun detected.
AV: 00:00:00 / 00:00:07 (3%) A-V:  1.247
Audio device underrun detected.
AV: 00:00:00 / 00:00:07 (4%) A-V:  1.433

Did you recompile mpv with the last ffmpeg you installed?

@JFL here is the right ffplay command:

[ray@jellyfin Downloads]$ ffplay -vcodec h264_v4l2m2m -i jellyfish-40-mbps-hd-h264.mkv 

<ffmpeg banner removed>

  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, matroska,webm, from 'jellyfish-40-mbps-hd-h264.mkv':0/0   
  Metadata:
    encoder         : libebml v1.2.0 + libmatroska v1.1.0
    creation_time   : 2016-02-06T04:00:54.000000Z
  Duration: 00:00:30.03, start: 0.000000, bitrate: 39833 kb/s
  Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn (default)
[h264_v4l2m2m @ 0xffff64008680] Using device /dev/video10
[h264_v4l2m2m @ 0xffff64008680] driver 'bcm2835-codec' on card 'bcm2835-codec-decode' in mplane mode
[h264_v4l2m2m @ 0xffff64008680] requesting formats: output=H264/none capture=YU12/none
   4.28 M-V:  0.023 fd=  22 aq=    0KB vq= 5810KB sq=    0B f=0/0 

I have compiled and installed ffmpeg-mpp.

That is not a clear answer if you compiled mpv after you installed ffmpeg-mpp.

I compiled and installed mpv after I compiled and installed ffmpeg-mpp.

Hi @Darksky,

Thanks. But somehow can get “ffplay -vcodec h264_v4l2m2m -i videofile” to work either no vpu hw acceleration.

[h264_v4l2m2m @ 0xffff60008480] requesting formats: output=H264/none capture=NM12/none

 jfl@jfl-gtkpro    ffplay -vcodec h264_v4l2m2m -i '/home/jfl/Videos/Big Buck Bunny 60fps 4K - Official Blender Foundation Short Film [aqz-KE-bpKQ].mp4' 
ffplay version n6.0-164-g61733f14a6 Copyright (c) 2003-2023 the FFmpeg developers
  built with gcc 12.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --disable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --disable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan --disable-ffnvcodec --disable-nvdec --disable-nvenc --disable-vdpau --disable-mmal --enable-neon --enable-sand --enable-v4l2-request --enable-libudev --enable-epoxy --enable-vout-drm --enable-vout-egl
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/jfl/Videos/Big Buck Bunny 60fps 4K - Official Blender Foundation Short Film [aqz-KE-bpKQ].mp4':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6avc1mp41
    creation_time   : 2022-09-05T01:46:28.000000Z
  Duration: 00:10:34.57, start: 0.000000, bitrate: 3819 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 9 kb/s, 60 fps, 60 tbr, 15360 tbn (default)
    Metadata:
      creation_time   : 2022-09-05T01:46:28.000000Z
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
[h264_v4l2m2m @ 0xffff60008480] Using device /dev/video0
[h264_v4l2m2m @ 0xffff60008480] driver 'meson-vdec' on card 'Amlogic Video Decoder' in mplane mode
[h264_v4l2m2m @ 0xffff60008480] requesting formats: output=H264/none capture=NM12/none

Have both ffmpeg-rpi-4.4.4-2 and latest rpi-ffmpeg-6.0r110072.g61733f14a6-1 installed on Manjaro-Arm-Gnome.

As pointed out earlier “mpv-1:0.36.0-1” has vpu hw acceleration.

Pios 1st time support firefox H/W and ffmpeg-5.1.3 jc-patched.

i try to play (for example) this youtube video but also test this non-youtube video. both just display an animated throbber, but playback never starts. same with x11 and wayland sessions of plasma on the pi4.

i read through this whole thread and tried to follow up. firefox is configured as follows:


there are no settings that contain either “v4l” nor “m2m”

at the beginning i had installed:

  • firefox 123.0-1
  • ffmpeg 2:6.1.1-6
  • ffmpeg4.4 4.4.4-4
MOZ_GFX_DEBUG=1 MOZ_LOG="PlatformDecoderModule:5" firefox

the only occurence of “m2m” was in a few strings about some video devices (?? was 13-16 and 20-23):

V4L2 device /dev/video?? does not support M2M modes

the last messages on the screen at the end of the text wall are:

[RDD 13243: MediaPDecoder #3]: V/PlatformDecoderModule ProcessDecode: mDuration=33519µs ; mTime=3117318µs ; mTimecode=3117318µs
[RDD 13243: MediaPDecoder #4]: V/PlatformDecoderModule ProcessDecode: mDuration=33519µs ; mTime=3150837µs ; mTimecode=3150837µs
[RDD 13243: MediaPDecoder #3]: V/PlatformDecoderModule ProcessDecode: mDuration=33519µs ; mTime=3184357µs ; mTimecode=3184357µs
[RDD 13243: MediaPDecoder #4]: V/PlatformDecoderModule ProcessDecode: mDuration=33519µs ; mTime=3217877µs ; mTimecode=3217877µs
[RDD 13243: MediaPDecoder #3]: V/PlatformDecoderModule ProcessDecode: mDuration=33519µs ; mTime=3251396µs ; mTimecode=3251396µs
[RDD 13243: MediaPDecoder #3]: V/PlatformDecoderModule ProcessDecode: mDuration=33519µs ; mTime=3284916µs ; mTimecode=3284916µs

then i removed ffmpeg4.4, which i had installed because of vlc, so vlc and phonon-qt5-vlc had to be removed as well. still no video playback and firefox output was similar (bc firefox uses the newest ffmpeg anyways).

tried using only ffmpeg4.4: to remove ffmpeg and install ffmpeg4.4 i would have to remove mpv and electron25 as well, but the real problem was that also firefox has ffmpeg (not ffmpeg4.4) as dependency. so i could not test this.

also tried to install ffmpeg-m2m 1:4.4-4 but the required dependencies libdav1d.so=6-64 and libvpx.so=8-64 are missing. so i could not test this either. the following versions are installed:

  • dav1d 1.4.0-1
  • libvpx 1.14-0-1

mpv playback of h264 video works, though it’s choppy on x11 (~25% cpu) but ok in wayland-session (~22% cpu):

~/Videos> mpv `some_file.mp4`
 (+) Video --vid=1 (*) (h264 1280x720 25.000fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 1ch 48000Hz)
File tags:
 Title: 1179577595428226
AO: [pipewire] 48000Hz stereo 2ch floatp
VO: [gpu] 1280x720 yuv420p
Exiting... (Quit)

same file with v4l2m2m-copy has similar performance (x11 ~20% cpu, wayland ~15% cpu):

~/Videos> mpv --hwdec=v4l2m2m-copy --hwdec-codecs=all `some_file.mp4`
 (+) Video --vid=1 (*) (h264 1280x720 25.000fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 1ch 48000Hz)
File tags:
 Title: 1179577595428226
Using hardware decoding (v4l2m2m-copy).
AO: [pipewire] 48000Hz stereo 2ch floatp
VO: [gpu] 1280x720 yuv420p
Exiting... (End of file)

the only way to get firefox video playback working is disabling hardware acceleration but that uses ~72% cpu and is visibly choppy:

any idea what’s wrong here?

Firefox always uses the latest version of ffmpeg. By default, it has video acceleration enabled, so since the ffmpeg from the repositories doesn’t have it, it fails to decode h264 or h265. Either you need to disable video acceleration in about:config (maybe media.hardware-video-decoding) rather than Firefox’s global option, otherwise, sites like Google Earth will be very slow. Or you need to install or compile the ffmpeg version from jc-kynesim and install a plugin to force h264 in Firefox. And create a config file in ./config/mpv for mpv with hwdec=auto-safe and profile=fast. To additionally have h264 and h265 acceleration with mpv.

but mpv uses the very same ffmpeg version and hardware acceleration is working there as i have shown. are you sure i need to replace the default ffmpeg with anything unofficial? note that i cannot uninstall (the latest) ffmpeg because firefox itself depends on it.

i wish i could workaround by using a different browser for videos, but now vivaldi and chromium aren’t usable in wayland anymore (they worked until recently) and switching to x11 just results in choppy video everywhere.

now i’m completely clueless :sleepy:

Firefox need v4l2 stateless (don’t ask me about technical detail…)
The ffmpeg of jc-kynesim is THE version to use if you have a rpi. It’s not in the repositories because of limited resources in personnel.
And remove all memory settings in your config.txt. Just

dtoverlay=vc4-kms-v3d
disable_fw_kms_setup=1

ok, 140 seems fixed randomly freeze, more test.