CameraBin is a high-level camera object that encapsulates gstreamer elements, providing an API for controlling a digital camera.
Note that camerabin is still UNSTABLE and under development.
CameraBin has the following main features:
Display a viewfinder
Post preview images for each capture (video and image)
Camerabin can be created using
gst_element_factory_make() just like
any other element. Video or image capture mode can be selected using
the “mode” property and the file to save the capture is
selected using “location” property.
After creating camerabin, applications might want to do some customization (there's a section about this below), then select the desired mode and start capturing.
In image capture mode, just send a “start-capture” and a
picture will be captured. When the picture is stored on the selected
GST_MESSAGE_ELEMENT named 'image-done' will be posted on
In video capture mode, send a “start-capture” to start recording, then send a “stop-capture” to stop recording. Note that both signals are asynchronous, so, calling “stop-capture” doesn't guarantee that the video has been properly finished yet. Applications should wait for the 'video-done' message to be posted on the bus.
Camerabin provides various customization properties, allowing the user to set custom filters, selecting the viewfinder sink and formats to use to encode the captured images/videos.
GstEncodingProfiles are used to tell camerabin which formats it should encode the captures to, those should be set to “image-profile” and “video-profile”. Default is jpeg for images, and ogg (theora and vorbis) for video. If a profile without an audio stream is set for video, audio will be disabled on recordings.
“preview-caps” can be used to select which format preview images should be posted on the GstBus. It has to be a raw video format.
Camerabin has a “camera-source” property so applications can set their source that will provide buffers for the viewfinder and for captures. This camera source is a special type of source that has 3 pads. To use a 'regular' source with a single pad you should use GstWrapperCameraBinSource, it will adapt your source and provide 3 pads.
Applications can also select the desired viewfinder sink using “viewfinder-sink”, it is also possible to select the audio source using “audio-source”.
The viewfinder resolution can be configured using “viewfinder-caps”, these GstCaps should be a subset of “viewfinder-supported-caps”.
To select the desired resolution for captures, camerabin provides “image-capture-caps” and “video-capture-caps”, these caps must be a subset of what the source can produce. The allowed caps can be probed using “image-capture-supported-caps” and “video-capture-supported-caps”. In an analogous way, there are “audio-capture-caps” and “audio-capture-supported-caps”.
Camerabin also allows applications to insert custom GstElements on any of its branches: video capture, image capture, viewfinder and preview. Check “video-filter”, “image-filter”, “viewfinder-filter” and “preview-filter”.
Unfortunately, camerabin can't be really used from gst-launch-1.0, as you need to send signals to control it. The following pipeline might be able to show the viewfinder using all the default elements.
gst-launch-1.0 -v -m camerabin
|Thiago Santos <firstname.lastname@example.org>|