Hi,
sorry to jump in on this thread, but I recently also tried to play hardware accelerated video (preferably on a virtual terminal without X11/Wayland) on my Pine A64 with current Armbian image (derived from Ubuntu 23.02). Unfortunately no method seems to work. Am I doing something wrong? What would be the "easiest" way to get mainline hw accelerated video decoding on A64? Is there another popular general purpose distribution I could try (except LibreELEC with Kodi)?
Kernel is 5.15.93-sunxi64 and has cedrus modules:
lsmod | grep cedrus
sunxi_cedrus 49152 0
videobuf2_dma_contig 24576 1 sunxi_cedrus
v4l2_mem2mem 36864 1 sunxi_cedrus
videobuf2_v4l2 24576 2 sunxi_cedrus,v4l2_mem2mem
videobuf2_common 49152 5 sunxi_cedrus,videobuf2_dma_contig,videobuf2_v4l2,v4l2_mem2mem,videobuf2_memops
videodev 204800 4 sunxi_cedrus,videobuf2_v4l2,videobuf2_common,v4l2_mem2mem
mc 49152 5 sunxi_cedrus,videodev,videobuf2_v4l2,videobuf2_common,v4l2_mem2mem
Gstreamer is version 1.20, and it seems to have provide required codecs (after installing gstreamer1.0-plugins-bad).
gst-play-1.0 --version
gst-play-1.0 version 1.20.1
GStreamer 1.20.3
gst-inspect-1.0 | grep v4l2
v4l2codecs: v4l2slh264dec: V4L2 Stateless H.264 Video Decoder
v4l2codecs: v4l2slmpeg2dec: V4L2 Stateless Mpeg2 Video Decoder
v4l2codecs: v4l2slvp8alphadecodebin: VP8 Alpha Decoder
v4l2codecs: v4l2slvp8dec: V4L2 Stateless VP8 Video Decoder
video4linux2: v4l2deviceprovider (GstDeviceProviderFactory)
video4linux2: v4l2radio: Radio (video4linux2) Tuner
video4linux2: v4l2sink: Video (video4linux2) Sink
video4linux2: v4l2src: Video (video4linux2) Source
Unfortunately gst-play doesn't work, it completely freezes my Pine64 (not even Ctrl-Alt-Delete works anymore) after "Redistribute latency...".
gst-play-1.0 bbb_sunflower_1080p_60fps_normal.mp4
Kodi 19.4 from apt repo also doesn't play hw accelerated (although it should as mentioned in post #1), on start it prints this error:
$ kodi
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
mpv also doesn't work:
$ mpv bbb_sunflower_1080p_60fps_normal.mp4
(+) Video --vid=1 (*) (h264 1920x1080 60.000fps)
(+) Audio --aid=1 (*) (mp3 2ch 48000Hz)
Audio --aid=2 (*) (ac3 6ch 48000Hz)
File tags:
Artist: Blender Foundation 2008, Janus Bager Kristensen 2013
Comment: Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
Composer: Sacha Goedegebure
Genre: Animation
Title: Big Buck Bunny, Sunflower version
[vo/gpu/opengl] Cannot retrieve DRM resources: Operation not supported
[vo/gpu/opengl] Failed to create KMS.
[vo/sdl] Using opengl
[vo/sdl] Warning: this legacy VO has bad performance. Consider fixing your graphics drivers, or not forcing the sdl VO.
AO: [alsa] 48000Hz stereo 2ch float
VO: [sdl] 1920x1080 yuv420p
AV: 00:00:03 / 00:10:34 (1%) A-V: 0.463 Dropped: 167
If I force hw accel, I get these warnings:
$ mpv --hwdec=auto --hwdec-codecs=all bbb_sunflower_1080p_60fps_normal.mp4 bbb_sunflower_1080p_60fps_normal.mp4
Playing: bbb_sunflower_1080p_60fps_normal.mp4
(+) Video --vid=1 (*) (h264 1920x1080 60.000fps)
(+) Audio --aid=1 (*) (mp3 2ch 48000Hz)
Audio --aid=2 (*) (ac3 6ch 48000Hz)
File tags:
Artist: Blender Foundation 2008, Janus Bager Kristensen 2013
Comment: Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
Composer: Sacha Goedegebure
Genre: Animation
Title: Big Buck Bunny, Sunflower version
[vo/gpu/opengl] Cannot retrieve DRM resources: Operation not supported
[vo/gpu/opengl] Failed to create KMS.
[vo/sdl] Using opengl
[vo/sdl] Warning: this legacy VO has bad performance. Consider fixing your graphics drivers, or not forcing the sdl VO.
[ffmpeg] AVHWDeviceContext: Cannot load libcuda.so.1
[ffmpeg] AVHWDeviceContext: Could not dynamically load CUDA
[vaapi] libva: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[ffmpeg/video] h264_v4l2m2m: Could not find a valid device
[ffmpeg/video] h264_v4l2m2m: can't configure decoder
Could not open codec.
AO: [alsa] 48000Hz stereo 2ch float
VO: [sdl] 1920x1080 yuv420p
AV: 00:00:02 / 00:10:34 (0%) A-V: 0.305 Dropped: 135
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:13 / 00:10:34 (2%) A-V: 5.562 Dropped: 648
Audio device underrun detected.
AV: 00:00:23 / 00:10:34 (4%) A-V: 11.188 Dropped: 1150
mplayer also competely freezes the Pine A64 (like gst-play).
But ffmpeg even seems to have necessary decoders?
$ ffmpeg -hide_banner -decoders | grep v4l2
V..... h263_v4l2m2m V4L2 mem2mem H.263 decoder wrapper (codec h263)
V..... h264_v4l2m2m V4L2 mem2mem H.264 decoder wrapper (codec h264)
V..... hevc_v4l2m2m V4L2 mem2mem HEVC decoder wrapper (codec hevc)
V..... mpeg1_v4l2m2m V4L2 mem2mem MPEG1 decoder wrapper (codec mpeg1video)
V..... mpeg2_v4l2m2m V4L2 mem2mem MPEG2 decoder wrapper (codec mpeg2video)
V..... mpeg4_v4l2m2m V4L2 mem2mem MPEG4 decoder wrapper (codec mpeg4)
V..... vc1_v4l2m2m V4L2 mem2mem VC1 decoder wrapper (codec vc1)
V..... vp8_v4l2m2m V4L2 mem2mem VP8 decoder wrapper (codec vp8)
V..... vp9_v4l2m2m V4L2 mem2mem VP9 decoder wrapper (codec vp9)
$ ffmpeg -hide_banner -hwaccels
Hardware acceleration methods:
vdpau
cuda
vaapi
drm
opencl
Needless to say ffplay also doesn't work. When forced:
$ ffplay -vcodec h264_v4l2m2m bbb_sunflower_1080p_60fps_normal.mp4
...
[h264_v4l2m2m @ 0xffff6002b360] Could not find a valid device
[h264_v4l2m2m @ 0xffff6002b360] can't configure decoder
Output of vainfo:
$ vainfo
error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.14.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
vaInitialize failed with error code -1 (unknown libva error),exit
Output of v4l2-compliance:
v4l2-compliance 1.22.1, 64 bits, 64-bit time_t
Compliance test for cedrus device /dev/video0:
Driver Info:
Driver name : cedrus
Card type : cedrus
Bus info : platform:cedrus
Driver version : 5.15.93
Capabilities : 0x84208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Media Driver Info:
Driver name : cedrus
Model : cedrus
Serial :
Bus info : platform:cedrus
Media version : 5.15.93
Hardware revision: 0x00000000 (0)
Driver version : 5.15.93
Interface Info:
ID : 0x0300000c
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : cedrus-source
Function : V4L2 I/O
Pad 0x01000002 : 0: Source
Link 0x02000008: to remote pad 0x1000004 of entity 'cedrus-proc' (Video Decoder): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK
test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
fail: v4l2-test-controls.cpp(717): try_ext_ctrls returned an error (22)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 7 Private Controls: 0
Standard Compound Controls: 15 Private Compound Controls: 0
Format ioctls:
fail: v4l2-test-formats.cpp(263): fmtdesc.description mismatch: was 'Sunxi Tiled NV12 Format', expected 'Y/CbCr 4:2:0 (32x32 Linear)'
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
fail: v4l2-test-formats.cpp(460): pixelformat 32315453 (ST12) for buftype 1 not reported by ENUM_FMT
test VIDIOC_G_FMT: FAIL
fail: v4l2-test-formats.cpp(460): pixelformat 32315453 (ST12) for buftype 1 not reported by ENUM_FMT
test VIDIOC_TRY_FMT: FAIL
fail: v4l2-test-formats.cpp(460): pixelformat 32315453 (ST12) for buftype 1 not reported by ENUM_FMT
test VIDIOC_S_FMT: FAIL
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
fail: v4l2-test-codecs.cpp(122): ret != 0
test VIDIOC_(TRY_)DECODER_CMD: FAIL
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)
Total for cedrus device /dev/video0: 46, Succeeded: 40, Failed: 6, Warnings: 0
So what is going on here? Am I missing a package or kernel module (concerning drm?)? Or do I need an ffmpeg with `--enable-v4l2-request`? And/or an libva-v4l2-request? Where do I get one that compiles with kernel 5.15?
Thank you!