Hardware decoding for video not enabled on A7A

Finally , I have managed to make it work . Here’s how .

Install gstreamer and ffmpeg

sudo apt update
sudo apt install gstreamer1.0-tools gstreamer1.0-libav
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad
ffmpeg libavcodec-dev libavformat-dev libavutil-dev libswscale-dev

Install gstreamer python3 libraries

sudo apt install -y python3-gi python3-gst-1.0 gstreamer1.0-python3-plugin-loader

add user group and permission to /dev/cedra_dev

sudo usermod -aG video radxa
sudo chmod 666 /dev/cedar_dev
logout
login

Python3 script: gst_rtsp_pull.py

import gi
gi.require_version(“Gst”, “1.0”)
from gi.repository import Gst
import numpy as np
import cv2

Gst.init(None)

pipeline_str = (
"rtspsrc location=rtsp://example.com:554/live/0 protocols=tcp latency=100 ! "
"rtph265depay ! h265parse ! "
"omxhevcvideodec ! "
"videoconvert ! "
"video/x-raw,format=BGR ! "
“appsink name=appsink emit-signals=true drop=true max-buffers=1 sync=false”
)

pipeline = Gst.parse_launch(pipeline_str)
appsink = pipeline.get_by_name(“appsink”)

pipeline.set_state(Gst.State.PLAYING)

print(“? GStreamer HW decode started”)

while True:
sample = appsink.emit(“pull-sample”)
buffer = sample.get_buffer()
caps = sample.get_caps()

width = caps.get_structure(0).get_value("width")
height = caps.get_structure(0).get_value("height")

success, mapinfo = buffer.map(Gst.MapFlags.READ)
if not success:
    continue

frame = np.ndarray(
    (height, width, 3),
    dtype=np.uint8,
    buffer=mapinfo.data
)

cv2.imshow("RTSP HW Decode", frame)
buffer.unmap(mapinfo)

if cv2.waitKey(1) & 0xFF == 27:
    break

pipeline.set_state(Gst.State.NULL)
cv2.destroyAllWindows()

Open Terminal & export display port to help OpenCV environment variable

export DISPLAY=:1
export XDG_RUNTIME_DIR=/run/user/$(id -u)
xhost +local:root

Execute the python3 script to pull rtsp stream → Hardware Decode → show on screen

sudo -E python3 gst_rtsp_pull.py