Dual Lens Webcam - how do I show only one image?

Camera model

TESLONG Dual Lens USB - TESLONG 8.0mm Dual Lens USB Endoscope 5M Tube Inspection Camera for Android PC | eBay

I bought this as a relatively cost-effective auto-focus endoscope to use as a nozzle camera.

What is the problem?

It works well, but the camera has a slightly strange design whereby there are two lenses - a normal one and a side one. The side one doesn't show anything useful as a result of where it's mounted, so I'd like to only show the main view:

I have it set up in /boot/octopi.txt for a 640x480 resolution, but mjpg_streamer overrides that and uses 1280x480 instead. I'd like to automatically crop the image so only the left-hand half is visible.

What did you already try to solve it?

I read all the options in v4l2-ctl --help, v4l2-ctl -d /dev/video3 -l, /opt/mjpg_streamer --help and /opt/mjpg_streamer -i "input_uvc.so --help", but couldn't see anything that sounded promising.

Logs (/var/log/webcamd.log, syslog, dmesg, ... no logs, no support)

config file='/boot/octopi.txt':USB device was set in options and found in devices, starting MJPG-streamer with the configured USB video device: /dev/video3
<13>Feb 18 10:48:29 root: Starting USB webcam
Checking for VL805 (Raspberry Pi 4)...
  - It seems that you don't have VL805 (Raspberry Pi 4).
    There should be no problems with USB (a.k.a. select() timeout)
Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n --listen 127.0.0.1 -i input_uvc.so -r 640x480 -f 24 -d /dev/video3
MJPG Streamer Version.: 2.0
 i: Using V4L2 device.: /dev/video3
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 24
 i: Format............: JPEG
 i: TV-Norm...........: DEFAULT
 i: The specified resolution is unavailable, using: width 1280 height 480 instead
 i: FPS coerced ......: from 24 to 15
UVCIOC_CTRL_ADD - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Mode: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Frequency: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Disable video processing: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Raw bits per pixel: Inappropriate ioctl for device (25)
 o: www-folder-path......: ./www-octopi/
 o: HTTP TCP port........: 8080
 o: HTTP Listen Address..: 127.0.0.1
 o: username:password....: disabled
 o: commands.............: disabled

Additional information about your setup (OctoPrint version, OctoPi version, ...)

Running on Raspberry Pi 4, OS version info:

/etc/os-release:

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

SystemInfo bundle:

octoprint-systeminfo-20220218120924.zip (33.0 KB)

Actually, scratch that, I think I've fixed it.

I tried this:

pi@octopi:/opt/mjpg-streamer $ v4l2-ctl -d /dev/video3 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'MJPG' (Motion-JPEG, compressed)
                Size: Discrete 1280x720
                        Interval: Discrete 0.040s (25.000 fps)
                Size: Discrete 960x720
                        Interval: Discrete 0.040s (25.000 fps)
                Size: Discrete 1280x480
                        Interval: Discrete 0.067s (15.000 fps)

and saw that the ratio with 1280x720 was very different, so I changed /boot/octopi.txt to match:

camera_usb_options="-r 1280x720 -f 25 -d /dev/v4l/by-id/usb-SunplusIT_Inc_Teslong_Camera_01.00.00-video-index0"

After a reboot, the result was this:

Much better.

Sorry for the noise; hope this is helpful to anyone else with one of these cameras!

1 Like