AnsweredAssumed Answered

How to record video from Webcam and save to mp4 file with GStreamer ?

Question asked by toanjunifer@gmail.com on Feb 25, 2020
Latest reply on Mar 23, 2020 by toanjunifer@gmail.com

Hi,

I'm using iMX6S (Ubuntu 16.04) with Logitech C270 Webcam and trying to record a video from webcam with GStreamer. But I always got error like:

ERROR: v4l2 capture: slave not found!

WARNING: erroneous pipeline: could not link imxv4l2src0 to vpuenc_h264-0

I'm using this:

gst-launch-1.0 imxv4l2src device=/dev/video1 num-buffers=300 typefind=true ! 'video/x-h264,format=(string)UYVY,width=1280,height=720,framerate=(fraction)15/1' ! vpuenc_h264 ! mp4mux ! filesink location=output.mp4

 

Did I missing something or wrong position something ? I refer to i.MX Linux® User's Guide.

 

UPDATE:

I also try with by adding videoconvert and change 'video/x-h264' to 'video/x-raw'

gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=300 ! 'video/x-raw,format=(string)UYVY,width=1280,height=720,framerate=(fraction)15/1' ! videoconvert ! vpuenc_h264 ! mp4mux ! filesink location=output.mp4

And still get error:

ERROR: v4l2 capture: slave not found!
Setting pipeline to PAUSED ...
[INFO] Product Info: i.MX6Q/D/S
====== VPUENC: 4.0.9 build on Jun 22 2016 17:54:13. ======
wrapper: 1.0.65 (VPUWRAPPER_ARM_LINUX Build on Jun 22 2016 17:50:25)
vpulib: 5.4.33
firmware: 3.1.1.46072
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
Additional debug info:
/home/pico/workspace/yocto/tn_yocto_4.1.15/build-x11/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/gstreamer1.0/1.6.0-r0/gstreamer-1.6.0/libs/gst/base/gstbasesrc.c(2943): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 0:00:01.918506967
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

Thank you so much,

Toan

Outcomes