Capturing single frame with uvch264src

Petteri Matilainen pmatil at gmail.com
Mon Nov 23 04:22:26 PST 2015


I have a Logitech C920 web camera which outputs H264, RAW and MJPEG
streams. I have the H264 video streaming working fine but now I'm
looking for a pipeline to save a single jpeg image continuously. I
tried to get the RAW image from the camera and then just jpegenc it
etc. but that did not work at all. I got an empty file if gstreamer
did not crash with an error message.

Here's a pipeline that works:

gst-launch-1.0 -v -e uvch264src initial-bitrate=2000000
average-bitrate=2000000 peak-bitrate=3000000 rate-control=vbr
iframe-period=1000 name=src auto-start=true \

src.vfsrc ! queue !
video/x-raw,format=\(string\)YUY2,width=320,height=240,framerate=10/1
! fakesink \

src.vidsrc ! queue !
video/x-h264,width=1280,height=720,framerate=30/1,profile=high,stream-format=byte-stream
\

! decodebin ! videoconvert ! jpegenc quality=30 idct-method=2 !
multifilesink location="/dev/shm/webcam.jpg"

However, if I try to get RAW stream from the webcam using something
like src.vidsrc ! queue !
video/x-raw,format=(string)YUV,width=1280,height=720,framerate=30/1 I
either get an empty file, internal dataflow error or not linked
-error. Could it be that uvch264src does not support the RAW format ot
the camera? uvch264src does have video/x-raw capabilities in numerous
formats.

using uvcdynctrl -f I get a list of the frame formats supported:

Pixel format: YUYV (YUV 4:2:2 (YUYV); MIME type: video/x-raw-yuv)

Pixel format: H264 (H.264)

Pixel format: MJPG (MJPEG; MIME type: image/jpeg)


There is no YUYV format in uvch264src's capabilities and I tried YUY2,
YUV formats. I know the camera supports still image capture too but it
seems uvch264src does not although it has a imgsrc template it has no
capabilities (EMPTY). What do you think?


More information about the gstreamer-devel mailing list