From: Guillaume Pellerin Date: Fri, 14 Mar 2025 08:28:26 +0000 (+0100) Subject: add audio_source, video_source and options to yml config X-Git-Tag: 4.1.0~45 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=4a442148078277223532f65d70f323d2e4c7b527;p=telecaster-server.git add audio_source, video_source and options to yml config --- diff --git a/bin/streaming/telecaster.py b/bin/streaming/telecaster.py index bad71bd..0c2d5c3 100755 --- a/bin/streaming/telecaster.py +++ b/bin/streaming/telecaster.py @@ -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"]) diff --git a/etc/telecaster/telecaster.yml b/etc/telecaster/telecaster.yml index eab259e..2f7f2cf 100644 --- a/etc/telecaster/telecaster.yml +++ b/etc/telecaster/telecaster.yml @@ -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