wiki:Yocto/gstreamer/video

Video

The following pipeline examples utilize plugins from the the Freescale gst-fsl-plugin package on GStreamer 0.10.

gst-fsl-plugin elements used:

  • Output:
    • mfw_v4lsink - stretch and render video frames to a V4L output device using hardware acceleration via the IMX6 IPU.
  • Input:
    • mfw_v4lsrc - capture video utilizing hardware acceleration via the IMX6 IPU.
    • tvsrc - capture video from an interlaced source utilizing hardware acceleration via the IMX6 IPU to capture and de-interlace.
  • Encode / Decode:
    • vpuenc - encode video using the specified code utilizing hardware acceleration via the IMX6 VPU.
    • vpudec - decode video utilizing hardware acceleration via the IMX6 VPU.

For a description of Video devices see:

References:

Output

For boards that support video out, the following pipeline will generate a video test pattern and output it to the first video device using v4l:

gst-launch videotestsrc pattern=18 ! mfw_v4lsink device=/dev/video16

Input

We can even take video from an external source and stream it to a display

gst-launch mfw_v4lsrc device=/dev/video0 ! mfw_v4lsink device=/dev/video16
  • tvsrc is used for interlaced video input such as Ventana Analog video In
  • mfw_v4lsrc is used for non-interlaced video input such as HDMI video In available on the GW54xx and GW551x

Encoding

Here is a simple example that encodes a test pattern (pattern 18 is a bouncing ball) to MJPEG and stored to a file with an AVI container.

gst-launch videotestsrc pattern=18 num-buffers=512 ! vpuenc codec=mjpg ! \
  avimux ! filesink location=/tmp/test.avi

Decoding

We can decode the video from an avi using vpudec which utilizes hardware decoding from the VPU:

gst-launch filesrc location=/media/sda1/big_buck_bunny_720p_surround.avi ! \
 avidemux ! vpudec ! mfw_v4lsink device=/dev/video16

Transcoding

We can transcode a file from an avi bin and encode to the H.263 standard

gst-launch filesrc location=/media/sda1/big_buck_bunny_720p_surround.avi ! \
  avidemux ! vpudec ! vpuenc codec=h263 ! filesink location=/tmp/test.mov

References:

Video loopback (Useful for testing video input and output)

A simple video loopback test can take video input and output it to the HDMI output as shown in the example below from a GW5400:

Digital HDMI Video Input to HDMI Video Output:

gst-launch mfw_v4lsrc device=/dev/video0 ! mfw_v4lsink device=/dev/video16
  • Note: For certain resolutions / modes tvsrc may work for HDMI input but typically should not be used.

Analog Video Input to HDMI Video Output:

gst-launch -v tvsrc device=/dev/video1 ! mfw_v4lsink device=/dev/video16
  • Note that the GW54xx has digital HDMI input as well which is /dev/video0. Boards with analog video input only will present it on /dev/video0

We also invite you to look at this script for similar use cases and examples. This script is what we use to test video input and output capabilities.

Last modified 4 months ago Last modified on 10/21/2017 10:28:45 PM