Read the videoconvert understood format

Nicolas Dufresne nicolas at ndufresne.ca
Mon Sep 11 19:56:06 UTC 2017


Le lundi 11 septembre 2017 à 15:24 +0000, simo zz a écrit :
> Hello,
> I am trying to understand what is the file format understood by
> videoconvert in the following pipeline:
> 
> v4l2src device=/dev/webcam ! videoconvert ! video/x-
> raw,width=544,height=288 ! multifilesink location=file%06d.raw

In this pipeline, videoconvert will be passthrough, because you didn't
specify a format in your caps filter, and multifilesink supports
everything format possible.

> 
> From the following doc
> 
> https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins
> -base-plugins/html/gst-plugins-base-plugins-videoconvert.html
> 
> I can read that videconvert will automatically convert the video to a
> format understood by the video sink.
> My request arise from the fact that I am a little bit confused with
> pixel formats.
> My USB camera has the following formats (read with v4l2-ctl --list-
> formats --device=/dev/webcam from a Linux distro)
> 
> ioctl: VIDIOC_ENUM_FMT
>     Index       : 0
>     Type        : Video Capture
>     Pixel Format: 'YUYV'
>     Name        : YUYV 4:2:2
> 
>     Index       : 1
>     Type        : Video Capture
>     Pixel Format: 'MJPG' (compressed)
>     Name        : Motion-JPEG
> 
> After reading the following page:
> 
> http://blogs.adobe.com/VideoRoad/2010/06/what_is_yuv.html
> 
> I undestand that YUYV 422 is a 3 channel file format.
> 
> But each raw file generated by the gststreamer pipeline is 313344
> bytes long, which is equals to 2 * 544 * 288 = 2 * width * height so
> I understand that the file format generated by the pipeline has 2
> channels so I don't understand what format is used.
> The assumption of 2 channels arise from the fact that if I specify
> format=GBR in the caps string, I obtain a raw file 470016 bytes long,
> which is 3 * 544 * 288 and later I can correctly decode the raw data
> to a png file using OpenCV.
> 
> So what is my file format generated by videoconvert ?
> How can I be sure of it ?

When using gst-launch-1.0, you can add the -v option, this will print
the format selected by each element. As you have fixed size buffer, and
that your camera only have two formats, it's clear the JPEG is not
selected (would be dynamic sized files). So that means you have YUYV,
which maps to YUY2.

YUY2 is a 16bit per pixel format (hence the size being width*height*2),
which is defined as packed. Each UV pair are re-uded for two Y values.
This is what we call subsampling.

> 
> PS: I sent the same request to the gstreamer-android mailing list. It
> was an error.
> 
> Thank you in advance for your help.
> Regards,
> Simon
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170911/05939db1/attachment.sig>


More information about the gstreamer-devel mailing list