This document mainly introduces how to use hardware decoding on Edge2.
If encounter error, please add sudo and try again.
1. Check decoder.
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. Decoding with H264 file.
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.
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 %)
If you want to play your decoded fileļ¼ you can play with ffpaly
.
4. Decoding from RTSP stream and preview.
You can use gstreamer waylandsink
to preview the video on Ubuntu Wayland desktop:
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
You can use the command below to check display fps:
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
Display with ffmpeg
:
ffplay -vcodec h264_rkmpp rtsp://USERNAME:PASSWD@192.168.xxx.xxx/snl/live/1/1
You can use gstreamer clutterautovideosink
to preview the video on Ubuntu Wayland desktop:
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 ! clutterautovideosink
You can use the command below to check display fps:
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=clutterautovideosink sync=false text-overlay=false
You press Alt + F7
and then move mouse to move the windown.
Please replace the RTSP stream with yours.