]> git.parisson.com Git - telecaster-server.git/commitdiff
use video device key when exists (useful to use /dev/v4l/by-id/..
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Mon, 11 Aug 2025 14:19:56 +0000 (16:19 +0200)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Mon, 11 Aug 2025 14:21:11 +0000 (16:21 +0200)
                                  instead of /dev/video.. when multiple
                                  devices)

bin/streaming/telecaster.py
etc/telecaster/telecaster.yml

index 5de966e14ad3ee351261169669448d49de8388bd..999bb19199f2218df428a53a72e6837901272ce6 100755 (executable)
@@ -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"],
index 5ea521e3c4d1b86780bf9cc1563b4a36b7dcddc3..05e3cada80f91137ae413689eff9820830531582 100644 (file)
@@ -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