The cheapest available endoscope camera on eBay was purchased, to test its properties on linux,
namely on a Raspberry Pi computer.
The camera enumerated without significant problems after connecting to USB, as a standard
UVC camera, with /dev/video0 device created. The LED ring for sample
illumination lit up immediately and stayed lit; probably fed directly from power.
The maximum image size is 640x480 pixels. Rather low, but good enough for basic work. There is no
onboard compression, only raw YUV output. This limits achievable framerate on low-power
boards, as the compression for streaming has to be done in CPU.
The camera is a plastic cylinder attached on a cable. The USB side connector is rather big, probably housing some electronics. It also contains a potentiometer, which regulates the LED brightness.
Around the pinhole camera there is a ring of six tiny white LEDs. These provide somewhat adequate illumination in most cases. Often the image is overly bright and the LEDs have to be dialed down.
The mjpg-streamer can be used for streaming the image. On Raspberry Pi v1 and v2 the performance
is rather low, due to unaccelerated CPU-based compression. GPU-accelerated compression would be desired.
./mjpg_streamer --input "./input_uvc.so" --output "./output_http.so -w ./www"[1006776.415400] usb 1-1.2: new high-speed USB device number 8 using dwc_otg [1006776.616267] usb 1-1.2: New USB device found, idVendor=1908, idProduct=2311 [1006776.616285] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [1006776.616298] usb 1-1.2: Product: USB2.0 PC CAMERA [1006776.616310] usb 1-1.2: Manufacturer: Generic [1006776.617567] uvcvideo: Found UVC 1.00 device USB2.0 PC CAMERA (1908:2311) [1006776.618949] input: USB2.0 PC CAMERA as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/input/input1
Bus 001 Device 008: ID 1908:2311 GEMBIRD
Bus 001 Device 008: ID 1908:2311 GEMBIRD
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x1908 GEMBIRD
idProduct 0x2311
bcdDevice 1.00
iManufacturer 1 Generic
iProduct 2 USB2.0 PC CAMERA
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 341
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 256mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 14 Video
bFunctionSubClass 3 Video Interface Collection
bFunctionProtocol 0
iFunction 2 USB2.0 PC CAMERA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 1 Video Control
bInterfaceProtocol 0
iInterface 2 USB2.0 PC CAMERA
VideoControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdUVC 1.00
wTotalLength 51
dwClockFrequency 48.000000MHz
bInCollection 1
baInterfaceNr( 0) 1
VideoControl Interface Descriptor:
bLength 18
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0201 Camera Sensor
bAssocTerminal 0
iTerminal 0
wObjectiveFocalLengthMin 0
wObjectiveFocalLengthMax 0
wOcularFocalLength 0
bControlSize 3
bmControls 0x00000000
VideoControl Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 5 (PROCESSING_UNIT)
Warning: Descriptor too short
bUnitID 2
bSourceID 1
wMaxMultiplier 0
bControlSize 2
bmControls 0x0000053f
Brightness
Contrast
Hue
Saturation
Sharpness
Gamma
Backlight Compensation
Power Line Frequency
iProcessing 0
bmVideoStandards 0x 9
None
SECAM - 625/50
VideoControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 3
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 2
iTerminal 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x000a 1x 10 bytes
bInterval 5
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
VideoStreaming Interface Descriptor:
bLength 14
bDescriptorType 36
bDescriptorSubtype 1 (INPUT_HEADER)
bNumFormats 1
wTotalLength 227
bEndPointAddress 130
bmInfo 0
bTerminalLink 3
bStillCaptureMethod 2
bTriggerSupport 1
bTriggerUsage 1
bControlSize 1
bmaControls( 0) 27
VideoStreaming Interface Descriptor:
bLength 27
bDescriptorType 36
bDescriptorSubtype 4 (FORMAT_UNCOMPRESSED)
bFormatIndex 1
bNumFrameDescriptors 5
guidFormat {59555932-0000-1000-8000-00aa00389b71}
bBitsPerPixel 16
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags 0x00
Interlaced stream or variable: No
Fields per frame: 2 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 0
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 1
bmCapabilities 0x00
Still image unsupported
wWidth 640
wHeight 480
dwMinBitRate 73728000
dwMaxBitRate 147456000
dwMaxVideoFrameBufferSize 614400
dwDefaultFrameInterval 333333
bFrameIntervalType 2
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 666667
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 2
bmCapabilities 0x00
Still image unsupported
wWidth 352
wHeight 288
dwMinBitRate 24330240
dwMaxBitRate 48660480
dwMaxVideoFrameBufferSize 202752
dwDefaultFrameInterval 333333
bFrameIntervalType 2
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 666667
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 3
bmCapabilities 0x00
Still image unsupported
wWidth 320
wHeight 240
dwMinBitRate 18432000
dwMaxBitRate 36864000
dwMaxVideoFrameBufferSize 153600
dwDefaultFrameInterval 333333
bFrameIntervalType 2
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 666667
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 4
bmCapabilities 0x00
Still image unsupported
wWidth 176
wHeight 144
dwMinBitRate 6082560
dwMaxBitRate 12165120
dwMaxVideoFrameBufferSize 50688
dwDefaultFrameInterval 333333
bFrameIntervalType 2
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 666667
VideoStreaming Interface Descriptor:
bLength 34
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 5
bmCapabilities 0x00
Still image unsupported
wWidth 160
wHeight 120
dwMinBitRate 4608000
dwMaxBitRate 9216000
dwMaxVideoFrameBufferSize 38400
dwDefaultFrameInterval 333333
bFrameIntervalType 2
dwFrameInterval( 0) 333333
dwFrameInterval( 1) 666667
VideoStreaming Interface Descriptor:
bLength 10
bDescriptorType 36
bDescriptorSubtype 3 (STILL_IMAGE_FRAME)
bEndpointAddress 0
bNumImageSizePatterns 1
wWidth( 0) 640
wHeight( 0) 480
bNumCompressionPatterns 1
VideoStreaming Interface Descriptor:
bLength 6
bDescriptorType 36
bDescriptorSubtype 13 (COLORFORMAT)
bColorPrimaries 0 (Unspecified)
bTransferCharacteristics 0 (Unspecified)
bMatrixCoefficients 0 (Unspecified)
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x1400 3x 1024 bytes
bInterval 1
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0000
(Bus Powered)
Listing available controls for device /dev/video0:
Brightness
ID : 0x00000001,
Type : Dword,
Flags : { CAN_READ, CAN_WRITE },
Values : [ 0 .. 255, step size: 1 ],
Default : 128
Contrast
ID : 0x00000002,
Type : Dword,
Flags : { CAN_READ, CAN_WRITE },
Values : [ 0 .. 255, step size: 1 ],
Default : 148
Saturation
ID : 0x00000004,
Type : Dword,
Flags : { CAN_READ, CAN_WRITE },
Values : [ 0 .. 255, step size: 1 ],
Default : 90
Hue
ID : 0x00000005,
Type : Dword,
Flags : { CAN_READ, CAN_WRITE },
Values : [ -127 .. 127, step size: 1 ],
Default : 0
Gamma
ID : 0x00000006,
Type : Dword,
Flags : { CAN_READ, CAN_WRITE },
Values : [ 1 .. 8, step size: 1 ],
Default : 4
Power Line Frequency
ID : 0x0000000d,
Type : Choice,
Flags : { CAN_READ, CAN_WRITE },
Values : { 'Disabled'[0], '50 Hz'[1], '60 Hz'[2] },
Default : 1
Sharpness
ID : 0x00000007,
Type : Dword,
Flags : { CAN_READ, CAN_WRITE },
Values : [ 0 .. 15, step size: 1 ],
Default : 3
Backlight Compensation
ID : 0x0000000c,
Type : Dword,
Flags : { CAN_READ, CAN_WRITE },
Values : [ 1 .. 5, step size: 1 ],
Default : 1
Listing available devices:
video0 USB2.0 PC CAMERA: USB2.0 PC CAM [uvcvideo, usb-3f980000.usb-1.4]
Media controller device: /dev/media0
Entity 1: USB2.0 PC CAMERA: USB2.0 PC CAM. Type: 65537, Revision: 0, Flags: 1, Group-id: 0, Pads: 1, Links: 0
Device node
Entity: 1, Pad 0, Flags: 1
video11 bcm2835-codec-encode [bcm2835-codec, platform:bcm2835-codec]
Media controller device /dev/media11 doesn't exist
ERROR: Unable to list device entities: Invalid device or device cannot be opened. (Code: 5)
video2 USB2.0 PC CAMERA: USB2.0 PC CAM [uvcvideo, usb-3f980000.usb-1.5]
Media controller device: /dev/media2
Entity 1: bcm2835-codec-decode-source. Type: 65537, Revision: 0, Flags: 0, Group-id: 0, Pads: 1, Links: 1
Device node
Entity: 1, Pad 0, Flags: 2
Out link: Source pad { Entity: 1, Index: 0, Flags: 2 } => Sink pad { Entity: 3, Index: 1, Flags: 2 }
video4 mmal service 16.1 [bm2835 mmal, platform:bcm2835-v4l2]
Media controller device /dev/media4 doesn't exist
ERROR: Unable to list device entities: Invalid device or device cannot be opened. (Code: 5)
video6 Digital Microscope [uvcvideo, usb-3f980000.usb-1.3]
Media controller device /dev/media6 doesn't exist
ERROR: Unable to list device entities: Invalid device or device cannot be opened. (Code: 5)
video10 bcm2835-codec-decode [bcm2835-codec, platform:bcm2835-codec]
Media controller device /dev/media10 doesn't exist
ERROR: Unable to list device entities: Invalid device or device cannot be opened. (Code: 5)
video1 USB2.0 PC CAMERA: USB2.0 PC CAM [uvcvideo, usb-3f980000.usb-1.4]
Media controller device: /dev/media1
Entity 1: USB2.0 PC CAMERA: USB2.0 PC CAM. Type: 65537, Revision: 0, Flags: 1, Group-id: 0, Pads: 1, Links: 0
Device node
Entity: 1, Pad 0, Flags: 1
video12 bcm2835-codec-isp [bcm2835-codec, platform:bcm2835-codec]
Media controller device /dev/media12 doesn't exist
ERROR: Unable to list device entities: Invalid device or device cannot be opened. (Code: 5)
video3 USB2.0 PC CAMERA: USB2.0 PC CAM [uvcvideo, usb-3f980000.usb-1.5]
Media controller device: /dev/media3
Entity 1: Digital Microscope. Type: 65537, Revision: 0, Flags: 1, Group-id: 0, Pads: 1, Links: 0
Device node
Entity: 1, Pad 0, Flags: 1
video5 Digital Microscope [uvcvideo, usb-3f980000.usb-1.3]
Media controller device /dev/media5 doesn't exist
ERROR: Unable to list device entities: Invalid device or device cannot be opened. (Code: 5)
todo