Jump to content

State of the things related to Video decoding and encoding in OPI Zero 2/3


Recommended Posts

Hi guys, its the first time im gonna post here so bear with me, i am a recent user of orange pi zero 3, one with 4GB RAM and i have been able to run the latest community release on it, things work besides audio thru hdmi, but i have noticed that the video encoding and decoding is not working, albeit 3d acceleration works thru panfrost and Mesa.

 

I have been digging this topic and i wanted to share what i found and maybe validate if im right or perhaps i am not getting this well.

 

1. Video encoding and decoding in G31-MP2 is something separated from what Mesa and panfrost would do, so even if those work i cant get video acceleration with h.264 etc.

2. It is possible because the android 12 TV version from the manufacturer can do it in a very easy way, but as far as i understood this is because it is using some kind of closed source driver, that the SoC manufacturer provided (that almost all the boards made with the allwinner H616/H618 would run, so it isnt like orange pi dedicated developers to create the android being offered but it is a stock stuff that Allwinner has available for whoever buys their chips)

3. There are efforts to reverse engineer this properly called CEDRUS but there is kind of a lack of information about them since 2019, it is supposedly present in the kernel, but as many others have said and tried for some reason is not working with H616//h618. Anyone knows if it is still being developed?

 

In conclusion the state of things with hardware decoding and encoding of video in ARM is like a wasteland, at least for linux, these chips, ARM chips we get are mostly developed for android TV boxes or TVs or tablets, but they do not develop for linux, that maybe transferring the necessary code to make it work could be trivial, but with thin resources and doing the bare minimum and being closed source the SoC manufacturer has no interest in creating this support and it is left to open source volunteers to find a way. Which means that support for the H616/H618 might come several years into the future perhaps never. Am I interpreting reality right?, i had some hopes to create something like a jellyfin box with accelerated hardware coding and decoding but nothing might be possible, there is maybe some hope, i read somewhere in the LibreELEC forums that someone made it possible to run it with video decoding (if i am not mistaken) with no audio, so perhaps someone found a way?, thanks in advance.

Link to comment
Share on other sites

As many things we know that some are not support OOTB nevertheless the community has tried to find a way to make them work, the wiki hasnt been updated in a while, and about LibreElec, there isnt much info about how they might achieve this, but I wonder, if it works under android and given that linux exist a layer below, there got to be something that could be exported or extracted at least as a blob, i dont know more about this cos i am not a developer nor i have expertise in that subject just wondering if someone tried it.

Link to comment
Share on other sites

blobs are practically 'useless', it is compiled for a particular os, a particular version of it and if it is *undocumented* there is no way to use the blob, and even if they document the api, if you try to use the blob in a different OS say armbian, chances are that a call to the api can *crash*.

it is a 'miracle' if those blobs work.

Link to comment
Share on other sites

Posted (edited)

I have been trying to use these two to achieve hard decoding:https://linux-sunxi.org/Sunxi-Cedrus  and  https://linux-sunxi.org/Cedrus /libvdpau-sunxi .

libva-v4l2-request I used someone else's version because it was a lower version:  https://github.com/kwizart/libva-v4l2-request/tree/HACK_HEVC 

It can be compiled and installed successfully under the 6.6 kernel

libva info: VA-API version 1.17.0
libva info: User environment variable requested driver 'v4l2_request'
libva info: Trying to open /usr/lib/aarch64-linux-gnu/dri/v4l2_request_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.17 (libva 2.12.0)
vainfo: Driver version: v4l2-request
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264MultiviewHigh      :	VAEntrypointVLD
      VAProfileH264StereoHigh         :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointVLD

 

Unfortunately, when I use vaapi, the kernel crashes,command:mpv -v --hwdec=vaapi 

 

 

The libvdpau-sunxi project compiles without modification, but some devices are no longer used in kernel 6.6

command:mpv -v --hwdec=vdpau

There was no crash using vdpau, but as I said, the lack of a corresponding device caused it to become unusable and switch to soft decoding

