P2Pro-Viewer icon indicating copy to clipboard operation
P2Pro-Viewer copied to clipboard

Could not open video capture device with index 1

Open JimKnopfIoT opened this issue 10 months ago • 1 comments

Running python main.py failed:

[ WARN:[email protected]] global cap_v4l.cpp:997 open VIDEOIO(V4L2:/dev/video1): can't open camera by index
[ERROR:[email protected]] global obsensor_uvc_stream_channel.cpp:159 getStreamChannelGroup Camera index out of range
Exception in thread Thread-1 (open):
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/P2Pro-Viewer/P2Pro/video.py", line 84, in open
    raise ConnectionError(f"Could not open video capture device with index {camera_id}, is the module connected?")
ConnectionError: Could not open video capture device with index 1, is the module connected?

IR Camera Infiray P2Pro, recognized as /dev/video2 /dev/video3 System: Arch Linux

# uname -a
Linux ROG 6.8.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 17 Apr 2024 15:20:28 +0000 x86_64 GNU/Linux
# lsusb
Bus 003 Device 002: ID 0bda:5830 Realtek Semiconductor Corp. USB Camera
v4l2-ctl -d /dev/video2 --all
Driver Info:
	Driver name      : uvcvideo
	Card type        : USB Camera: USB Camera
	Bus info         : usb-0000:3d:00.0-1
	Driver version   : 6.8.7
	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            : USB Camera: USB Camera
	Serial           : 200901010001
	Bus info         : usb-0000:3d:00.0-1
	Media version    : 6.8.7
	Hardware revision: 0x00001101 (4353)
	Driver version   : 6.8.7
Interface Info:
	ID               : 0x03000002
	Type             : V4L Video
Entity Info:
	ID               : 0x00000001 (1)
	Name             : USB Camera: USB Camera
	Function         : V4L2 I/O
	Flags            : default
	Pad 0x01000007   : 0: Sink
	  Link 0x02000010: from remote pad 0x100000a of entity 'Extension 4' (Video Pixel Formatter): Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
	Width/Height      : 256/384
	Pixel Format      : 'YUYV' (YUYV 4:2:2)
	Field             : None
	Bytes per Line    : 512
	Size Image        : 196608
	Colorspace        : sRGB
	Transfer Function : Rec. 709
	YCbCr/HSV Encoding: ITU-R 601
	Quantization      : Default (maps to Limited Range)
	Flags             : 
Crop Capability Video Capture:
	Bounds      : Left 0, Top 0, Width 256, Height 384
	Default     : Left 0, Top 0, Width 256, Height 384
	Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 256, Height 384, Flags: 
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 256, Height 384, Flags: 
Streaming Parameters Video Capture:
	Capabilities     : timeperframe
	Frames per second: 25.000 (25/1)
	Read buffers     : 0

User Controls

                     brightness 0x00980900 (int)    : min=-64 max=64 step=1 default=0 value=0
                       contrast 0x00980901 (int)    : min=0 max=100 step=1 default=50 value=50
                     saturation 0x00980902 (int)    : min=0 max=100 step=1 default=64 value=64
                            hue 0x00980903 (int)    : min=-180 max=180 step=1 default=0 value=0
        white_balance_automatic 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=100 max=500 step=1 default=300 value=300
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=1 (50 Hz)
				0: Disabled
				1: 50 Hz
				2: 60 Hz
      white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=10 default=4600 value=4600 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=100 step=1 default=50 value=50
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=0

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=3 value=3 (Aperture Priority Mode)
				1: Manual Mode
				3: Aperture Priority Mode
         exposure_time_absolute 0x009a0902 (int)    : min=50 max=10000 step=1 default=166 value=166 flags=inactive
     exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=1

The camera works when using the command:

ffmpeg -input_format yuyv422 -video_size 256x384 -i /dev/video2 -vf 'crop=h=(ih/2):y=(ih/2)' -pix_fmt yuyv422 -f rawvideo - | ffplay -pixel_format gray16le -video_size 256x192 -f rawvideo -i - -vf 'normalize=smoothing=10, format=pix_fmts=rgb48, pseudocolor=p=inferno'

Bildschirmfoto vom 2024-04-20 18-21-27

JimKnopfIoT avatar Apr 20 '24 17:04 JimKnopfIoT