Camera model
046d:082d Logitech, Inc. HD Pro Webcam C920
What is the problem?
mjpg-streamer seems to need to run with the YUV flag despite being listed as a mjpeg compatible camera https://github.com/OctoPrint/OctoPrint/wiki/Webcams-known-to-work. Without the flag, the webcam script (shared below) errors out. While its not a huge issue and would be working with the YUV flag, I would like to find out why is a mjpeg compatible camera not working
What did you already try to solve it?
Tried to turn on/off the flag, tried to fiddle about v4l2-ctl
settings to check for pixel format. Am I missing something here? Do I need to set the device pixel format/video input? (tried as shown here: http://trac.gateworks.com/wiki/linux/v4l2, but it defaults to mjpeg), as seen here:
pi@octopi4:/etc/init.d $ v4l2-ctl --device /dev/video0 --all
Driver Info:
Driver name : uvcvideo
Card type : HD Pro Webcam C920
Bus info : usb-0000:01: 00.0-1.1
Driver version : 4.19.75
Capabilities : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : uvcvideo
Model : HD Pro Webcam C920
Serial : BFFA86DF
Bus info : 1.1
Media version : 4.19.75
Hardware revision: 0x00000011 (17)
Driver version : 4.19.75
Interface Info:
ID : 0x03000002
Type : V4L Video
Entity Info:
ID : 0x00000001 (1)
Name : HD Pro Webcam C920
Function : V4L2 I/O
Flags : default
Pad 0x01000007 : 0: Sink
Link 0x0200001f: from remote pad 0x100000a of entity 'Processing 3': Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
Width/Height : 1920/1080
Pixel Format : 'MJPG' (Motion-JPEG)
Field : None
Bytes per Line : 0
Size Image : 4147200
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 1920, Height 1080
Default : Left 0, Top 0, Width 1920, Height 1080
Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 1920, Height 1080, Flags:
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1080, Flags:
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 10.000 (10/1)
Read buffers : 0
brightness 0x00980900 (int) : min=0 max=255 step=1 default=128 value=128
contrast 0x00980901 (int) : min=0 max=255 step=1 default=128 value=128
saturation 0x00980902 (int) : min=0 max=255 step=1 default=128 value=128
white_balance_temperature_auto 0x0098090c (bool) : default=1 value=1
gain 0x00980913 (int) : min=0 max=255 step=1 default=0 value=105
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=2 value=2
white_balance_temperature 0x0098091a (int) : min=2000 max=6500 step=1 default=4000 value=5838 flags=inactive
sharpness 0x0098091b (int) : min=0 max=255 step=1 default=128 value=128
backlight_compensation 0x0098091c (int) : min=0 max=1 step=1 default=0 value=0
exposure_auto 0x009a0901 (menu) : min=0 max=3 default=3 value=3
exposure_absolute 0x009a0902 (int) : min=3 max=2047 step=1 default=250 value=333 flags=inactive
exposure_auto_priority 0x009a0903 (bool) : default=0 value=1
pan_absolute 0x009a0908 (int) : min=-36000 max=36000 step=3600 default=0 value=0
tilt_absolute 0x009a0909 (int) : min=-36000 max=36000 step=3600 default=0 value=0
focus_absolute 0x009a090a (int) : min=0 max=250 step=5 default=0 value=40 flags=inactive
focus_auto 0x009a090c (bool) : default=1 value=1
zoom_absolute 0x009a090d (int) : min=100 max=500 step=1 default=100 value=100
These are my list-exts
output (I've shortened it for brevity):
pi@octopi4:/etc/init.d $ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'YUYV' (YUYV 4:2: 2)
...
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)
[1]: 'H264' (H.264, compressed)
...
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)
[2]: 'MJPG' (Motion-JPEG, compressed)
...
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
...
Interval: Discrete 0.200s (5.000 fps)
These are my /etc/init.d/webcam
settings
#!/bin/bash
### BEGIN INIT INFO
# Provides: webcam
# Required-Start: $local_fs networking octoprint
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: webcam daemon for Octoprint
# Description: Starts the webcam daemon with the user specified in
# /usr/local/bin/mjpg_streamer.
### END INIT INFO
MJPG_STREAMER_BIN="/usr/local/bin/mjpg_streamer" # "$(dirname $0)/mjpg_streamer"
MJPG_STREAMER_WWW="/usr/local/share/mjpg-streamer/www"
MJPG_STREAMER_LOG_FILE="${0%.*}.log" # "$(dirname $0)/mjpg-streamer.log"
RUNNING_CHECK_INTERVAL="2" # how often to check to make sure the server is running (in seconds)
HANGING_CHECK_INTERVAL="3" # how often to check to make sure the server is not hanging (in seconds)
VIDEO_DEV="/dev/video0"
FRAME_RATE="10"
QUALITY="80"
RESOLUTION="VGA" # 160x120 176x144 320x240 352x288 424x240 432x240 640x360 640x480 800x448 800x600 960x544 1280x720 1920x1080 (QVGA, VGA, SVGA, WXGA) # lsusb -s 001:006 -v | egrep "Width|Height" # https://www.textfixer.com/tools/alphabetical-order.php # v4l2-ctl --list-formats-ext # Show Supported Video Formates
PORT="8080"
YUV="yes"
################INPUT_OPTIONS="-r ${RESOLUTION} -d ${VIDEO_DEV} -f ${FRAME_RATE} -q ${QUALITY} -pl 60hz"
INPUT_OPTIONS="-r ${RESOLUTION} -d ${VIDEO_DEV} -q ${QUALITY} -pl 60hz -f ${FRAME_RATE}" # Limit Framerate with "--every_frame ", ( mjpg_streamer --input "input_uvc.so --help" )
if [ "${YUV}" == "true" ]; then
INPUT_OPTIONS+=" -y"
fi
OUTPUT_OPTIONS="-p ${PORT} -w ${MJPG_STREAMER_WWW}"
# ==========================================================