Filter out IR cameras
IR cameras should hopefully be filtered out of the list of available devices.
When switching to the IR camera feed, what I get is a flashing greyscale video, as seen below:
Screencast_from_2023-08-09_14-29-47
Unfortunately, in the command outputs below, the only way of detecting the IR camera would be via the string in api.v4l2.cap.card
, which ends in "IR Camera". As mentioned by @msandova, "parsing that could be prone to other issues and some other IR cameras might say something else".
Hopefully, it would be possible for the library that Snapshot depends on (would that be gst-device-monitor
?) to include information on whether a device is an IR camera.
Command outputs
Output of flatpak run --env=RUST_LOG=snapshot=debug,aperture=debug org.gnome.Snapshot
:
2023-08-09T11:18:09.901749Z INFO snapshot::application::imp: Snapshot (org.gnome.Snapshot)
2023-08-09T11:18:09.901769Z INFO snapshot::application::imp: Version: 45.beta
2023-08-09T11:18:09.901771Z INFO snapshot::application::imp: Datadir: /app/share/snapshot
2023-08-09T11:18:09.901775Z DEBUG snapshot::application::imp: Application::startup
2023-08-09T11:18:10.007260Z DEBUG snapshot::application::imp: Application::activate
2023-08-09T11:18:10.053646Z DEBUG aperture::viewfinder::imp: Setup recording
2023-08-09T11:18:10.116446Z DEBUG snapshot::widgets::gallery: Done loading 0 pictures
2023-08-09T11:18:10.161681Z DEBUG snapshot::widgets::gallery: Done loading 0 videos
2023-08-09T11:18:10.169503Z DEBUG aperture::device_provider: Starting device provider with file descriptor: 26
2023-08-09T11:18:10.171956Z DEBUG snapshot::widgets::camera: Device provider started
2023-08-09T11:18:10.172900Z DEBUG aperture::device_provider: Camera added: HD Webcam (V4L2), target-object: Some(45)
Properties {
"clock.quantum-limit": (gchararray) "8192",
"node.driver": (gchararray) "true",
"api.v4l2.cap.bus_info": (gchararray) "usb-0000:04:00.3-3",
"api.v4l2.cap.card": (gchararray) "HD Webcam: HD Webcam",
"api.v4l2.cap.driver": (gchararray) "uvcvideo",
"api.v4l2.cap.version": (gchararray) "6.4.7",
"device.api": (gchararray) "v4l2",
"device.devids": (gchararray) "20736",
"media.class": (gchararray) "Video/Source",
"client.id": (gchararray) "33",
"api.v4l2.cap.device-caps": (gchararray) "04200001",
"node.pause-on-idle": (gchararray) "false",
"device.vendor.id": (gchararray) "0x04f",
"factory.name": (gchararray) "api.v4l2.source",
"object.id": (gchararray) "45",
"api.v4l2.path": (gchararray) "/dev/video0",
"node.description": (gchararray) "HD Webcam (V4L2)",
"priority.session": (gchararray) "1000",
"api.v4l2.cap.capabilities": (gchararray) "84a00001",
"device.id": (gchararray) "39",
"device.product.id": (gchararray) "0xb68",
"media.role": (gchararray) "Camera",
"object.path": (gchararray) "v4l2:/dev/video0",
"object.serial": (gchararray) "45",
"node.name": (gchararray) "v4l2_input.pci-0000_04_00.3-usb-0_3_1.0",
"node.nick": (gchararray) "HD Webcam",
"factory.id": (gchararray) "10",
}
2023-08-09T11:18:10.548480Z DEBUG aperture::viewfinder: Camerabin state succesfully set to PLAYING
2023-08-09T11:18:10.597623Z DEBUG aperture::viewfinder: Camerabin state succesfully set to NULL
2023-08-09T11:18:11.993353Z DEBUG aperture::viewfinder: Camerabin state succesfully set to PLAYING
2023-08-09T11:18:11.996230Z DEBUG aperture::device_provider: Camera added: HD Webcam (V4L2), target-object: Some(47)
Properties {
"object.path": (gchararray) "v4l2:/dev/video2",
"api.v4l2.cap.bus_info": (gchararray) "usb-0000:04:00.3-3",
"api.v4l2.cap.version": (gchararray) "6.4.7",
"client.id": (gchararray) "33",
"clock.quantum-limit": (gchararray) "8192",
"media.role": (gchararray) "Camera",
"api.v4l2.cap.capabilities": (gchararray) "84a00001",
"device.vendor.id": (gchararray) "0x04f",
"media.class": (gchararray) "Video/Source",
"node.name": (gchararray) "v4l2_input.pci-0000_04_00.3-usb-0_3_1.2",
"priority.session": (gchararray) "980",
"device.id": (gchararray) "41",
"device.api": (gchararray) "v4l2",
"api.v4l2.path": (gchararray) "/dev/video2",
"object.id": (gchararray) "47",
"factory.id": (gchararray) "10",
"object.serial": (gchararray) "47",
"device.product.id": (gchararray) "0xb68",
"node.driver": (gchararray) "true",
"api.v4l2.cap.card": (gchararray) "HD Webcam: IR Camera",
"api.v4l2.cap.driver": (gchararray) "uvcvideo",
"factory.name": (gchararray) "api.v4l2.source",
"device.devids": (gchararray) "20738",
"api.v4l2.cap.device-caps": (gchararray) "04200001",
"node.description": (gchararray) "HD Webcam (V4L2)",
"node.nick": (gchararray) "HD Webcam",
"node.pause-on-idle": (gchararray) "false",
}
Output of gst-device-monitor-1.0 Video/Source
:
Probing devices...
Device found:
name : HD Webcam (V4L2)
class : Video/Source
caps : image/jpeg, width=1280, height=720, framerate=30/1
image/jpeg, width=640, height=480, framerate=30/1
image/jpeg, width=640, height=360, framerate=30/1
image/jpeg, width=352, height=288, framerate=30/1
image/jpeg, width=320, height=240, framerate=30/1
image/jpeg, width=176, height=144, framerate=30/1
video/x-raw, format=YUY2, width=640, height=480, framerate=30/1
video/x-raw, format=YUY2, width=640, height=360, framerate=30/1
video/x-raw, format=YUY2, width=352, height=288, framerate=30/1
video/x-raw, format=YUY2, width=320, height=240, framerate=30/1
video/x-raw, format=YUY2, width=176, height=144, framerate=30/1
properties:
api.v4l2.cap.bus_info = usb-0000:04:00.3-3
api.v4l2.cap.capabilities = 84a00001
api.v4l2.cap.card = HD Webcam: HD Webcam
api.v4l2.cap.device-caps = 04200001
api.v4l2.cap.driver = uvcvideo
api.v4l2.cap.version = 6.4.7
api.v4l2.path = /dev/video0
device.api = v4l2
device.devids = 20736
device.id = 39
device.product.id = 0xb68
device.vendor.id = 0x04f
factory.name = api.v4l2.source
media.class = Video/Source
node.description = HD Webcam (V4L2)
node.name = v4l2_input.pci-0000_04_00.3-usb-0_3_1.0
node.nick = HD Webcam
node.pause-on-idle = false
object.path = v4l2:/dev/video0
priority.session = 1000
factory.id = 10
client.id = 33
clock.quantum-limit = 8192
media.role = Camera
node.driver = true
object.id = 45
object.serial = 45
gst-launch-1.0 pipewiresrc target-object=45 ! ...
Device found:
name : HD Webcam (V4L2)
class : Video/Source
caps : video/x-raw, format=GRAY8, width=640, height=360, framerate=30/1
properties:
api.v4l2.cap.bus_info = usb-0000:04:00.3-3
api.v4l2.cap.capabilities = 84a00001
api.v4l2.cap.card = HD Webcam: IR Camera
api.v4l2.cap.device-caps = 04200001
api.v4l2.cap.driver = uvcvideo
api.v4l2.cap.version = 6.4.7
api.v4l2.path = /dev/video2
device.api = v4l2
device.devids = 20738
device.id = 41
device.product.id = 0xb68
device.vendor.id = 0x04f
factory.name = api.v4l2.source
media.class = Video/Source
node.description = HD Webcam (V4L2)
node.name = v4l2_input.pci-0000_04_00.3-usb-0_3_1.2
node.nick = HD Webcam
node.pause-on-idle = false
object.path = v4l2:/dev/video2
priority.session = 980
factory.id = 10
client.id = 33
clock.quantum-limit = 8192
media.role = Camera
node.driver = true
object.id = 47
object.serial = 47
gst-launch-1.0 pipewiresrc target-object=47 ! ...
Edited by Yarn