mpv -v --hwdec=vdpau IAmLegend-Trailer.mp4
[cplayer] Command line options: '-v' '--hwdec=vdpau' 'IAmLegend-Trailer.mp4'
[cplayer] mpv 0.35.1 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
[cplayer]  built on UNKNOWN
[cplayer] FFmpeg library versions:
[cplayer]    libavutil       57.28.100
[cplayer]    libavcodec      59.37.100
[cplayer]    libavformat     59.27.100
[cplayer]    libswscale      6.7.100
[cplayer]    libavfilter     8.44.100
[cplayer]    libswresample   4.7.100
[cplayer] FFmpeg version: 5.1.4-0+deb12u1
[cplayer] 
[cplayer] Configuration: meson configure build -Dprefix=/usr -Dbuildtype=plain -Doptimization=plain
[cplayer] List of enabled features: alsa av-channel-layout caca cdda cplayer cplugins cuda-hwaccel cuda-interop dmabuf-interop-gl dmabuf-interop-pl dmabuf-wayland drm drm-is-kms dvbin dvdnav egl egl-drm egl-helpers egl-x11 ffmpeg ffnvcodec gbm gl gl-wayland glibc-thread-name glob glob-posix gpl iconv jack javascript jpeg jpegxl lcms2 libarchive libass libavdevice libbluray libdl libm libmpv-shared libplacebo libplacebo-next librt linux-fstatfs lua52 manpage-build memfd_create noexecstack pipewire plain-gl posix pulse rubberband rubberband-3 sdl2 sdl2-audio sdl2-gamepad sdl2-video sixel spirv-cross stdatomic threads uchardet vaapi vaapi-drm vaapi-egl vaapi-libplacebo vaapi-wayland vaapi-x-egl vaapi-x11 vdpau vector vt.h vulkan wayland wayland_protocols_1_24 x11 xv zimg zlib
[cplayer] Reading config file /etc/mpv/encoding-profiles.conf
[cplayer] Applying profile 'default'...
[cplayer] Setting option 'v' = '' (flags = 8)
[cplayer] Setting option 'hwdec' = 'vdpau' (flags = 8)
[cplayer] Waiting for scripts...
[osd/libass] libass API version: 0x1701000
[osd/libass] libass source: tarball: 0.17.1
[osd/libass] Shaper: FriBidi 1.0.8 (SIMPLE) HarfBuzz-ng 6.0.0 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Done loading scripts.
[cplayer] Running hook: ytdl_hook/on_load
[ytdl_hook] ytdl:// hook 
[ytdl_hook] not a ytdl:// url 
[ifo_dvdnav] Opening IAmLegend-Trailer.mp4
[bdmv/bluray] Opening IAmLegend-Trailer.mp4
[file] Opening IAmLegend-Trailer.mp4
[demux] Trying demuxers for level=normal.
[cplayer] Set property: shared-script-properties -> 1
[osd/libass] libass API version: 0x1701000
[osd/libass] libass source: tarball: 0.17.1
[osd/libass] Shaper: FriBidi 1.0.8 (SIMPLE) HarfBuzz-ng 6.0.0 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: shared-script-properties -> 1
[lavf] Found 'mov,mp4,m4a,3gp,3g2,mj2' at score=100 size=2048.
[file] stream level seek from 131072 to 126886094
[demux] Detected file format: mov,mp4,m4a,3gp,3g2,mj2 (libavformat)
[cplayer] Opening done: IAmLegend-Trailer.mp4
[find_files] Loading external files in .
[cplayer] Running hook: ytdl_hook/on_preloaded
[lavf] select track 0
[lavf] select track 1
[cplayer]  (+) Video --vid=1 (*) (h264 1920x816 23.976fps)
[cplayer]  (+) Audio --aid=1 (*) (aac 6ch 48000Hz)
[vo/gpu] Probing for best GPU context.
[vo/gpu/opengl] Initializing GPU context 'wayland'
[vo/gpu/opengl] Initializing GPU context 'x11egl'
[vo/gpu/x11] X11 opening display: :0.0
[vo/gpu/x11] Display 0 (HDMI-1): [0, 0, 1920, 1080] @ 60.000000 FPS
[vo/gpu/x11] Current display FPS: 60.000000
[vo/gpu/opengl] EGL_VERSION=1.4
[vo/gpu/opengl] EGL_VENDOR=Mesa Project
[vo/gpu/opengl] EGL_CLIENT_APIS=OpenGL OpenGL_ES 
[vo/gpu/opengl] Trying to create Desktop OpenGL context.
[vo/gpu/opengl] Choosing visual EGL config 0x9, visual ID 0x21
[vo/gpu/x11] The XPresent extension was found.
[vo/gpu/x11] XPresent disabled.
[vo/gpu/opengl] GL_VERSION='3.1 Mesa 22.3.6'
[vo/gpu/opengl] Detected desktop OpenGL 3.1.
[vo/gpu/opengl] GL_VENDOR='Panfrost'
[vo/gpu/opengl] GL_RENDERER='Mali-G31 (Panfrost)'
[vo/gpu/opengl] GL_SHADING_LANGUAGE_VERSION='1.40'
[vo/gpu/opengl] Loaded extension GL_ARB_sync.
[vo/gpu/opengl] Loaded extension GL_ARB_invalidate_subdata.
[vo/gpu/opengl] Loaded extension GL_ARB_get_program_binary.
[vo/gpu/opengl] Loaded extension GL_ARB_buffer_storage.
[vo/gpu/opengl] Loaded extension GL_ARB_shader_image_load_store.
[vo/gpu/opengl] Loaded extension GL_ARB_shader_storage_buffer_object.
[vo/gpu/opengl] Loaded extension GL_ARB_arrays_of_arrays.
[vo/gpu/opengl] Loaded extension GL_ARB_debug_output.
[vo/gpu/opengl] Loaded extension GL_KHR_debug.
[vo/gpu] Testing FBO format rgba16f
[vo/gpu] Using FBO format rgba16f.
[vo/gpu] Disabling HDR peak computation (one or more of the following is not supported: compute shaders=0, SSBO=1).
[vo/gpu] No advanced processing required. Enabling dumb mode.
[vo/gpu] Assuming 60.000000 FPS for display sync.
[vd] Container reported FPS: 23.975986
[vd] Codec list:
[vd]     h264 - H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
[vd]     h264_v4l2m2m (h264) - V4L2 mem2mem H.264 decoder wrapper
[vd]     h264_cuvid (h264) - Nvidia CUVID H264 decoder
[vd] Opening decoder h264
[vd] Looking at hwdec h264-vdpau...
[vo/gpu] Loading hwdec drivers for format: 'vdpau'
[vd] Could not create device.
[vd] No hardware decoding available for this codec.
[vd] Using software decoding.
[vd] Detected 4 logical cores.
[vd] Requesting 5 threads for decoding.
[vd] Selected codec: h264 (H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10)
[vf] User filter list:
[vf]   (empty)
[ad] Codec list:
[ad]     aac - AAC (Advanced Audio Coding)
[ad]     aac_fixed (aac) - AAC (Advanced Audio Coding)
[ad] Opening decoder aac
[ad] Requesting 1 threads for decoding.
[ad] Selected codec: aac (AAC (Advanced Audio Coding))
[af] User filter list:
[af]   (empty)
[cplayer] Starting playback...
[file] stream level seek from 126886145 to 57472
[vd] DR failed - disabling.
[vd] Using software decoding.
[vd] Decoder format: 1920x816 yuv420p auto/auto/auto/auto/auto CL=mpeg2/4/h264
[vf] [in] 1920x816 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [userdeint] 1920x816 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [userdeint] (disabled)
[vf] [autorotate] 1920x816 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [autorotate] (disabled)
[vf] [convert] 1920x816 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [convert] (disabled)
[vf] [out] 1920x816 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[af] [in] 48000Hz 5.1 6ch floatp
[af] [userspeed] 48000Hz 5.1 6ch floatp
[af] [userspeed] (disabled)
[af] [convert] 48000Hz 5.1 6ch floatp
[ao] Trying audio driver 'pipewire'
[ao/pipewire] requested format: 48000 Hz, 5.1 channels, floatp
[ao/pipewire] Headers version: 0.3.65
[ao/pipewire] Library version: 0.3.65
[W][09924.973570] pw.conf      | [          conf.c:  939 try_load_conf()] can't load config client.conf: No such file or directory
[E][09924.973889] pw.conf      | [          conf.c:  963 pw_conf_load_conf_for_context()] can't load default config client.conf: No such file or directory
[ao] Trying audio driver 'pulse'
[ao/pulse] requested format: 48000 Hz, 5.1 channels, floatp
[ao/pulse] Library version: 16.1.0
[ao/pulse] Proto: 35
[ao/pulse] Server proto: 4294967295
[ao/pulse] Channel layouts:
[ao/pulse]  - #fl
[ao/pulse]  - #fr
[ao/pulse]  - #fc
[ao/pulse]  - #lfe
[ao/pulse]  - #bl
[ao/pulse]  - #br
[ao/pulse]  - #flc
[ao/pulse]  - #frc
[ao/pulse]  - #bc
[ao/pulse]  - #sl
[ao/pulse]  - #sr
[ao/pulse]  - #tc
[ao/pulse]  - #tfl
[ao/pulse]  - #tfc
[ao/pulse]  - #tfr
[ao/pulse]  - #tbl
[ao/pulse]  - #tbc
[ao/pulse]  - #tbr
[ao/pulse] result: 5.1
[ao/pulse] device buffer: 6718 samples.
[ao/pulse] using soft-buffer of 9600 samples.
[cplayer] AO: [pulse] 48000Hz 5.1 6ch float
[cplayer] AO: Description: PulseAudio audio output
[autoconvert] inserting resampler
[swresample] format change, reinitializing resampler
[swresample] 48000Hz 5.1 floatp -> 48000Hz 5.1 float
[af] [out] 48000Hz 5.1 6ch float
[cplayer] VO: [gpu] 1920x816 yuv420p
[cplayer] VO: Description: Shader-based GPU Renderer
[vo/gpu] DR path suspected slow/uncached, disabling..reconfig to 1920x816 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vo/gpu] Resize: 1920x816
[vo/gpu] Window size: 1920x816 (Borders: l=0 t=0 r=0 b=0)
[vo/gpu] Video source: 1920x816 (1:1)
[vo/gpu] Video display: (0, 0) 1920x816 -> (0, 0) 1920x816
[vo/gpu] Video scale: 1.000000/1.000000
[vo/gpu] OSD borders: l=0 t=0 r=0 b=0
[vo/gpu] Video borders: l=0 t=0 r=0 b=0
[vo/gpu] Reported display depth: 8
[vo/gpu] Texture for plane 0: 1920x816
[vo/gpu] Texture for plane 1: 960x408
[vo/gpu] Texture for plane 2: 960x408
[vo/gpu] Testing FBO format rgba16f
[vo/gpu] Using FBO format rgba16f.
[vo/gpu] No advanced processing required. Enabling dumb mode.
[cplayer] first video frame after restart shown
[cplayer] audio ready
[cplayer] starting audio playback
[cplayer] playback restart complete @ 0.041708, audio=playing, video=playing
[vo/gpu/x11] Disabling screensaver.
[ao/pulse] starting AO
[statusline] AV: 00:00:00 / 00:02:03 (0%) A-V:  0.000
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: shared-script-properties -> 1
[statusline] AV: 00:00:06 / 00:02:03 (5%) A-V:  0.000
[cplayer] EOF code: 5  
[cplayer] finished playback, success (reason 3)
[cplayer] 
[cplayer] Exiting... (Quit)
[cplayer] Set property: shared-script-properties -> 1
[vo/gpu/x11] Enabling screensaver.

That's all I've ever known and tried

Edited by sakesm
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