VIDEO_PIPELINE_BASE="""{video_source} {video_options} \
! {format}, width={width}, height={height}, framerate={framerate}/1 \
! {decoder} \
- ! videoflip method={flip} \
- ! videoconvert \
- ! vp8enc threads=4 deadline=2 target-bitrate={vp8_bitrate} \
+ ! queue ! videoflip method={flip} \
+ ! queue ! videoconvert \
+ ! queue ! vp8enc threads=4 deadline=2 target-bitrate={vp8_bitrate} \
! muxout. \
{audio_source} {audio_options} client-name="webm_streaming_{id}_audio" ! audio/x-raw, format=F32LE, channels={channels} \
- ! audiocheblimit mode=high-pass cutoff=120 poles=4 \
- ! volume volume={gain_pre} \
- ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.125 ratio=0.125 \
- ! volume volume={gain_post} \
- ! audiodynamic characteristics=hard-knee mode=compressor threshold=0.95 ratio=0.001 \
- ! audioconvert \
- ! opusenc bitrate={opus_bitrate} \
+ ! 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 \
+ ! queue ! volume volume={gain_post} \
+ ! queue ! audiodynamic characteristics=hard-knee mode=compressor threshold=0.95 ratio=0.001 \
+ ! queue ! audioconvert \
+ ! queue ! opusenc bitrate={opus_bitrate} \
! muxout. \
webmmux streamable=true name=muxout \
! queue ! shout2send ip={ip} port={port} password={password} mount=telecaster_live_{id}.webm > /dev/null
! queue ! shout2send ip={ip} port={port} password={password} mount=telecaster_live.mp3 > /dev/null
"""
-BOOT_TIME_DELAY = 0
+BOOT_TIME_DELAY = 1
DEFAULT_CONFIG_FILE = "/etc/telecaster/telecaster.yml"
+JACK_CONFIG = {"engine": "jackd",
+ "options": "-R -P50 -dalsa -r48000 -p1024 -n3 -Chw:3 -Phw:3",
+ "tools": ["catia", "konsole"]}
+
+PIPEWIRE_CONFIG = {"engine": "pipewire",
+ "options": "",
+ "tools": ["qpwgraph", "konsole"]}
+
+
class TeleCasterGStream(Thread):
def __init__(self, pipeline):
Thread.__init__(self)
self.pipeline = pipeline
- print(self.pipeline)
+ # print(self.pipeline)
def run(self):
os.system('gst-launch-1.0 ' + self.pipeline + ' & ')
os.system('deefuzzer ' + self.conf_file + ' & ')
+class TeleCasterThreadedCommand(Thread):
+
+ def __init__(self, command):
+ Thread.__init__(self)
+ self.command = command
+
+ def run(self):
+ os.system(self.command + ' & ')
+
+
+class TeleCasterCommand:
+
+ def __init__(self, command):
+ self.command = command
+
+ def start(self):
+ os.system(self.command + ' & ')
+
+
class TeleCaster(Thread):
def __init__(self, conf_file_path):
self.deefuzzer_video_conf_file = "/tmp/telecaster_deefuzzer_webm_monitor.yml"
self.deefuzzer_audio_conf_file = "/tmp/telecaster_deefuzzer_mp3_monitor.yml"
# print(self.conf)
+ audio_source = self.conf["audio"]["gstreamer"]["audio_source"]
+ if "pipewire" in audio_source:
+ audio_config = PIPEWIRE_CONFIG
+ elif "jack" in audio_source:
+ audio_config = JACK_CONFIG
def write_conf(self, conf_dict, path):
filename, ext = os.path.splitext(path)
# print(args)
subprocess.call(command, shell=True)
+ def audio_engine_start(self):
+ command = self.audio_config["engine"] + " " + self.audio_config["options"]
+ thread = TeleCasterCommand(command)
+ Thread.start()
+
+ def audio_engine_start(self):
+ command = self.audio_config["engine"] + " " + self.audio_config["options"]
+ thread = TeleCasterCommand(command)
+ Thread.start()
+
+ def audio_tools_start(self):
+ for tool in self.audio_config["tools"]:
+ command = TeleCasterCommand(tool)
+ command.start()
+
def deefuzzer_start(self, conf, conf_file):
# print(self.conf)
self.write_conf(conf, conf_file)
self.deefuzzer_start(deefuzzer_global_conf, self.deefuzzer_audio_conf_file)
def run(self):
+ self.audio_engine_start()
+ self.audio_tools_start()
self.video_start()
self.audio_start()