]> git.parisson.com Git - telecaster-server.git/commitdiff
add audio_source, video_source and options to yml config
authorGuillaume Pellerin <guillaume.pellerin@parisson.com>
Fri, 14 Mar 2025 08:28:26 +0000 (09:28 +0100)
committerGuillaume Pellerin <guillaume.pellerin@parisson.com>
Fri, 14 Mar 2025 08:28:26 +0000 (09:28 +0100)
bin/streaming/telecaster.py
etc/telecaster/telecaster.yml

index bad71bd2ec8b5e678e57fbc3f66b8fcec7e4427b..0c2d5c35913f92eb89c75f91648d24a6f626549b 100755 (executable)
@@ -9,14 +9,14 @@ from threading import Thread
 from copy import deepcopy
 
 
-VIDEO_PIPELINE_BASE="""pipewiresrc client-name="video_streaming" \
+VIDEO_PIPELINE_BASE="""{video_source} {video_options}\
     ! {format}, width={width}, height={height}, framerate={framerate}/1 \
     ! queue ! {decoder} \
     ! queue ! videoflip method={flip} \
     ! queue ! videoconvert \
     ! queue ! vp8enc threads=4 deadline=2 target-bitrate={vp8_bitrate} \
     ! queue ! muxout. \
-    pipewiresrc client-name="video_streaming" target-object="telecaster_source" ! audio/x-raw, format=F32LE, channels={channels} \
+    {audio_source} {audio_options} ! audio/x-raw, format=F32LE, channels={channels} \
     ! queue ! audiocheblimit mode=high-pass cutoff=120 poles=4 \
     ! queue ! volume volume={gain_pre} \
     ! queue ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.125 ratio=0.125 \
@@ -29,7 +29,7 @@ VIDEO_PIPELINE_BASE="""pipewiresrc client-name="video_streaming" \
     ! queue ! shout2send ip={ip} port={port} password={password} mount=telecaster_live_{id}.webm
 """
 
-AUDIO_PIPELINE_BASE="""pipewiresrc client-name="audio_streaming" target-object="telecaster_source" ! audio/x-raw, format=F32LE, channels={channels} \
+AUDIO_PIPELINE_BASE="""{audio_source} ! audio/x-raw, format=F32LE, channels={channels} \
     ! queue ! audiocheblimit mode=high-pass cutoff=120 poles=4 \
     ! queue ! volume volume={gain_pre} \
     ! queue ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.125 ratio=0.125 \
@@ -81,9 +81,8 @@ class TeleCaster(Thread):
 
     def v4l2_ctl(self, video):
         params = video["v4l2-ctl"]
-        print(params)
+        print(params)
         for param in params:
-            print(param)
             command = "v4l2-ctl -d %s -c %s=%s" % (video["id"], param, params[param])
             args = shlex.split(command)
             # print(args)
@@ -117,7 +116,7 @@ class TeleCaster(Thread):
             deefuzzer_local_conf["relay"]["url"] = relay_url
             deefuzzer_local_conf["record"]["dir"] = self.conf["record_dir"] + os.sep + "webm"
             deefuzzer_local_conf["server"]["mountpoint"] = "monitor_" + str(video["id"]) + ".webm"
-            print(deefuzzer_local_conf)
+            print(deefuzzer_local_conf)
             deefuzzer_global_conf["deefuzzer"]["station"].append(deefuzzer_local_conf)
 
         # relay 0 to legacy monitor.webm
@@ -126,12 +125,11 @@ class TeleCaster(Thread):
         deefuzzer_local_conf["relay"]["url"] = relay_url
         deefuzzer_local_conf["record"]["mode"] = 0
         deefuzzer_local_conf["server"]["mountpoint"] = "monitor.webm"
-        print(deefuzzer_local_conf)
+        print(deefuzzer_local_conf)
         deefuzzer_global_conf["deefuzzer"]["station"].append(deefuzzer_local_conf)
 
         self.deefuzzer_start(deefuzzer_global_conf, self.deefuzzer_video_conf_file)
 
-
     def audio_start(self):
         deefuzzer_default_conf = deepcopy(self.conf["audio"]["deefuzzer"])
         deefuzzer_station_conf = deepcopy(deefuzzer_default_conf["station"])
@@ -139,14 +137,12 @@ class TeleCaster(Thread):
         deefuzzer_global_conf = {"deefuzzer": deepcopy(deefuzzer_default_conf)}
         deefuzzer_global_conf["deefuzzer"]["station"] = []
 
-
         pipeline = AUDIO_PIPELINE_BASE.format(
                 **self.conf["audio"]["gstreamer"],
                 **self.conf["server"])
         stream = TeleCasterGStream(pipeline)
         stream.start()
 
-
         deefuzzer_local_conf = deepcopy(deefuzzer_station_conf)
         # print(deefuzzer_local_conf)
         relay_url = "http://{ip}:{port}/telecaster_live.mp3".format(**self.conf["server"])
index eab259ece41b6b5a4b0bee3c73e62fc6819a780f..2f7f2cf3b2382d145ae017c79b0e8a99576742ef 100644 (file)
@@ -7,8 +7,9 @@ telecaster:
   record_dir: /home/telecaster/monitor/
   video:
     gstreamer:
-      video_source: v4l2src # or pipewiresrc
       - id: 0
+        video_source: pipewiresrc # or v4l2src
+        video_options: target-object="telecaster_source" # 'device=/dev/video{id}',
         name: JVC
         width: 1280
         height: 720
@@ -27,6 +28,8 @@ telecaster:
           sharpness: 6
           saturation: 100
       - id: 2
+        video_source: pipewiresrc # or v4l2src
+        video_options: target-object="telecaster_source" # 'device=/dev/video{id}',
         name: USB-HDMI
         width: 1280
         height: 720
@@ -85,10 +88,10 @@ telecaster:
             mode: '0'
             secret: 4egZs1dSM37XVY8zXa016Yueku2fleXF2bx8k25V4
             tags: bla bla
-
   audio:
     gstreamer:
-      audio_source: jackaudiosrc # or pipewiresrc
+      audio_source: pipewiresrc # or jackaudiosrc
+      audio_options: target-object="telecaster_source" # 'connect=2',
       channels: 2
       opus_bitrate: 96000
       mp3_quality: 4.0