Template:Glsdk running gstreamer

Running a gstreamer pipeline
GStreamer v1.14.4 is supported in Processor SDK in Processor SDK Linux Automotive 6.00

Gstreamer pipelines can also run from command line. In order to do so, exit Weston by pressing Ctrl-Alt-Backspace from the keyboard which connects to the EVM. Then, if the LCD screen stays in "Please wait...", press Ctrl-Alt-F1 to go to the command line on LCD console. After that, the command line can be used from serial console, SSH console, or LCD console.

One can run an audio video file using the gstreamer playbin from the console. Currently, the supported Audio/video sink is kmssink, waylandsink and alsassink.

kmssink: target # gst-launch playbin2 uri=file:/// video-sink=kmssink audio-sink="alsasink device=hw:1,0"

waylandsink: 1. refer to start the weston 2. target # gst-launch playbin2 uri=file:/// video-sink=waylandsink audio-sink="alsasink device=hw:1,0"

dri2videosink: 1. refer to start the X11 2. target # gst-launch playbin2 uri=file:/// video-sink=dri2videosink audio-sink="alsasink device=hw:1,0" kmssink: target # gst-launch-1.0 playbin uri=file:/// video-sink=kmssink audio-sink=alsasink

waylandsink: 1. refer to start the weston 2. target # gst-launch-1.0 playbin uri=file:/// video-sink=waylandsink audio-sink=alsasink

The following pipelines show how to use vpe for scaling and color space conversion. 1. Decode-> Scale->Display target # gst-launch-1.0 -v filesrc location=example_h264.mp4 ! qtdemux ! h264parse ! \ ducatih264dec ! vpe ! 'video/x-raw, format=(string)NV12, width=(int)720, height=(int)480' ! kmssink

2. Color space conversion: target # gst-launch-1.0 -v videotestsrc ! 'video/x-raw, format=(string)YUY2, width= \ (int)1280, height=(int)720' ! vpe ! 'video/x-raw, format=(string)NV12, width=(int)720, height=(int)480' \ ! kmssink

Note: 1. While using playbin for playing the stream, vpe plugin is automatically picked up. However vpe cannot be used with playbin for scaling. For utilizing scaling capabilities of vpe, using manual pipeline given above is recommended. 2. Waylandsink and Kmssink uses the cropping metadata set on buffers and does not require vpe plugin for cropping

The following pipelines show how to use v4l2src and ducatimpeg4enc elements to capture video from VIP and encode captured video respectively. Capture and Display Fullscreen target # gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \ format=(string)YUY2, width=(int)1280, height=(int)720' ! vpe num-input-buffers=8 ! queue ! kmssink

Note: The following pipelines can also be used for NV12 capture-display usecase. Dmabuf is allocated by v4l2src if io-mode=4 and by kmssink and imported by v4l2src if io-mode=5 target # gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \ format=(string)NV12, width=(int)1280, height=(int)720' ! kmssink target # gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 io-mode=5 ! 'video/x-raw, \ format=(string)NV12, width=(int)1280, height=(int)720' ! kmssink Capture and Display to a window in wayland 1. refer to start the weston 2. target # gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \ format=(string)YUY2, width=(int)1280, height=(int)720' ! vpe num-input-buffers=8 ! queue ! waylandsink

Note: The following pipelines can also be used for NV12 capture-display usecase. Dmabuf is allocated by v4l2src if io-mode=4 and by waylandsink and imported by v4l2src if io-mode=5. Waylandsink supports both shm and drm. A new property use-drm is added to specify drm allocator based bufferpool to be used. When using ducati or vpe plugins, use-drm is set in caps as true. target # gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \ format=(string)NV12, width=(int)1280, height=(int)720' ! waylandsink use-drm=true target # gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 io-mode=5 ! 'video/x-raw, \ format=(string)NV12, width=(int)1280, height=(int)720' ! waylandsink use-drm=true Capture and Encode into a MP4 file. target # gst-launch-1.0 -e v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \ format=(string)YUY2, width=(int)1280, height=(int)720, framerate=(fraction)30/1' ! vpe num-input-buffers=8 ! \ queue ! ducatimpeg4enc bitrate=4000 ! queue ! mpeg4videoparse ! qtmux ! filesink location=x.mp4

Note: The following pipeline can be used in usecases where vpe processing is not required. target # gst-launch-1.0 -e v4l2src device=/dev/video1 num-buffers=1000 io-mode=5 ! 'video/x-raw, \ format=(string)NV12, width=(int)1280, height=(int)720, framerate=(fraction)30/1' ! ducatimpeg4enc bitrate=4000 ! \ queue ! mpeg4videoparse ! qtmux ! filesink location=x.mp4

Capture and Encode and Display in parallel. target # gst-launch-1.0 -e v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \ format=(string)YUY2, width=(int)1280, height=(int)720, framerate=(fraction)30/1' ! vpe num-input-buffers=8 ! tee name=t ! \ queue ! ducatimpeg4enc bitrate=4000 ! queue ! mpeg4videoparse ! qtmux ! filesink location=x.mp4 t. ! queue ! kmssink