From: Guillaume Pellerin Date: Mon, 11 Aug 2025 14:19:56 +0000 (+0200) Subject: use video device key when exists (useful to use /dev/v4l/by-id/.. X-Git-Tag: 4.2.2~1 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=8e8dbb37c16a17bb1ade531d981cfc86a5caa1a5;p=telecaster-server.git use video device key when exists (useful to use /dev/v4l/by-id/.. instead of /dev/video.. when multiple devices) --- diff --git a/bin/streaming/telecaster.py b/bin/streaming/telecaster.py index 5de966e..999bb19 100755 --- a/bin/streaming/telecaster.py +++ b/bin/streaming/telecaster.py @@ -11,7 +11,7 @@ from threading import Thread from copy import deepcopy -VIDEO_PIPELINE_BASE="""{gst_video_source} {gst_video_options} \ +VIDEO_PIPELINE_BASE="""{gst_video_source} {gst_video_device} {gst_video_options} \ ! {format}, width={width}, height={height}, framerate={framerate}/1 \ ! {decoder} \ ! queue ! videoflip method={flip} \ @@ -51,7 +51,8 @@ PARAMS = { "options": "-R -P{priority} -dalsa -r{samplerate} -p{buffer} -n3 -Chw:{card} -Phw:{card}", "tools": ["qjackctl", "catia", "konsole"], "gst_video_source": "v4l2src", - "gst_video_options": "device=/dev/video{id}", + "gst_video_options": "", + "gst_video_device": "device={device}", "gst_audio_source": "jackaudiosrc", "gst_audio_options": "connect=2 low-latency=true", "connect": @@ -65,7 +66,8 @@ PARAMS = { "engine": "pipewire", "options": "", "gst_video_source": "pipewiresrc", - "gst_video_options": "target-object=v4l2:/dev/video{id}", + "gst_video_options": "", + "gst_video_device": "target-object=v4l2:{device}", "gst_audio_source": "pipewiresrc", "gst_audio_options": "target-object={target_object}", "tools": ["qpwgraph", "konsole"], @@ -192,7 +194,11 @@ class TeleCaster(Thread): if "v4l2-ctl" in video: self.v4l2_ctl(video) - local_params["gst_video_options"] = local_params["gst_video_options"].format(**video) + if "device" in video: + local_params["gst_video_device"] = local_params["gst_video_device"].format(**video) + else: + device = "/dev/video{id}".format(**video) + local_params["gst_video_device"] = local_params["gst_video_device"].format(device=device) pipeline = VIDEO_PIPELINE_BASE.format(**video, **self.conf["audio"]["gstreamer"], diff --git a/etc/telecaster/telecaster.yml b/etc/telecaster/telecaster.yml index 5ea521e..05e3cad 100644 --- a/etc/telecaster/telecaster.yml +++ b/etc/telecaster/telecaster.yml @@ -10,6 +10,7 @@ telecaster: gstreamer: - id: 0 name: logitech + device: /dev/v4l/by-id/usb-046d_C922_Pro_Stream_Webcam_50E5937F-video-index0 width: 1280 height: 720 framerate: 30