Decode/Encode Example

Multimedia User Guide (UG1449)

Document ID
UG1449
Release Date
2023-10-19
Revision
1.7 English

Video Decode Using Gstreamer-1.0

The following example shows how to decode an input file with H.265 (HEVC) video format using Gstreamer-1.0.

The file is present in the SD Card, the format is mp4, and the encoded video format is H265.

gst-launch-1.0 filesrc location="/media/card/input-file.mp4" ! \
qtdemux name=demux demux.video_0 ! h265parse ! video/x-h265 ! omxh265dec ! \
queue max-size-bytes=0 ! fakevideosink			
Note: To decode a file in H264(AVC) video format, replace the h265 elements with h264.

Video Encode Using Gstreamer-1.0

The following example shows how to encode a captured stream of input source device with H265 (HEVC) video format using Gstreamer-1.0.

The input stream is a live source (for example, HDMI-Rx or MIPI camera) and is present under the /dev directory. The encoded video format is H265, color format is NV12, and resolution is 4kp at 60fps.

gst-launch-1.0 v4l2src io-mode=4 device=/dev/video0 ! \
video/x-raw, width=3840, height=2160, framerate=60/1, format=NV12 ! \
omxh265enc ! video/x-h265 ! fakesink
Note: To encode a video stream in H264 (AVC) video format, replace the h265 elements with h264.