Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

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

This is an old revision of the document!


Edge-2L Hardware Encoding

Introduction

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

Hardware Encoding Examples

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

1. Verify Available MPP Encoders

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. Encode a Raw YUV (NV12) File to H.264

Encode a raw YUV file (test.yuv) in NV12 format to a raw H.264 elementary stream (test.h264). Adjust the width and height parameters to match your source video resolution.

khadas@Khadas:~$ gst-launch-1.0 -v filesrc location=./test.yuv ! videoparse width=1920 height=1080 format=nv12 ! mpph264enc ! h264parse ! queue ! filesink location=./test.h264
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstSystemClock
0:00:16.1 / 0:12:05.0 (2.2 %)
^Chandling interrupt. (2.8 %)

3. Capture and Encode from a USB Camera

The following examples capture JPEG frames from a USB camera, decode them using the MPP JPEG decoder, and then hardware-encode the video stream to H.264.

khadas@Khadas:~$ gst-launch-1.0 v4l2src device=/dev/video60 io-mode=mmap num-buffers=300 ! image/jpeg, width=1920, height=1080, framerate=30/1 ! mppjpegdec ! mpph264enc ! filesink location=./test.h264

You can adapt these pipelines for other encoding formats (e.g., H.265, VP8) by simply replacing mpph264enc with the corresponding MPP encoder element (e.g., mpph265enc, mppvp8enc).

Last modified: 2026/02/04 04:46 by gray