Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

products:sbc:edge-2l:applications:hardware-decoding

This is an old revision of the document!


Edge-2L hardware decoding

Introduction

This document explains how to utilize hardware-accelerated video decoding on the Edge-2L using the Rockchip MPP (Media Process Platform) framework.

Decoding

If you encounter a permission error, try prefixing the commands with sudo.

1. Verify available MPP decoders.

First, check that the GStreamer MPP plugins are installed and recognized:

khadas@Khadas:~$ gst-inspect-1.0 | grep mpp
rockchipmpp:  mpph264enc: Rockchip Mpp H264 Encoder
rockchipmpp:  mpph265enc: Rockchip Mpp H265 Encoder
rockchipmpp:  mppjpegdec: Rockchip's MPP JPEG image decoder
rockchipmpp:  mppjpegenc: Rockchip Mpp JPEG Encoder
rockchipmpp:  mppvideodec: Rockchip's MPP video decoder
rockchipmpp:  mppvp8enc: Rockchip Mpp VP8 Encoder
typefindfunctions: audio/x-musepack: mpc, mpp, mp+

2. Decode a raw H264 file.

Decode a raw H264 elementary stream file (test.h264) to a raw YUV file (test.yuv):

khadas@Khadas:~$ gst-launch-1.0 filesrc location=./test.h264 ! h264parse ! mppvideodec ! video/x-raw,format=NV12 ! filesink location=test.yuv
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstSystemClock
0:00:01.2 / 1:04:25.7 (0.0 %)
0:00:02.2 / 1:33:57.6 (0.0 %)

3. Decoding with MP4 file.

Extract and decode the H264 video stream from an MP4 file:

khadas@Khadas:~$ gst-launch-1.0 filesrc location=./test.mp4 ! qtdemux name=d d.video_0 ! h264parse ! mppvideodec ! video/x-raw,format=NV12 ! filesink location=test.yuv
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstSystemClock
0:00:01.8 / 0:10:34.5 (0.3 %)

You can play the resulting raw YUV file (test.yuv) using ffplay with the correct resolution and pixel format parameters.

4. Decode and preview an RTSP stream.

  • Preview on Wayland desktop:

Use waylandsink to display the decoded video directly on the Ubuntu desktop (Wayland session):

gst-launch-1.0 rtspsrc location=rtsp://USERNAME:PASSWD@192.168.xxx.xxx/snl/live/1/1 ! rtph264depay ! h264parse ! mppvideodec ! video/x-raw,format=NV12 ! waylandsink
  • Monitor decoding performance:

Add fpsdisplaysink to overlay the current frames-per-second on the video:

gst-launch-1.0 -v rtspsrc location=rtsp://USERNAME:PASSWD@192.168.xxx.xxx/snl/live/1/1 ! rtph264depay ! h264parse ! mppvideodec ! video/x-raw,format=NV12 ! fpsdisplaysink video-sink=waylandsink sync=false text-overlay=false
  • Preview using FFmpeg:

Alternatively, use ffplay with the h264_rkmpp hardware decoder directly:

ffplay -vcodec h264_rkmpp rtsp://USERNAME:PASSWD@192.168.xxx.xxx/snl/live/1/1

Remember to replace rtsp:USERNAME:PASSWORD@192.168.xxx.xxx/your_stream'' with your actual RTSP stream URL, username, and password. </WRAP>

Last modified: 2026/02/26 01:09 by gray