Jump to content

GStreamer Examples for the Dragonwing EVK Board

From RidgeRun Developer Wiki


Follow us on: YouTube Twitter LinkedIn Email Share this page

Share This Page




The GStreamer pipelines provided in this page begin with the simplest smoke test and add features progressively: we start with a synthetic source, then validate software codecs, hardware video encode, camera capture and transform. All the pipelines presented in this page were validated on the Ubuntu 24.04 Image.

Problems running the pipelines shown on this page? Please see our GStreamer Debugging guide for help .


Example Pipelines

Simple videotestsrc to display pipeline

The following pipeline captures video from a synthetic source and renders it on display:

 gst-launch-1.0 -v videotestsrc ! autovideosink

Expected Result:

Smooth image of the test pattern generated.

Video recording in MP4 format (H.264 Software Encoding)

The following pipeline captures from a synthetic video source, encodes with h.264 codec and stores the video in a mp4 container file:

gst-launch-1.0 -v videotestsrc num-buffers=300 ! videoconvert ! x264enc ! mp4mux ! filesink location=test-video.mp4

Expected Result:

MP4 file generated correctly.

Video playing of an MP4 file (H.264 Software Decoding)

The following pipeline decodes a mp4 video file and renders it to display:

gst-launch-1.0 -v filesrc location=test-video.mp4 ! qtdemux ! h264parse ! avdec_h264 ! autovideosink

Expected Result:

MP4 video played correctly

Video recording in MP4 format (H.264 VPU-accelerated Encoding)

The following pipeline captures from a camera, encodes the video with the hardware codec and stores it as an mp4 file:

gst-launch-1.0 -e -v qtiqmmfsrc camera=0 ! "video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1,interlace-mode=progressive,colorimetry=bt601" ! v4l2h264enc capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=12000000,video_bitrate_mode=0;" ! h264parse ! mp4mux ! filesink location=v4l2h264enc-camera-encoding.mp4

Expected Result:

MP4 file generated correctly

Video playing of an MP4 file (H.264 VPU-accelerated Decoding)

The following pipeline decodes an mp44 video with hardware acceleration and renders it to display:

 gst-launch-1.0 -e -v filesrc location=v4l2h264dec.mp4 ! qtdemux ! h264parse ! v4l2h264dec ! waylandsink

Expected Result:

MP4 video played correctly

Camera capture and recording in MP4 format (H.264 VPU-accelerated Encoding)

The following pipeline captures from camera, encodes using the hardware codec and stores the video to an mp4 file:

gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 ! \
video/x-raw,format=NV12,width=1280,height=720,framerate=30/1,\
interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc \
capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=6000000,\
video_bitrate_mode=0;" ! h264parse ! mp4mux ! filesink location=camera-test.mp4

Expected Result:

MP4 video generated correctly

Video Transformation with qtivtransform

The following pipeline captures from camera, rotates the video, encodes with hardware acceleration and saves the result to a mp4 file:

gst-launch-1.0 -e -v qtiqmmfsrc camera=0 ! "video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1" ! qtivtransform rotate=1 ! v4l2h264enc capture-io-mode=4 output-io-mode=5 extra-controls="controls,video_bitrate=12000000,video_bitrate_mode=0;" ! h264parse ! mp4mux ! filesink location=qtivtransform-example.mp4

Expected Result:

MP4 video generated correctly with expected transformation (rotation)

Video Transformation with gltransform

The following pipeline captures from a synthetic source, uses the gl elements to perform a rotation on the Z axis, encodes the video with hardware codec and stores it to a mp4 file:

gst-launch-1.0 -v videotestsrc num-buffers=300 ! glupload ! gltransformation rotation-z=45 ! glcolorconvert ! gldownload ! video/x-raw,format=NV12 ! v4l2h264enc ! h264parse ! mp4mux ! filesink location=gpu-transformation.mp4

Expected Result:

MP4 video generated correctly with expected transformation (a rotation in Z axis)

For more advanced examples, please visit the following links:

For acceleration testing, you can also use the following links:

FAQ

Why start with videotestsrc?
A synthetic source isolates GStreamer, caps negotiation, codec, and display behavior from camera hardware, making it the simplest starting point for building video pipelines.
What to do if the pipeline fails?
Inspect the command line output for warnings and errors. If this does not provide information, increase the debug level, see GStreamer Debugging.

Related pages

References



Cookies help us deliver our services. By using our services, you agree to our use of cookies.