Search code examples
linuxffmpegraspberry-piwebcam

Web camera Logitech and Linux


I have Logitech C310 camera with the declared characteristics of 720p 30fps.

If you connect the camera to windows, the recording is fully consistent with the stated 720p 30fps - the picture is clear.

The challenge is to connect the same camera to OrangePI (server Armbian) and to save video files on it.

The camera appears as /dev/video0.

sudo ffmpeg -f v4l2 -s 1280x720 -i /dev/video0 output.wmv

As a result, I get a crumbly picture with a frequency of 5 fps.

Maybe I'm using ffmpeg incorrectly? Please help me who has experience with Web cameras on Linux ... Thanks in advance.

USB-camera configuration:

v4l2-ctl --all --device=/dev/video0


Driver Info (not using libv4l2):
        Driver name   : uvcvideo
        Card type     : UVC Camera (046d:081b)
        Bus info      : usb-1c1c000.usb-1
        Driver version: 4.14.18
        Capabilities  : 0x84200001
                Video Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps   : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
        Width/Height      : 1280/720
        Pixel Format      : 'YUYV'
        Field             : None
        Bytes per Line    : 2560
        Size Image        : 1843200
        Colorspace        : sRGB
        Transfer Function : Default
        YCbCr/HSV Encoding: Default
        Quantization      : Default
        Flags             :
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 1280, Height 720
        Default     : Left 0, Top 0, Width 1280, Height 720
        Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 1280, Height 720
Selection: crop_bounds, Left 0, Top 0, Width 1280, Height 720
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 5.000 (5/1)
        Read buffers     : 0
                     brightness (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast (int)    : min=0 max=255 step=1 default=32 value=32
                     saturation (int)    : min=0 max=255 step=1 default=32 value=32
 white_balance_temperature_auto (bool)   : default=1 value=1
                           gain (int)    : min=0 max=255 step=1 default=64 value=192
           power_line_frequency (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=0 max=10000 step=10 default=4000 value=4610 flags=inactive
                      sharpness (int)    : min=0 max=255 step=1 default=24 value=24
         backlight_compensation (int)    : min=0 max=1 step=1 default=0 value=0
                  exposure_auto (menu)   : min=0 max=3 default=3 value=3
              exposure_absolute (int)    : min=1 max=10000 step=1 default=166 value=249 flags=inactive
         exposure_auto_priority (bool)   : default=0 value=1
                      led1_mode (menu)   : min=0 max=3 default=3 value=3
                 led1_frequency (int)    : min=0 max=131 step=1 default=0 value=0

Solution

  • I run a webcam on a Raspberry Pi Raspbian, this is the code i use to capture video (this runs at 25 fps fine):

                var args = [
                "-i",
                "/dev/video0",
                "-r",
                "25",
                "-qscale",
                "1",
                "out.avi"
            ];
    
            var process = spawn("avconv", args);
    

    "avconv" is the same as ffmpeg pretty much, i don't know the specifics of the difference but this may work for you. Very basic example, this was just to test the camera. -r specify fps, -qscale is quality (there are alternative commands).