This section lists Gstreamer commands that can be used to activate a camera by either streaming data from the camera as a viewfinder on a display (or HDMI output) or by sending the data stream to a video encoder for compression and storage as a video file.

Gstreamer offers additional features and commands that may not be enabled nor supported by the development platform hardware or Ref-OS-IoT software image.

Simultaneous Pipelines

The software support at the Gstreamer level is currently limited to configuring a single Image Processing Unit pipeline per camera. This means that it is possible to run a viewfinder, but not possible to run a viewfinder and at the same time record the video stream (or capture an image as JPEG). This is a limitation in the current implementation of the icamerasrc and icamera_adapter software components.

Note: Each instance of icamerasrc can only support one camera hardware module source. Multiple instances of icamerasrc can be run simultaneously but a single camera module source cannot be shared by more than one icamerasrc instance.

Additionally, the maximum resolution viewfinder stream supported for the reference 13 Mpixel camera is 4k (3840 x 2160).

It is not possible to get the full 13 Mpixel output using Gstreamer.

See Example Test Cases to understand how to capture 13 Mpixel resolution still images.

Viewfinder Service

All the viewfinder commands below require a UI to be running. If the Xfce Desktop is not already running, please start it with:

startxfce4 &

When running viewfinder commands from a remote shell such as ssh, remember to run this command first:

export DISPLAY=:0.0

It can also be useful to disable the screensaver. This will prevent the screen from going black after a while:

xset s off –dpms

The viewfinder streams can be shown in full-screen mode by adding the fullscreen option to the vaapisink. Also the output framerate of the IPU (Image Processing Unit) can be viewed by adding the printfps option to the icamerasrc. Finally, for viewfinding, the orientation of the stream can be controlled via the rotation option.

gst-launch-1.0 icamerasrc num-buffers=300 device-name=0 io-mode=3 printfps=true ! video/x-raw,format=NV12,width=1920,height=1080 ! vaapisink dmabuf–alloc-tiled=true fullscreen=true rotation=180

The io-mode parameter controls whether the camera HAL outputs image buffers via MMAP (memory mapping) or DMA. The best performance is achieved when DMA is used and should in general be used whenever the buffers are passed to any of the vaapi plugins. However, some use cases might require MMAP mode to be used. E.g. when inserting a tee element in the Gstreamer pipeline to duplicate and route the buffers to different processing components or if the buffers are picked up by an application via the appsink element.

Additionally, the IPU and the HW acceleration blocks used for video encoding works most efficiently when the data in the image buffers is stored in a proprietary tiled format. Therefore, the camera HAL will output the image buffers in this tiled format whenever the DMA mode is selected but in normal sequential format when the MMAP mode is selected. Unfortunately the vaapi plug-ins cannot detect this automatically though, so when DMA is used, it is required to pass the dmabuf-alloc-tiled=true parameter to the vaapi plugins in order to inform them that the DMA input buffers are using the tiled data format.

Summary of Supported Resolutions and Framerates

Camera View finder Video Record, H264 (No viewfinder) View Finder + H264 compressed stream output via WLAN
5MP VGA 30
720p30
720p60
1080p30
1080p60
VGA 30
720p30
720p60
1080p30
1080p60
VGA 30
720p30
720p60
1080p30
13MP VGA 30
720p30
720p60
720p115
1080p30
1080p60
2160p30
VGA 30
720p30
720p60
720p115
1080p30
1080p60
2160p30
VGA 30
720p30
720p60
1080p30
5MP + 13MP VGA 30
720p30
1080p30
VGA 30
720p30
1080p30
VGA 30
720p30
1080p30

 

More Examples at these links:

Gstreamer 5MP Examples

Gstreamer 13MP Examples

Gstreamer Video Examples

Examples with Multiple Cameras

Camera Test Cases

 

有关编译器优化的更完整信息,请参阅优化通知