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

cancel
Showing results for 
Search instead for 
Did you mean: 

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

Jump to solution
4,482 Views
toanjunifer
Senior Contributor I

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

Labels (1)
1 Solution
3,499 Views
joanxie
NXP TechSupport
NXP TechSupport

did you enable it in the kernel? maybe you can refer to the document as below:

https://community.nxp.com/docs/DOC-93688 

View solution in original post

4 Replies
3,499 Views
toanjunifer
Senior Contributor I

Thank you for your response. It's so helpful. I going to try and tell you soon. 

0 Kudos
3,499 Views
joanxie
NXP TechSupport
NXP TechSupport

what camera do you use? if you use mipi, pls try to refer to the document  as below:

https://community.nxp.com/thread/307065?commentID=503426#comment-503426 

3,499 Views
toanjunifer
Senior Contributor I

As I mention above, I use webcam Logitech C270. So It's can not use with MIPI (as I know). Do you have any idea ?

0 Kudos
3,500 Views
joanxie
NXP TechSupport
NXP TechSupport

did you enable it in the kernel? maybe you can refer to the document as below:

https://community.nxp.com/docs/DOC-93688 

View solution in original post