This is an old revision of the document!
This document explains how to utilize hardware-accelerated video decoding on the Edge-2L using the Rockchip MPP (Media Process Platform) framework.
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 H.264 File
Decode a raw H.264 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 H.264 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
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
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
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>