Skip to main content

Linux Set Video Formats in Camera and Memory - Knowledgebase / FAQ - The Imaging Source Helpdesk

Linux Set Video Formats in Camera and Memory

Authors list

This article explains, how to set RGB32, RGB24, GRAY8, Bayer raw 8 bit and Bayer raw 16 with tcambin and GStreamer.

The color formats are quite simple:

RGB32

    format="video/x-raw, format=BGRx, width=640, height=480,framerate=30/1"

    gst-launch-1.0 tcambin ! $format ! videoconvert ! videoscale !  ximagesink


RGB24

    format="video/x-raw, format=BGR, width=640, height=480,framerate=30/1"

    gst-launch-1.0 tcambin ! $format ! videoconvert ! videoscale !  ximagesink


GRAY8

GRAY8 provides are gray scale image. This is not to be mixed with Bayer Raw data, because if a color camera is used, this is debayered. The Bayer Mosaic pattern is lost.

    format="video/x-raw, format=GRAY8, width=640, height=480,framerate=30/1"

    gst-launch-1.0 tcambin ! $format ! videoconvert ! videoscale !  ximagesink


The 8 bit and 16 bit Bayer Raw are set as follows:

Bayer Raw 8 bit:

    format="video/x-bayer, format=rggb, width=640, height=480,framerate=30/1"

    displayformat="video/x-raw, format=GRAY8, width=640, height=480,framerate=30/1"

    gst-launch-1.0 tcambin ! $format ! capssetter join=false replace=true caps="$displayformat" ! videoconvert ! videoscale !  ximagesink

Bayer Raw 16 bit:

    format="video/x-bayer, format=rggb16, width=640, height=480,framerate=30/1"

    displayformat="video/x-raw, format=GRAY16_LE, width=640, height=480,framerate=30/1"

    gst-launch-1.0 tcambin ! $format ! capssetter join=false replace=true caps="$displayformat" ! videoconvert ! videoscale !  ximagesink 

The capsetter module is used for replacing "video/x-bayer" with "video/x-raw" and "rggb" with "GRAY". This makes the format understandable by the videoconvert module.  Using these formats makes the Bayer Mosaic pattern of the Raw data visible as checker board pattern on the live view.

The Bayer start pattern "rggb" depends on the used color camera model.  Use "tcam-ctrl -c <serial>" in order to get the start pattern of the currently used camera model

Helpful Unhelpful