0

I want to record an Hd video stream via this webcam (hopefully using a script) to capture simultaneously with a screen recording into one container. (you can see the pipeline code I've used before, below)

as far as I know v4l2 doesn't support 1080 recording for this type of camera in fps more than 5 and I really need a hd stream with at least 20 fps. is there any other way or application for this purpose?

below is the pipeline code of gstreamer and it's based on v4l2 and it can capture only 720P in 10 fps which is not enough at all! I do believe that ffmpeg has the same result since it's using v4l2 too. (please note that it's possible to capture 1080 with 5 fps (the command below) but I guess you can imagine how the quality would be(!) therefore I need fps more than 20)

I really appreciate if you could help me with this!

here is the gstreamers' pipeline code:

 gst-launch -e mpegtsmux name="muxer" ! filesink location=/home/sina/Desktop/UI4.ts \
 v4l2src device="/dev/video1" ! video/x-raw-yuv, width=1280 ,height=720, \
  framerate=10/1 ! videorate ! ffmpegcolorspace ! x264enc ! muxer. v4l2src \
  device="/dev/video0" ! video/x-raw-yuv, width=1024 ,height=768,framerate=10/1 \
 ! x264enc !  muxer.  pulsesrc device="alsa_input.usb-046d_Logitech_Webcam_C930e_AAF8A63E-02-C930e.analog-stereo"\
  ! audioconvert ! lamemp3enc target=1 cbr=true  ! muxer. 

FYI here is the outcome of v4l2-ctl -d /dev/video1 --list-formats:

ioctl: VIDIOC_ENUM_FMT
 Index       : 0
 Type        : Video Capture
 Pixel Format: 'YUYV'
 Name        : YUV 4:2:2 (YUYV)
     Size: Discrete 640x480
         Interval: Discrete 0.033s (30.000 fps)
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 160x120
         Interval: Discrete 0.033s (30.000 fps)
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 176x144
         Interval: Discrete 0.033s (30.000 fps) 
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 320x180
         Interval: Discrete 0.033s (30.000 fps)
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 320x240
         Interval: Discrete 0.033s (30.000 fps)
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 352x288
         Interval: Discrete 0.033s (30.000 fps)
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 424x240
         Interval: Discrete 0.033s (30.000 fps)
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 480x270
         Interval: Discrete 0.033s (30.000 fps)
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 640x360
         Interval: Discrete 0.033s (30.000 fps)
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 800x448
         Interval: Discrete 0.033s (30.000 fps)
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 800x600
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 848x480
         Interval: Discrete 0.033s (30.000 fps)
         Interval: Discrete 0.042s (24.000 fps)
         Interval: Discrete 0.050s (20.000 fps)
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 960x540
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 1024x576
         Interval: Discrete 0.067s (15.000 fps)
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 1280x720
         Interval: Discrete 0.100s (10.000 fps)
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 1600x896
         Interval: Discrete 0.133s (7.500 fps)
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 1920x1080
         Interval: Discrete 0.200s (5.000 fps)
     Size: Discrete 2304x1296
         Interval: Discrete 0.500s (2.000 fps)
     Size: Discrete 2304x1536
         Interval: Discrete 0.500s (2.000 fps)

 Index       : 1
 Type        : Video Capture
 Pixel Format: 'MJPG' (compressed)
 Name        : MJPEG
     Size: Discrete 640x480
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 160x120
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 176x144
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 320x180
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 320x240
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 352x288
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 424x240
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 480x270
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 640x360
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 800x448
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 800x600
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 848x480
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 960x540
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1024x576
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1280x720
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1600x896
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1920x1080
    Interval: Discrete 0.033s (30.000 fps)
    Interval: Discrete 0.042s (24.000 fps)
    Interval: Discrete 0.050s (20.000 fps)
    Interval: Discrete 0.067s (15.000 fps)
    Interval: Discrete 0.100s (10.000 fps)
    Interval: Discrete 0.133s (7.500 fps)
    Interval: Discrete 0.200s (5.000 fps)
0

To capture with FullHD video with more than 5fps you need the camera to use an encoded format and not raw video. From the v4l2 list-formats output you can see that it supports 30fps in FullHD with MJPEG.

So instead of using video/x-raw-yuv for your caps you should use image/jpeg. Mind you that if you need the final result to be H264 use a decoder before reencoding (jpegdec).

With that said, you are using gstreamer 0.10 that is now 3 years obsolete and unmantained. It is strongly recommended to move to 1.x version that is the current upstream version and has, among others, improved support for non-raw cameras.

1
  • Thanks a lot! it really helped me! I made another question about how to run two pipeline in sync simultaneously to record one from webcam and another one from frame grabber, can you please take a look at that question as well? I really appreciate your help! – Sina Sh May 29 '15 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.