v4l2src

v4l2src

Properties

gchar * device Read / Write
gchar * device-name Read
GstV4l2DeviceTypeFlags flags Read
gint device-fd Read
gint brightness Read / Write
gint contrast Read / Write
gint hue Read / Write
gint saturation Read / Write
V4L2_TV_norms norm Read / Write
GstV4l2IOMode io-mode Read / Write
GstStructure * extra-controls Read / Write
gboolean force-aspect-ratio Read / Write
gchar * pixel-aspect-ratio Read / Write

Signals

void prepare-format Run Last

Types and Values

struct GstV4l2Src

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GstObject
            ╰── GstElement
                ╰── GstBaseSrc
                    ╰── GstPushSrc
                        ╰── GstV4l2Src

Implemented Interfaces

GstV4l2Src implements GstURIHandler, GstTuner, GstColorBalance and GstVideoOrientation.

Description

v4l2src can be used to capture video from v4l2 devices, like webcams and tv cards.

Example launch lines

1
gst-launch-1.0 v4l2src ! xvimagesink
This pipeline shows the video captured from /dev/video0 tv card and for webcams.
1
gst-launch-1.0 v4l2src ! jpegdec ! xvimagesink
This pipeline shows the video captured from a webcam that delivers jpeg images.

Synopsis

Element Information

plugin

video4linux2

author

Edgard Lima <edgard.lima@indt.org.br>, Stefan Kost <ensonic@users.sf.net>

class

Source/Video

Element Pads

name

src

direction

source

presence

always

details

image/jpeg

video/mpeg, mpegversion=(int)4, systemstream=(boolean)false

video/mpeg, mpegversion=(int)2

video/mpegts, systemstream=(boolean)true

video/x-bayer, format=(string){ bggr, gbrg, grbg, rggb }, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], framerate=(fraction)[ 0/1, 2147483647/1 ]

video/x-dv, systemstream=(boolean)true

video/x-h263, variant=(string)itu

video/x-h264, stream-format=(string){ byte-stream, avc }, alignment=(string)au

video/x-pwc1, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], framerate=(fraction)[ 0/1, 2147483647/1 ]

video/x-pwc2, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], framerate=(fraction)[ 0/1, 2147483647/1 ]

video/x-raw, format=(string){ RGB16, BGR, RGB, GRAY8, GRAY16_LE, GRAY16_BE, YVU9, YV12, YUY2, YVYU, UYVY, Y42B, Y41B, YUV9, NV12_64Z32, NV24, NV61, NV16, NV21, NV12, I420, BGRA, BGRx, ARGB, xRGB, BGR15, RGB15 }, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], framerate=(fraction)[ 0/1, 2147483647/1 ]

video/x-sonix, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], framerate=(fraction)[ 0/1, 2147483647/1 ]

video/x-vp8

video/x-wmv, wmvversion=(int)3, format=(string)WVC1

Functions

Types and Values

struct GstV4l2Src

struct GstV4l2Src;

Opaque object.

Property Details

The “device” property

  “device”                   gchar *

Device location.

Flags: Read / Write

Default value: "/dev/video0"


The “device-name” property

  “device-name”              gchar *

Name of the device.

Flags: Read

Default value: NULL


The “flags” property

  “flags”                    GstV4l2DeviceTypeFlags

Device type flags.

Flags: Read


The “device-fd” property

  “device-fd”                gint

File descriptor of the device.

Flags: Read

Allowed values: >= G_MAXULONG

Default value: -1


The “brightness” property

  “brightness”               gint

Picture brightness, or more precisely, the black level

Flags: Read / Write

Default value: 0


The “contrast” property

  “contrast”                 gint

Picture contrast or luma gain

Flags: Read / Write

Default value: 0


The “hue” property

  “hue”                      gint

Hue or color balance

Flags: Read / Write

Default value: 0


The “saturation” property

  “saturation”               gint

Picture color saturation or chroma gain

Flags: Read / Write

Default value: 0


The “norm” property

  “norm”                     V4L2_TV_norms

TV norm

Flags: Read / Write

Default value: none


The “io-mode” property

  “io-mode”                  GstV4l2IOMode

IO Mode

Flags: Read / Write

Default value: GST_V4L2_IO_AUTO


The “extra-controls” property

  “extra-controls”           GstStructure *

Additional v4l2 controls for the device. The controls are identified by the control name (lowercase with '_' for any non-alphanumeric characters).

Flags: Read / Write

Since: 1.2


The “force-aspect-ratio” property

  “force-aspect-ratio”       gboolean

When enabled, the pixel aspect ratio queried from the device or set with the pixel-aspect-ratio property will be enforced.

Flags: Read / Write

Default value: TRUE

Since: 1.2


The “pixel-aspect-ratio” property

  “pixel-aspect-ratio”       gchar *

The pixel aspect ratio of the device. This overwrites the pixel aspect ratio queried from the device.

Flags: Read / Write

Default value: "1/1"

Since: 1.2

Signal Details

The “prepare-format” signal

void
user_function (GstV4l2Src *v4l2src,
               gint        fd,
               GstCaps    *caps,
               gpointer    user_data)

This signal gets emitted before calling the v4l2 VIDIOC_S_FMT ioctl (set format). This allows for any custom configuration of the device to happen prior to the format being set. This is mostly useful for UVC H264 encoding cameras which need the H264 Probe & Commit to happen prior to the normal Probe & Commit.

Parameters

v4l2src

the v4l2src instance

 

fd

the file descriptor of the current device

 

caps

the caps of the format being set

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 0.10.32