From: Guillaume Pellerin Date: Mon, 29 Jan 2024 12:17:15 +0000 (+0100) Subject: reorder, cleanup everything.. X-Git-Tag: 2.2~6 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=37c4108d146fd4649510fd3e3fcc3760caa8d4f7;p=telecaster-server.git reorder, cleanup everything.. --- diff --git a/bin/app.sh b/bin/app.sh deleted file mode 100755 index 79c2fde..0000000 --- a/bin/app.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -mount -o remount,size=128M /dev/shm -export `dbus-launch | grep ADDRESS` -export `dbus-launch | grep PID` -jackd -R -P70 -dalsa -dhw:0 -r44100 -p1024 -n2 & - -sleep 5 - diff --git a/bin/mastering/create_thumbs.py b/bin/mastering/create_thumbs.py new file mode 100755 index 0000000..dc3fd20 --- /dev/null +++ b/bin/mastering/create_thumbs.py @@ -0,0 +1,42 @@ +#!/usr/bin/python + +import os, sys, string +import logging + +class Logger: + """A logging object""" + + def __init__(self, file): + self.logger = logging.getLogger('myapp') + self.hdlr = logging.FileHandler(file) + self.formatter = logging.Formatter('%(message)s') + self.hdlr.setFormatter(self.formatter) + self.logger.addHandler(self.hdlr) + self.logger.setLevel(logging.INFO) + +log_file = 'thumbs.log' +logger = Logger(log_file) +root_dir = sys.argv[-1] +args = sys.argv[1:-1] +source_format = 'webm' +done = [] +preview_tc = '00:00:05' + +if os.path.exists(log_file): + f = open(log_file, 'r') + for line in f.readlines(): + done.append(line[:-1]) + f.close() + +for root, dirs, files in os.walk(root_dir): + for file in files: + path = os.path.abspath(root + os.sep + file) + name, ext = os.path.splitext(file) + if ext[1:] == source_format: + dest = os.path.abspath(root + os.sep + name + '.png') + if not dest in done or '--force' in args: + command = 'ffmpeg -ss '+ preview_tc + ' -i ' + path + ' -y ' + dest + os.system(command) + logger.logger.info(dest) + +print "DONE!" diff --git a/bin/mastering/remux.sh b/bin/mastering/remux.sh new file mode 100755 index 0000000..e4e88a8 --- /dev/null +++ b/bin/mastering/remux.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +ffmpeg -i $1 -c copy out.webm diff --git a/bin/mastering/remux_fix_media.py b/bin/mastering/remux_fix_media.py new file mode 100755 index 0000000..895fc93 --- /dev/null +++ b/bin/mastering/remux_fix_media.py @@ -0,0 +1,113 @@ +#!/usr/bin/python + +import os, sys, psutil +import datetime +from ebml.utils.ebml_data import * + +class FixCheckMedia(object): + + def __init__(self, dir, tmp_dir): + self.dir = dir + self.tmp_dir = tmp_dir + if not os.path.exists(self.tmp_dir): + os.makedirs(self.tmp_dir) + + def process(self): + webm_fixed_log = 'webm.fixed' + webm_tofix_log = 'webm.tofix' + mp3_fixed_log = 'mp3.fixed' + mp3_tofix_log = 'mp3.tofix' + + for root, dirs, files in os.walk(self.dir): + for filename in files: + source = root + os.sep + filename + name = os.path.splitext(filename)[0] + ext = os.path.splitext(filename)[1][1:] + + if (ext == 'webm' or ext == 'mp4') and os.path.getsize(source): + dir_files = os.listdir(root) + + if not webm_fixed_log in dir_files: + print(source) + self.fix_webm(source) + f = open(root + os.sep + webm_fixed_log, 'w') + f.close() + if os.path.exists(root + os.sep + webm_tofix_log): + os.remove(root + os.sep + webm_tofix_log) + + if mp3_tofix_log in dir_files or not mp3_fixed_log in dir_files: + for file in dir_files: + dest_ext = os.path.splitext(file)[1][1:] + if dest_ext == 'mp3': + dest = root + os.sep + file + print(dest) + self.fix_mp3(source, dest) + f = open(root + os.sep + mp3_fixed_log, 'w') + f.close() + if os.path.exists(root + os.sep + mp3_tofix_log): + os.remove(root + os.sep + mp3_tofix_log) + #break + + + def hard_fix_webm(self, path): + try: + tmp_file = self.tmp_dir + 'out.webm ' + command = 'ffmpeg -loglevel 0 -i "'+ path + '" -vcodec libvpx -vb 1500k -acodec libvorbis -aq 7 -f webm -y "' + tmp_file + '" > /dev/null' + print(command) + os.system(command) + command = 'mv ' + tmp_file + path + os.system(command) + except: + pass + + + def fix_webm(self, path): + try: + tmp_file = self.tmp_dir + 'out.webm' + command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" -vcodec copy -acodec copy -f webm -y "' + tmp_file + '" > /dev/null' + print(command) + os.system(command) + #ebml_obj = EBMLData(tmp_file) + #offset = ebml_obj.get_first_cluster_seconds() + command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + tmp_file + '" -vcodec copy -acodec copy -f webm -y "' + path + '" > /dev/null' + print(command) + os.system(command) + except: + pass + + def fix_mp3(self, source, path): + try: + command = '/usr/local/bin/ffmpeg -loglevel 0 -i "'+ source + '" -vn -aq 6 -y "' + path + '" > /dev/null' + print(command) + os.system(command) + except: + pass + +def get_pids(name, args=None): + """Get a process pid filtered by arguments and uid""" + pids = [] + for proc in psutil.process_iter(): + if proc.cmdline: + if name == proc.name: + if args: + if args in proc.cmdline: + pids.append(proc.pid) + else: + pids.append(proc.pid) + return pids + +dir = sys.argv[-2] +tmp_dir = sys.argv[-1] + +path = os.path.abspath(__file__) +pids = get_pids('python2.6',args=path) + +print(datetime.datetime.now()) +if len(pids) <= 1: + print('starting process...') + f = FixCheckMedia(dir, tmp_dir) + f.process() + print('process finished.\n') +else: + print('already started !\n') + diff --git a/bin/mastering/transcode-pro.py b/bin/mastering/transcode-pro.py new file mode 100755 index 0000000..d353af7 --- /dev/null +++ b/bin/mastering/transcode-pro.py @@ -0,0 +1,74 @@ +#!/usr/bin/python + +import os, sys, string +import logging +import datetime + + +class Logger: + """A logging object""" + + def __init__(self, file): + self.logger = logging.getLogger('myapp') + self.hdlr = logging.FileHandler(file) + self.formatter = logging.Formatter('%(asctime)s %(message)s') + self.hdlr.setFormatter(self.formatter) + self.logger.addHandler(self.hdlr) + self.logger.setLevel(logging.INFO) + + +class TelemetaTranscode(object): + """docstring for TelemetaTranscode""" + + source_formats = ['mp4',] + dest_formats = { + 'mp3' : '-vn -acodec libmp3lame -aq 6', + 'png' : '-ss 0:1:0', + } + + date_limit = datetime.datetime(year=2021, month=6, day=24) + + def __init__(self, args): + self.args = args + self.log_file = args[-1] + self.root_dir = args[-2] + self.logger = Logger(self.log_file) + + def get_ext_in_dir(self, extension, root): + files = os.listdir(root) + exts = [] + for f in files: + name, ext = os.path.splitext(f) + ext = ext[1:] + if not ext in exts: + exts.append(ext) + return extension in exts + + def run(self): + for root, dirs, files in os.walk(self.root_dir): + for file in files: + path = os.path.abspath(root + os.sep + file) + name, ext = os.path.splitext(file) + ext = ext[1:] + date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(path)) + if ext in self.source_formats and date_dir > self.date_limit: + for format, ffmpeg_args in self.dest_formats.items(): + local_file = name + '.' + format + dest = os.path.abspath(root + os.sep + local_file) + local_files = os.listdir(root) + if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: + if ext == 'webm' and format == 'ogg': + ffmpeg_args = '-vn -acodec copy' + if format == 'png': + command = '/usr/local/bin/ffmpeg -loglevel 0 ' + ffmpeg_args + ' -i "' + path + '" -frames:v 1 -y "' + dest + '"' + else: + command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' + self.logger.logger.info(command) + if not '--dry-run' in self.args: + os.system(command) + print(command) + + +if __name__ == '__main__': + t = TelemetaTranscode(sys.argv[1:]) + t.run() diff --git a/bin/mastering/transcode-vaapi.py b/bin/mastering/transcode-vaapi.py new file mode 100755 index 0000000..8a03205 --- /dev/null +++ b/bin/mastering/transcode-vaapi.py @@ -0,0 +1,76 @@ +#!/usr/bin/python + +import os, sys, string +import logging +import datetime + + +class Logger: + """A logging object""" + + def __init__(self, file): + self.logger = logging.getLogger('myapp') + self.hdlr = logging.FileHandler(file) + self.formatter = logging.Formatter('%(asctime)s %(message)s') + self.hdlr.setFormatter(self.formatter) + self.logger.addHandler(self.hdlr) + self.logger.setLevel(logging.INFO) + + +class Transcode(object): + """docstring for Transcode""" + + source_formats = ['MOV',] + output_formats = { + 'mp4-hevc' : + {"ext": "mp4", + "opt_in": "-hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi", + "opt_out": "-vf 'scale_vaapi=format=p010' -c:v hevc_vaapi -profile 2 -b:v 15M", + } + } + + def __init__(self, args): + self.args = args + self.input_dir = args[-3] + self.output_dir = args[-2] + self.log_file = args[-1] + self.logger = Logger(self.log_file) + + def get_ext_in_dir(self, extension, root): + files = os.listdir(root) + exts = [] + for f in files: + name, ext = os.path.splitext(f) + ext = ext[1:] + if not ext in exts: + exts.append(ext) + return extension in exts + + def run(self): + for root, dirs, files in os.walk(self.input_dir): + for file in files: + input_path = os.path.abspath(root + os.sep + file) + name, ext = os.path.splitext(file) + ext = ext[1:] + if ext in self.source_formats: + for output_format in self.output_formats: + output_format = self.output_formats[output_format] + output_dir = root.replace(self.input_dir, self.output_dir) + if not os.path.exists(output_dir): + os.makedirs(output_dir) + output_file = name + '.' + output_format["ext"] + output_path = os.path.abspath(output_dir + os.sep + output_file) + local_files = os.listdir(output_dir) + print(output_path) + if not (output_file in local_files or self.get_ext_in_dir(output_format["ext"], root)) or '--force' in self.args: + command = 'ffmpeg ' + output_format['opt_in'] + ' -i "' + input_path + '" ' + \ + output_format['opt_out'] + ' -y "' + output_path + '"' + self.logger.logger.info(command) + if not '--dry-run' in self.args: + os.system(command) + print(command) + + +if __name__ == '__main__': + t = Transcode(sys.argv[1:]) + t.run() diff --git a/bin/mastering/transcode.py b/bin/mastering/transcode.py new file mode 100755 index 0000000..336802e --- /dev/null +++ b/bin/mastering/transcode.py @@ -0,0 +1,75 @@ +#!/usr/bin/python + +import os, sys, string +import logging +import datetime + + +class Logger: + """A logging object""" + + def __init__(self, file): + self.logger = logging.getLogger('myapp') + self.hdlr = logging.FileHandler(file) + self.formatter = logging.Formatter('%(asctime)s %(message)s') + self.hdlr.setFormatter(self.formatter) + self.logger.addHandler(self.hdlr) + self.logger.setLevel(logging.INFO) + + +class TelemetaTranscode(object): + """docstring for TelemetaTranscode""" + + source_formats = ['webm',] + dest_formats = { + 'mp3' : '-vn -acodec libmp3lame -aq 6', + 'mp4' : '-c:v libx264 -maxrate 1100k -c:a aac -b:a 128k', + 'png' : '-ss 0:5:0', + } + + date_limit = datetime.datetime(year=2023, month=10, day=21) + + def __init__(self, args): + self.args = args + self.log_file = args[-1] + self.root_dir = args[-2] + self.logger = Logger(self.log_file) + + def get_ext_in_dir(self, extension, root): + files = os.listdir(root) + exts = [] + for f in files: + name, ext = os.path.splitext(f) + ext = ext[1:] + if not ext in exts: + exts.append(ext) + return extension in exts + + def run(self): + for root, dirs, files in os.walk(self.root_dir): + for file in files: + path = os.path.abspath(root + os.sep + file) + name, ext = os.path.splitext(file) + ext = ext[1:] + date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(path)) + if ext in self.source_formats and date_dir > self.date_limit: + for format, ffmpeg_args in self.dest_formats.items(): + local_file = name + '.' + format + dest = os.path.abspath(root + os.sep + local_file) + local_files = os.listdir(root) + if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: + if ext == 'webm' and format == 'ogg': + ffmpeg_args = '-vn -acodec copy' + if format == 'png': + command = '/usr/local/bin/ffmpeg -loglevel 0 ' + ffmpeg_args + ' -i "' + path + '" -frames:v 1 -y "' + dest + '"' + else: + command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' + self.logger.logger.info(command) + if not '--dry-run' in self.args: + os.system(command) + print(command) + + +if __name__ == '__main__': + t = TelemetaTranscode(sys.argv[1:]) + t.run() diff --git a/bin/mastering/transcode_nonv.py b/bin/mastering/transcode_nonv.py new file mode 100755 index 0000000..ec450a3 --- /dev/null +++ b/bin/mastering/transcode_nonv.py @@ -0,0 +1,76 @@ +#!/usr/bin/python + +import os, sys, string +import logging +import datetime + + +class Logger: + """A logging object""" + + def __init__(self, file): + self.logger = logging.getLogger('myapp') + self.hdlr = logging.FileHandler(file) + self.formatter = logging.Formatter('%(asctime)s %(message)s') + self.hdlr.setFormatter(self.formatter) + self.logger.addHandler(self.hdlr) + self.logger.setLevel(logging.INFO) + + +class TelemetaTranscode(object): + """docstring for TelemetaTranscode""" + + source_formats = ['webm',] + + dest_formats = { + 'mp3' : '-vn -acodec libmp3lame -aq 6', + 'mp4' : '-c:v libx264 -crf 17 -maxrate 1100k -bufsize 1835k -c:a aac -b:a 128k', + 'png' : '-ss 0:0:10', + } + + date_limit = datetime.datetime(year=2021, month=6, day=24) + + def __init__(self, args): + self.args = args + self.log_file = args[-1] + self.root_dir = args[-2] + self.logger = Logger(self.log_file) + + def get_ext_in_dir(self, extension, root): + files = os.listdir(root) + exts = [] + for f in files: + name, ext = os.path.splitext(f) + ext = ext[1:] + if not ext in exts: + exts.append(ext) + return extension in exts + + def run(self): + for root, dirs, files in os.walk(self.root_dir): + for file in files: + path = os.path.abspath(root + os.sep + file) + name, ext = os.path.splitext(file) + ext = ext[1:] + date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(path)) + if ext in self.source_formats and date_dir > self.date_limit: + for format, ffmpeg_args in self.dest_formats.items(): + local_file = name + '.' + format + dest = os.path.abspath(root + os.sep + local_file) + local_files = os.listdir(root) + if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: + if ext == 'webm' and format == 'ogg': + ffmpeg_args = '-vn -acodec copy' + if format == 'png': + command = '/usr/local/bin/ffmpeg -loglevel 0 ' + ffmpeg_args + ' -i "' + path + '" -frames:v 1 -y "' + dest + '"' + else: + command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' + self.logger.logger.info(command) + if not '--dry-run' in self.args: + os.system(command) + print(command) + + +if __name__ == '__main__': + t = TelemetaTranscode(sys.argv[1:]) + t.run() diff --git a/bin/mastering/transcode_nv-pro.py b/bin/mastering/transcode_nv-pro.py new file mode 100755 index 0000000..32c16eb --- /dev/null +++ b/bin/mastering/transcode_nv-pro.py @@ -0,0 +1,74 @@ +#!/usr/bin/python + +import os, sys, string +import logging +import datetime + + +class Logger: + """A logging object""" + + def __init__(self, file): + self.logger = logging.getLogger('myapp') + self.hdlr = logging.FileHandler(file) + self.formatter = logging.Formatter('%(asctime)s %(message)s') + self.hdlr.setFormatter(self.formatter) + self.logger.addHandler(self.hdlr) + self.logger.setLevel(logging.INFO) + + +class TelemetaTranscode(object): + """docstring for TelemetaTranscode""" + + source_formats = ['mp4',] + dest_formats = { + 'mp3' : '-vn -acodec libmp3lame -aq 6', + 'png' : '-ss 0:0:10', + } + + date_limit = datetime.datetime(year=2021, month=6, day=24) + + def __init__(self, args): + self.args = args + self.log_file = args[-1] + self.root_dir = args[-2] + self.logger = Logger(self.log_file) + + def get_ext_in_dir(self, extension, root): + files = os.listdir(root) + exts = [] + for f in files: + name, ext = os.path.splitext(f) + ext = ext[1:] + if not ext in exts: + exts.append(ext) + return extension in exts + + def run(self): + for root, dirs, files in os.walk(self.root_dir): + for file in files: + path = os.path.abspath(root + os.sep + file) + name, ext = os.path.splitext(file) + ext = ext[1:] + date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(path)) + if ext in self.source_formats and date_dir > self.date_limit: + for format, ffmpeg_args in self.dest_formats.items(): + local_file = name + '.' + format + dest = os.path.abspath(root + os.sep + local_file) + local_files = os.listdir(root) + if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: + if ext == 'webm' and format == 'ogg': + ffmpeg_args = '-vn -acodec copy' + if format == 'png': + command = '/usr/local/bin/ffmpeg -loglevel 0 ' + ffmpeg_args + ' -i "' + path + '" -frames:v 1 -y "' + dest + '"' + else: + command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' + self.logger.logger.info(command) + if not '--dry-run' in self.args: + os.system(command) + print(command) + + +if __name__ == '__main__': + t = TelemetaTranscode(sys.argv[1:]) + t.run() diff --git a/bin/mastering/transcode_nv.py b/bin/mastering/transcode_nv.py new file mode 100755 index 0000000..e55fe29 --- /dev/null +++ b/bin/mastering/transcode_nv.py @@ -0,0 +1,75 @@ +#!/usr/bin/python + +import os, sys, string +import logging +import datetime + + +class Logger: + """A logging object""" + + def __init__(self, file): + self.logger = logging.getLogger('myapp') + self.hdlr = logging.FileHandler(file) + self.formatter = logging.Formatter('%(asctime)s %(message)s') + self.hdlr.setFormatter(self.formatter) + self.logger.addHandler(self.hdlr) + self.logger.setLevel(logging.INFO) + + +class TelemetaTranscode(object): + """docstring for TelemetaTranscode""" + + source_formats = ['webm',] + dest_formats = { + 'mp3' : '-vn -acodec libmp3lame -aq 6', + 'mp4' : '-c:v h264_nvenc -maxrate 1100k -c:a aac -b:a 128k', + 'png' : '-ss 0:0:10', + } + + date_limit = datetime.datetime(year=2023, month=10, day=24) + + def __init__(self, args): + self.args = args + self.log_file = args[-1] + self.root_dir = args[-2] + self.logger = Logger(self.log_file) + + def get_ext_in_dir(self, extension, root): + files = os.listdir(root) + exts = [] + for f in files: + name, ext = os.path.splitext(f) + ext = ext[1:] + if not ext in exts: + exts.append(ext) + return extension in exts + + def run(self): + for root, dirs, files in os.walk(self.root_dir): + for file in files: + path = os.path.abspath(root + os.sep + file) + name, ext = os.path.splitext(file) + ext = ext[1:] + date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(path)) + if ext in self.source_formats and date_dir > self.date_limit: + for format, ffmpeg_args in self.dest_formats.items(): + local_file = name + '.' + format + dest = os.path.abspath(root + os.sep + local_file) + local_files = os.listdir(root) + if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: + if ext == 'webm' and format == 'ogg': + ffmpeg_args = '-vn -acodec copy' + if format == 'png': + command = '/usr/local/bin/ffmpeg -loglevel 0 ' + ffmpeg_args + ' -i "' + path + '" -frames:v 1 -y "' + dest + '"' + else: + command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' + self.logger.logger.info(command) + if not '--dry-run' in self.args: + os.system(command) + print(command) + + +if __name__ == '__main__': + t = TelemetaTranscode(sys.argv[1:]) + t.run() diff --git a/bin/mastering/transcode_old.py.bak b/bin/mastering/transcode_old.py.bak new file mode 100755 index 0000000..12719e6 --- /dev/null +++ b/bin/mastering/transcode_old.py.bak @@ -0,0 +1,76 @@ +#!/usr/bin/python + +import os, sys, string +import logging + + +class Logger: + """A logging object""" + + def __init__(self, file): + self.logger = logging.getLogger('myapp') + self.hdlr = logging.FileHandler(file) + self.formatter = logging.Formatter('%(asctime)s %(message)s') + self.hdlr.setFormatter(self.formatter) + self.logger.addHandler(self.hdlr) + self.logger.setLevel(logging.INFO) + + +class TelemetaTranscode(object): + """docstring for TelemetaTranscode""" + + threads = 4 + source_formats = ['webm', 'mp4'] + dest_formats = { + 'mp3' : '-vn -acodec libmp3lame -aq 6', + 'ogg' : '-vn -acodec libvorbis -aq 6', + 'mp4' : '-vcodec libx264 -threads ' + str(threads) + \ + ' -c:v libx264 -crf 17 -maxrate 1100k -bufsize 1835k -acodec aac -strict -2 -ab 96k', + 'png' : '-ss 0:0:10', + 'webm' : '-vcodec libvpx -threads ' + str(threads) + \ + ' -c:v libvpx -crf 17 -b:v 1100k', + } + + + def __init__(self, args): + self.args = args + self.log_file = args[-1] + self.root_dir = args[-2] + self.logger = Logger(self.log_file) + + + def get_ext_in_dir(self, extension, root): + files = os.listdir(root) + exts = [] + for f in files: + name, ext = os.path.splitext(f) + ext = ext[1:] + if not ext in exts: + exts.append(ext) + return extension in exts + + def run(self): + for root, dirs, files in os.walk(self.root_dir): + for file in files: + path = os.path.abspath(root + os.sep + file) + name, ext = os.path.splitext(file) + ext = ext[1:] + if ext in self.source_formats: + for format, ffmpeg_args in self.dest_formats.iteritems(): + local_file = name + '.' + format + dest = os.path.abspath(root + os.sep + local_file) + local_files = os.listdir(root) + if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: + if ext == 'webm' and format == 'ogg': + ffmpeg_args = '-vn -acodec copy' + command = 'ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' + self.logger.logger.info(command) + if not '--dry-run' in self.args: + os.system(command) + else: + print command + + +if __name__ == '__main__': + t = TelemetaTranscode(sys.argv[1:]) + t.run() diff --git a/bin/mastering/transcode_pro_old.py b/bin/mastering/transcode_pro_old.py new file mode 100755 index 0000000..0b44f54 --- /dev/null +++ b/bin/mastering/transcode_pro_old.py @@ -0,0 +1,74 @@ +#!/usr/bin/python + +import os, sys, string +import logging + + +class Logger: + """A logging object""" + + def __init__(self, file): + self.logger = logging.getLogger('myapp') + self.hdlr = logging.FileHandler(file) + self.formatter = logging.Formatter('%(asctime)s %(message)s') + self.hdlr.setFormatter(self.formatter) + self.logger.addHandler(self.hdlr) + self.logger.setLevel(logging.INFO) + + +class TelemetaTranscode(object): + """docstring for TelemetaTranscode""" + + threads = 15 + source_formats = ['mp4'] + dest_formats = { + 'mp3' : '-vn -acodec libmp3lame -aq 6', + 'ogg' : '-vn -acodec libvorbis -aq 6', + 'png' : '-ss 0:0:10', + 'webm' : '-vcodec libvpx -threads ' + str(threads) + \ + ' -c:v libvpx -crf 17 -b:v 1100k', + } + + + def __init__(self, args): + self.args = args + self.log_file = args[-1] + self.root_dir = args[-2] + self.logger = Logger(self.log_file) + + + def get_ext_in_dir(self, extension, root): + files = os.listdir(root) + exts = [] + for f in files: + name, ext = os.path.splitext(f) + ext = ext[1:] + if not ext in exts: + exts.append(ext) + return extension in exts + + def run(self): + for root, dirs, files in os.walk(self.root_dir): + for file in files: + path = os.path.abspath(root + os.sep + file) + name, ext = os.path.splitext(file) + ext = ext[1:] + if ext in self.source_formats: + for format, ffmpeg_args in self.dest_formats.iteritems(): + local_file = name + '.' + format + dest = os.path.abspath(root + os.sep + local_file) + local_files = os.listdir(root) + if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: + if ext == 'webm' and format == 'ogg': + ffmpeg_args = '-vn -acodec copy' + command = 'ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' + self.logger.logger.info(command) + if not '--dry-run' in self.args: + os.system(command) + else: + print command + + +if __name__ == '__main__': + t = TelemetaTranscode(sys.argv[1:]) + t.run() diff --git a/bin/monitoring/monitor_check.py b/bin/monitoring/monitor_check.py new file mode 100755 index 0000000..b78f7b6 --- /dev/null +++ b/bin/monitoring/monitor_check.py @@ -0,0 +1,75 @@ +import sys, time, logging, socket, datetime +from threading import Thread +from logging.handlers import SMTPHandler + +from watchdog.observers import Observer +from watchdog.events import * + + +IGNORE_PATTERNS = ['*.git/*', '*.swp', '*.swpx', '*~', '*.tmp',] +HOSTNAME = socket.gethostname() +LOG_MAX_PERIOD = 300 + +class EmailLogger(object): + """An email logging class""" + + def __init__(self, mailhost, fromaddr, toaddrs, subject): + self.logger = logging.getLogger('telecaster') + self.hdlr = SMTPHandler(mailhost, fromaddr, toaddrs, subject) + self.formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') + self.hdlr.setFormatter(self.formatter) + self.logger.addHandler(self.hdlr) + self.logger.setLevel(logging.INFO) + + +class ActivityEventHandler(PatternMatchingEventHandler): + + activity = True + + def on_modified(self, event): + super(ActivityEventHandler, self).on_modified(event) + self.activity = True + + +class ActivityCheck(Thread): + + def __init__(self, period, path, mailhost, fromaddr, toaddrs): + Thread.__init__(self) + self.period = int(period) + self.path = path + self.activity = False + self.last_time = datetime.datetime.now() + self.message_sent = False + self.subject = 'WARNING : ' + HOSTNAME + ' : ' + 'telecaster monitor activity' + self.logger = EmailLogger(mailhost, fromaddr, toaddrs, self.subject) + self.event_handler = ActivityEventHandler(ignore_patterns=IGNORE_PATTERNS) + self.observer = Observer() + self.observer.schedule(self.event_handler, path, recursive=True) + self.observer.start() + + def run(self): + while True: + if not self.event_handler.activity: + now = datetime.datetime.now() + delta = now - self.last_time + if delta.total_seconds() > LOG_MAX_PERIOD or not self.message_sent: + self.logger.logger.error('The monitor is NOT recording anymore in ' + self.path + ' ! ') + self.last_time = now + self.message_sent = True + else: + self.event_handler.activity = False + time.sleep(self.period) + + def stop(self): + self.observer.stop() + + +if __name__ == "__main__": + period = sys.argv[1] + path = sys.argv[2] + mailhost = sys.argv[3] + fromaddr = sys.argv[4] + toaddrs = sys.argv[5].split(',') + check = ActivityCheck(period, path, mailhost, fromaddr, toaddrs) + check.start() + check.join() diff --git a/bin/publishing/backup_nile.sh b/bin/publishing/backup_nile.sh new file mode 100755 index 0000000..44b8b1e --- /dev/null +++ b/bin/publishing/backup_nile.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +rsync -aq /home/telecaster/archives/Pre-Barreau/ /mnt/nile/Pre-Barreau/ +rsync -aq /home/telecaster/kdenlive/ /mnt/nile/Pre-Barreau/Pro-Barreau/kdenlive/ diff --git a/bin/publishing/seafile_sync.sh b/bin/publishing/seafile_sync.sh new file mode 100755 index 0000000..aece99e --- /dev/null +++ b/bin/publishing/seafile_sync.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +seaf-cli start + +seaf-cli sync -l 063a03f2-2947-4f90-b4a1-7d1e34eb62e0 -s http://localhost:9080 -d "/home/telecaster/seafile/CRFPA" -u "telecaster@parisson.com" -p "cab2GhetGoog" + diff --git a/bin/publishing/telecaster_master-ae.sh b/bin/publishing/telecaster_master-ae.sh new file mode 100755 index 0000000..3ccf8bc --- /dev/null +++ b/bin/publishing/telecaster_master-ae.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +organization=Pre-Barreau +department=AE +year=`date '+%Y'` +year2=$((year-1)) +media_dir=/home/telecaster/archives/$organization/$department/$year/ +server_media_dir=/mnt/ae-videos/$organization/$department/$year/ +backup_dir=/mnt/nile/$organization/$department/$year/ +tmp_log=/tmp/telecaster-$department.log +remux_log=/home/telecaster/log/remux-$department.log +transcode_log=/home/telecaster/log/transcode-$department.log +import_log=/var/log/app/import_media.log +tmp_dir=/home/telecaster/tmp/ +app_server=malcom.parisson.com +app_path=/srv/ae-docker +media_server=malcom.parisson.com +emails="webmaster@parisson.com,jeannot@parisson.com" +subject="TeleCaster remux ($departement)" +bwlimit=20000 + + +python ~/bin/py/remux_fix_media.py $media_dir $tmp_dir > $tmp_log + +cat $tmp_log >> $remux_log + +python ~/bin/py/transcode_nv.py $media_dir $transcode_log + +rsync -auLKr --bwlimit=$bwlimit --include="*/" --include="$year/**" --include="$year2/**" --exclude="*.webm" --exclude="@eaDir" $media_dir $media_server:$server_media_dir + +ssh $app_server "docker compose -f $app_path/docker-compose.yml -f $app_path/env/prod.yml exec -T app /srv/app/manage.py teleforma-import-conferences-2 $organization $department $import_log" + +python ~/apps/tools/message/mail_msg.py $subject $tmp_log $emails + + diff --git a/bin/publishing/telecaster_master-crfpa-mp4-staging.sh b/bin/publishing/telecaster_master-crfpa-mp4-staging.sh new file mode 100755 index 0000000..1668e9c --- /dev/null +++ b/bin/publishing/telecaster_master-crfpa-mp4-staging.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +year=`date '+%Y'` +media_dir=/home/telecaster/archives/Pre-Barreau/CRFPA/$year/ +backup_dir=/mnt/nile/Pre-Barreau/CRFPA/$year/ +tmp_log=/tmp/telecaster-remux-crfpa.log +log=/home/telecaster/log/remux-crfpa.log +tmp_dir=/home/telecaster/tmp/ +app_server=malcom.parisson.com +app_path=/srv/crfpa-docker-staging +media_server=malcom.parisson.com +emails="webmaster@parisson.com,jeannot@parisson.com" +subject="TeleCaster remux (CRFPA)" +bwlimit=20000 + +python ~/bin/py/remux_fix_media.py $media_dir $tmp_dir > $tmp_log + +cat $tmp_log >> $remux_log + +#rsync -uLKPr $media_dir $backup_dir + +#echo `date` >> ~/log/transcode-crfpa.log + +python ~/bin/py/transcode_nv.py $media_dir $transcode_log + +#find $backup_dir -type d -exec chmod 755 {} \; +#find $backup_dir -type f -exec chmod 644 {} \; + +#rsync -auLKPr --bwlimit=$bwlimit --include="*/" --include="$year/**" --exclude="*" $backup_dir $media_server:$media_dir +#rsync -uLKPr --bwlimit=$bwlimit --include="*/" --include="$year/**" --exclude=".webm" --exclude=".ogg" --exclude="*" $backup_dir $media_server:$media_dir +rsync -auLKPr --bwlimit=$bwlimit --include="*/" --include="$year/**" --exclude="*.webm" --exclude="@eaDir" $backup_dir $media_server:$media_dir + +ssh $app_server "docker-compose -f $app_path/docker-compose.yml -f $app_path/env/prod.yml exec app /srv/app/manage.py teleforma-import-conferences-2 Pre-Barreau CRFPA /var/log/app/import_media.log" + +#python ~/apps/tools/message/mail_msg.py $subject $tmp_log $emails + + diff --git a/bin/publishing/telecaster_master-crfpa-mp4.sh b/bin/publishing/telecaster_master-crfpa-mp4.sh new file mode 100755 index 0000000..413ffc4 --- /dev/null +++ b/bin/publishing/telecaster_master-crfpa-mp4.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +organization=Pre-Barreau +department=CRFPA +year=`date '+%Y'` +media_dir=/home/telecaster/archives/$organization/$department/$year/ +server_media_dir=/mnt/crfpa-videos/$organization/$department/$year/ +backup_dir=/mnt/nile/$organization/$department/$year/ +tmp_log=/tmp/telecaster-$department.log +remux_log=/home/telecaster/log/remux-$department.log +transcode_log=/home/telecaster/log/transcode-$department.log +import_log=/var/log/app/import_media.log +tmp_dir=/home/telecaster/tmp/ +app_server=malcom.parisson.com +app_path=/srv/crfpa-docker +media_server=malcom.parisson.com +emails="webmaster@parisson.com,jeannot@parisson.com" +subject="TeleCaster remux (CRFPA)" +bwlimit=20000 + +python ~/bin/py/remux_fix_media.py $media_dir $tmp_dir > $tmp_log + +cat $tmp_log >> $remux_log + +python ~/bin/py/transcode_nv.py $media_dir $transcode_log + +#find $backup_dir -type d -exec chmod 755 {} \; +#find $backup_dir -type f -exec chmod 644 {} \; + +rsync -auLKr --bwlimit=$bwlimit --include="*/" --include="$year/**" --exclude="*.webm" --exclude="@eaDir" $media_dir $media_server:$server_media_dir + +ssh $app_server "docker compose -f $app_path/docker-compose.yml -f $app_path/env/prod.yml exec -T app /srv/app/manage.py teleforma-import-conferences-2 $organization $department $import_log" + +python ~/apps/tools/message/mail_msg.py $subject $tmp_log $emails + + diff --git a/bin/publishing/telecaster_master-pro.sh b/bin/publishing/telecaster_master-pro.sh new file mode 100755 index 0000000..8f3b26d --- /dev/null +++ b/bin/publishing/telecaster_master-pro.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +day=`date '+%Y-%m-%d_%H-%M-%S'` +year=`date '+%Y'` +#year=2020 + +script_dir="/home/telecaster/kdenlive/scripts/" +server="malcom.parisson.com" +tmp_dir="/home/telecaster/tmp/" +log_dir="/home/telecaster/log/" + + +for y in `seq $(($year)) $(($year+1))`; do + echo $y + media_dir="/home/telecaster/kdenlive/Final/$y/" + server_media_dir="/mnt/prob-videos/Pre-Barreau/Pro-Barreau/Final/$y/" + archives_dir="/home/telecaster/archives/Pre-Barreau/Pro-Barreau/$y/" + + #bash ~/apps/Telemeta/scripts/kdenlive/mlt_fix_threads.sh $script_dir + #python ~/apps/Telemeta/scripts/kdenlive/mlt_process_batch.py --fading $script_dir >> $log_dir/mlt.log + #python ~/apps/Telemeta/scripts/transcode/remux_fix_media.py $archives_dir $tmp_dir >> $log_dir/remux-pro.log + #python ~/apps/Telemeta/scripts/transcode/transcode.py $media_dir $log_dir/transcode-pro.log + + python ~/bin/py/remux_fix_media.py $archives_dir $tmp_dir >> $log_dir/remux-pro.log + python ~/bin/py/transcode_nv-pro.py $media_dir $log_dir/transcode-pro.log + + chmod -fR 664 $media_dir; chmod -fR +rX $media_dir + rsync -aquLKP --bwlimit=15000 --delete --exclude="@eaDir" $media_dir $server:$server_media_dir + + #ssh $server chmod -R 664 $server_media_dir + #ssh $server chmod -R +rX $server_media_dir + +done diff --git a/bin/streaming/docker/jackd.sh b/bin/streaming/docker/jackd.sh new file mode 100755 index 0000000..38c80b8 --- /dev/null +++ b/bin/streaming/docker/jackd.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +mount -o remount,size=128M /dev/shm +export `dbus-launch | grep ADDRESS` +export `dbus-launch | grep PID` +jackd -R -P70 -dalsa -dhw:0 -r44100 -p1024 -n2 & + diff --git a/bin/streaming/loopback/launch-pa-virtual-mic.sh b/bin/streaming/loopback/launch-pa-virtual-mic.sh new file mode 100755 index 0000000..b515c3b --- /dev/null +++ b/bin/streaming/loopback/launch-pa-virtual-mic.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# https://unix.stackexchange.com/questions/576785/redirecting-pulseaudio-sink-to-a-virtual-source + +pactl load-module module-null-sink sink_name=mix-for-virtual-mic \ +sink_properties=device.description=Mix-for-Virtual-Microphone + +pactl load-module module-null-sink sink_name=silence \ +sink_properties=device.description=silent-sink-for-echo-cancel + +pactl load-module module-echo-cancel \ +sink_name=virtual-microphone source_name=virtual-microphone \ +source_master=mix-for-virtual-mic.monitor sink_master=silence aec_method=null \ +source_properties=device.description=Virtual-Microphone \ +sink_properties=device.description=Virtual-Microphone + diff --git a/bin/streaming/loopback/launch-url2video.sh b/bin/streaming/loopback/launch-url2video.sh new file mode 100755 index 0000000..212228c --- /dev/null +++ b/bin/streaming/loopback/launch-url2video.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +URL=https://e-learning.crfpa.pre-barreau.com/media/Pre-Barreau/CRFPA/2021/Libertes_-_Cours/3cf774cb990d9987/crfpa-libertes-cours-09_16_21-09:45:47.mp4 + +VIDEO_SINK_NAME="/dev/video12" +AUDIO_SINK_NAME="mix-for-virtual-mic" + +gst-launch-1.0 uridecodebin uri="$URL" name=uridec do-timestamp=true live=true \ + ! videoconvert \ + ! v4l2sink device=$VIDEO_SINK_NAME sync=true \ + uridec. \ + ! queue \ + ! audioconvert \ + ! pulsesink device=$AUDIO_SINK_NAME sync=true diff --git a/bin/streaming/loopback/launch-v4l2loopback.sh b/bin/streaming/loopback/launch-v4l2loopback.sh new file mode 100755 index 0000000..a5061dc --- /dev/null +++ b/bin/streaming/loopback/launch-v4l2loopback.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo modprobe v4l2loopback devices=1 video_nr=12 card_label="virtual webcam" exclusive_caps=1 max_buffers=2 diff --git a/bin/streaming/old/tc_audio_mp3_icecast.sh b/bin/streaming/old/tc_audio_mp3_icecast.sh new file mode 100755 index 0000000..b80c57f --- /dev/null +++ b/bin/streaming/old/tc_audio_mp3_icecast.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +gst-launch jackaudiosrc connect=1 ! audio/x-raw-float, channels=1 \ + ! queue ! audioconvert ! queue ! lamemp3enc quality=4.0 \ + ! queue ! shout2send ip=127.0.0.1 port=8000 password=source2parisson mount=telecaster_live.mp3 + > /dev/null diff --git a/bin/streaming/old/tc_video_simple_webm_stream-2.sh b/bin/streaming/old/tc_video_simple_webm_stream-2.sh new file mode 100755 index 0000000..dd46d8a --- /dev/null +++ b/bin/streaming/old/tc_video_simple_webm_stream-2.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# Start TeleCaster video channel + +#WIDTH=640 +#HEIGHT=360 +WIDTH=864 +HEIGHT=480 +#WIDTH=1280 +#HEIGHT=720 + +# v4l2-ctl -d 0 -c power_line_frequency=1 +# v4l2-ctl -d 0 -c zoom_absolute=100 +# v4l2-ctl -d 0 -c focus_auto=0 +# v4l2-ctl -d 0 -c focus_absolute=1 + +# # ! queue ! videoflip method=rotate-180 \ + +# gst-launch v4l2src device=/dev/video0 ! video/x-raw-rgb, width=$WIDTH, height=$HEIGHT, framerate={30/1} \ +# ! queue ! ffmpegcolorspace \ +# ! queue ! vp8enc speed=2 threads=4 quality=10.0 max-latency=25 max-keyframe-distance=30 auto-alt-ref-frames=true ! queue ! muxout. \ +# jackaudiosrc connect=2 ! audio/x-raw-float, channels=2 \ +# ! queue ! audioconvert ! queue ! vorbisenc quality=0.4 ! queue ! muxout. \ +# webmmux streamable=true name=muxout \ +# ! queue ! tcpserversink host=127.0.0.1 port=9000 protocol=none blocksize=65536 sync-method=1 \ +# > /dev/null + + +gst-launch-1.0 \ + v4l2src device=/dev/video0 \ + ! queue \ + ! videoconvert \ + ! queue \ + ! vp8enc threads=4 deadline=2 \ + ! queue \ + ! mux. \ + jackaudiosrc connect=2 \ + ! audio/x-raw, channels=2 \ + ! queue \ + ! volume volume=3.0 \ + ! queue \ + ! audiocheblimit mode=low-pass cutoff=16000 poles=4 \ + ! queue \ + ! audiocheblimit mode=high-pass cutoff=80 poles=4 \ + ! queue \ + ! audiodynamic characteristics=hard-knee mode=compressor threshold=0.1 ratio=12.0 \ + ! queue \ + ! volume volume=2.5 \ + ! queue \ + ! audioconvert \ + ! queue \ + ! vorbisenc quality=0.4 \ + ! queue \ + ! mux. \ + webmmux name=mux streamable=true \ + ! shout2send ip=localhost port=8000 password=source2parisson mount=monitor.webm diff --git a/bin/streaming/old/tc_video_simple_webm_stream-gst1-flip180.sh b/bin/streaming/old/tc_video_simple_webm_stream-gst1-flip180.sh new file mode 100755 index 0000000..dacfcd3 --- /dev/null +++ b/bin/streaming/old/tc_video_simple_webm_stream-gst1-flip180.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# Start TeleCaster video channel + +#WIDTH=640 +#HEIGHT=360 +WIDTH=864 +HEIGHT=480 +#WIDTH=1280 +#HEIGHT=720 +FRAMERATE=24 + +v4l2-ctl -d 0 -c power_line_frequency=1 +v4l2-ctl -d 0 -c zoom_absolute=135 +v4l2-ctl -d 0 -c focus_auto=0 +v4l2-ctl -d 0 -c focus_absolute=1 +v4l2-ctl -d 0 -c sharpness=100 + +# ! queue ! videoflip method=rotate-180 \ + +gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, format=YUY2, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE/1 \ + ! queue ! videoflip method=rotate-180 \ + ! queue ! videoconvert \ + ! queue ! vp8enc threads=4 deadline=2 \ + ! queue ! muxout. \ + jackaudiosrc connect=1 ! audio/x-raw, format=F32LE, channels=1 \ + ! queue ! audiocheblimit mode=high-pass cutoff=120 poles=4 \ + ! queue ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.16 ratio=0.15 \ + ! queue ! rgvolume pre-amp=6.0 headroom=1.0 \ + ! queue ! rglimiter \ + ! queue ! audioconvert \ + ! queue ! opusenc bitrate=96000 \ + ! queue ! muxout. \ + webmmux streamable=true name=muxout \ + ! queue ! tcpserversink host=127.0.0.1 port=9000 blocksize=65536 sync-method=1 \ + > /dev/null diff --git a/bin/streaming/old/tc_video_simple_webm_stream.sh b/bin/streaming/old/tc_video_simple_webm_stream.sh new file mode 100755 index 0000000..8a035e8 --- /dev/null +++ b/bin/streaming/old/tc_video_simple_webm_stream.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Start TeleCaster video channel + +#WIDTH=640 +#HEIGHT=360 +WIDTH=864 +HEIGHT=480 +#WIDTH=1280 +#HEIGHT=720 + +v4l2-ctl -d 0 -c power_line_frequency=1 +v4l2-ctl -d 0 -c zoom_absolute=100 +v4l2-ctl -d 0 -c focus_auto=0 +v4l2-ctl -d 0 -c focus_absolute=1 + +# ! queue ! videoflip method=rotate-180 \ + +gst-launch v4l2src device=/dev/video0 ! video/x-raw-rgb, width=$WIDTH, height=$HEIGHT, framerate={30/1} \ + ! queue ! ffmpegcolorspace \ + ! queue ! vp8enc speed=2 threads=4 quality=10.0 max-latency=25 max-keyframe-distance=30 auto-alt-ref-frames=true ! queue ! muxout. \ + jackaudiosrc connect=2 ! audio/x-raw-float, channels=2 \ + ! queue ! audioconvert ! queue ! vorbisenc quality=0.4 ! queue ! muxout. \ + webmmux streamable=true name=muxout \ + ! queue ! tcpserversink host=127.0.0.1 port=9000 protocol=none blocksize=65536 sync-method=1 \ + > /dev/null diff --git a/bin/streaming/tc_audio_mp3_icecast-gst1.sh b/bin/streaming/tc_audio_mp3_icecast-gst1.sh new file mode 100755 index 0000000..6ca87d6 --- /dev/null +++ b/bin/streaming/tc_audio_mp3_icecast-gst1.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -e + +# Audio +AUDIO_CHANNELS=2 +AUDIO_OPUS_BITRATE=96000 +AUDIO_MP3_QUALITY=4.0 +AUDIO_GAIN_PRE=2.5 +AUDIO_GAIN_POST=1.5 + +source /etc/telecaster/telecaster.conf + +# GST launch +gst-launch-1.0 jackaudiosrc connect=2 ! audio/x-raw, format=F32LE, channels=$AUDIO_CHANNELS \ + ! queue ! audiocheblimit mode=high-pass cutoff=120 poles=4 \ + ! queue ! volume volume=$AUDIO_GAIN_PRE \ + ! queue ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.125 ratio=0.125 \ + ! queue ! volume volume=$AUDIO_GAIN_POST \ + ! queue ! audiodynamic characteristics=hard-knee mode=compressor threshold=0.95 ratio=0.001 \ + ! queue ! audioconvert \ + ! queue ! lamemp3enc quality=$AUDIO_MP3_QUALITY \ + ! queue ! shout2send ip=127.0.0.1 port=8000 password=source2parisson mount=telecaster_live.mp3 + > /dev/null + diff --git a/bin/streaming/tc_start.sh b/bin/streaming/tc_start.sh new file mode 100755 index 0000000..ac12ded --- /dev/null +++ b/bin/streaming/tc_start.sh @@ -0,0 +1,55 @@ +set -e + +source /etc/telecaster/telecaster.conf + +# jackd + +jackd $JACK_OPTIONS & + +sleep 2 + +# telecaster + +konsole & + +qjackctl & + +sleep 1 + +./tc_audio_mp3_icecast-gst1.sh & + +sleep 1 + +./tc_video_simple_webm_stream-gst1.sh & + +sleep 1 + +# JACK ports setup + +# STEREO setup +# 1: L +# 2: R + +#jack_disconnect system:capture_1 gst-launch-1.0:in_jackaudiosrc0_1 +#jack_disconnect system:capture_2 gst-launch-1.0:in_jackaudiosrc0_2 + +#jack_disconnect system:capture_1 gst-launch-1.0-01:in_jackaudiosrc0_1 +#jack_disconnect system:capture_2 gst-launch-1.0-01:in_jackaudiosrc0_2 + +#jack_connect system:capture_1 gst-launch-1.0:in_jackaudiosrc0_1 +#jack_connect system:capture_2 gst-launch-1.0:in_jackaudiosrc0_2 + +# ADDITIONAL mics +# 3: C + +# jack_connect system:capture_3 gst-launch-1.0:in_jackaudiosrc0_1 +# jack_connect system:capture_3 gst-launch-1.0:in_jackaudiosrc0_2 + +# jack_connect system:capture_3 gst-launch-1.0-01:in_jackaudiosrc0_1 +# jack_connect system:capture_3 gst-launch-1.0-01:in_jackaudiosrc0_2 + +#Audio monitor +deefuzzer DEEFUZZER_AUDIO_CONF & + +#Video monitor +deefuzzer $DEEFUZZER_VIDEO_CONF & \ No newline at end of file diff --git a/bin/streaming/tc_video_simple_webm_stream-gst1.sh b/bin/streaming/tc_video_simple_webm_stream-gst1.sh new file mode 100755 index 0000000..85c1a8d --- /dev/null +++ b/bin/streaming/tc_video_simple_webm_stream-gst1.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +set -e + +# Default TeleCaster video parameters + +# v4l2 +V4L2_ID=0 +V4L2_ZOOM=140 +V4L2_SHARPNESS=128 + +# C920 +#VIDEO_WIDTH=864 +#VIDEO_HEIGHT=480 +#VIDEO_FRAMERATE=24 + +# C922 +VIDEO_WIDTH=864 +VIDEO_HEIGHT=480 +VIDEO_FRAMERATE=24 +VIDEO_FLIP=none + +# Audio +AUDIO_CHANNELS=2 +AUDIO_OPUS_BITRATE=96000 +AUDIO_GAIN_PRE=2.5 +AUDIO_GAIN_POST=1.5 + +source /etc/telecaster/telecaster.conf + +# V4L2 setup +v4l2-ctl -d $V4L2_ID -c power_line_frequency=1 +v4l2-ctl -d $V4L2_ID -c zoom_absolute=$V4L2_ZOOM +v4l2-ctl -d $V4L2_ID -c focus_auto=0 +v4l2-ctl -d $V4L2_ID -c focus_absolute=1 +v4l2-ctl -d $V4L2_ID -c sharpness=$V4L2_SHARPNESS + +# GST launch +gst-launch-1.0 v4l2src device=/dev/video$V4L2_ID ! video/x-raw, format=YUY2, width=$VIDEO_WIDTH, height=$VIDEO_HEIGHT, framerate=$VIDEO_FRAMERATE/1 \ + ! queue ! videoflip method=$VIDEO_FLIP \ + ! queue ! videoconvert \ + ! queue ! vp8enc threads=4 deadline=2 \ + ! queue ! muxout. \ + jackaudiosrc connect=2 ! audio/x-raw, format=F32LE, channels=$AUDIO_CHANNELS \ + ! queue ! audiocheblimit mode=high-pass cutoff=120 poles=4 \ + ! queue ! volume volume=$AUDIO_GAIN_PRE \ + ! queue ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.125 ratio=0.125 \ + ! queue ! volume volume=$AUDIO_GAIN_POST \ + ! queue ! audiodynamic characteristics=hard-knee mode=compressor threshold=0.95 ratio=0.001 \ + ! queue ! audioconvert \ + ! queue ! opusenc bitrate=$AUDIO_OPUS_BITRATE \ + ! queue ! muxout. \ + webmmux streamable=true name=muxout \ + ! queue ! shout2send ip=127.0.0.1 port=8000 password=source2parisson mount=telecaster_live.webm + > /dev/null diff --git a/env/.fluxbox/autostart.sh b/env/.fluxbox/autostart.sh new file mode 100755 index 0000000..24e92a3 --- /dev/null +++ b/env/.fluxbox/autostart.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# --------------------- +# Audio channel +# --------------------- + +qjackctl & + +/home/telecaster/.fluxbox/scripts/tc_audio_mp3_icecast-gst1.sh & + +/home/telecaster/.fluxbox/scripts/tc_video_simple_webm_stream-gst1.sh & + +sleep 8 + +#Audio monitor +deefuzzer /etc/telecaster/deefuzzer/telecaster_mp3_monitor.yaml & + +#Video monitor +deefuzzer /etc/telecaster/deefuzzer/telecaster_webm_monitor.yaml & + +#sleep 3 + +#Wathdog for trash +#/home/telecaster/.fluxbox/scripts/monitor_check.py 10 /home/telecaster/trash/webm/ smtp.icp.fr informatique@icp.fr alerts@parisson.com & + diff --git a/env/.fluxbox/init b/env/.fluxbox/init new file mode 100644 index 0000000..a47c424 --- /dev/null +++ b/env/.fluxbox/init @@ -0,0 +1,3 @@ +session.menuFile: ~/.fluxbox/menu +session.keyFile: ~/.fluxbox/keys +session.configVersion: 13 diff --git a/env/.fluxbox/startup b/env/.fluxbox/startup new file mode 100644 index 0000000..a42557b --- /dev/null +++ b/env/.fluxbox/startup @@ -0,0 +1,33 @@ +#!/bin/sh +# +# fluxbox startup-script: +# +# Lines starting with a '#' are ignored. + +# Change your keymap: +xmodmap "/home/telecaster/.Xmodmap" + +# Applications you want to run with fluxbox. +# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END. +# +# unclutter -idle 2 & +# wmnd & +# wmsmixer -w & +# idesk & +# +# Debian-local change: +# - fbautostart has been added with a quick hack to check to see if it +# exists. If it does, we'll start it up by default. +which fbautostart > /dev/null +if [ $? -eq 0 ]; then + fbautostart +fi + +/srv/telecaster/telecaster-server/bin/streaming/tc_start.sh + +# And last but not least we start fluxbox. +# Because it is the last app you have to run it with ''exec'' before it. + +exec fluxbox +# or if you want to keep a log: +# exec fluxbox -log "$$FLUXBOX_DIR/log" diff --git a/env/.vnc/xstartup b/env/.vnc/xstartup new file mode 100755 index 0000000..ce84087 --- /dev/null +++ b/env/.vnc/xstartup @@ -0,0 +1,16 @@ +#!/bin/sh + +# Uncomment the following two lines for normal desktop: +# unset SESSION_MANAGER +# exec /etc/X11/xinit/xinitrc + +[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup +[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources +xsetroot -solid grey +#xset s 0 +vncconfig -iconic & +#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & +#x-window-manager & +#jackd -R -dalsa -r44100 -p2048 -n4 -D -Chw:0,1 -Phw:0,1 -S & +startfluxbox & + diff --git a/etc/default/jackd b/etc/default/jackd deleted file mode 100644 index 1d05842..0000000 --- a/etc/default/jackd +++ /dev/null @@ -1,9 +0,0 @@ -# Set to "yes" to start jackd at boot -START_DAEMON=yes - -# The jackd process will run under this user -USER=telecaster - -# Options to pass to jackd -OPTIONS="-dalsa -r48000 -p1024 -n3 -Chw:3 -Phw:3" - diff --git a/etc/default/telecaster b/etc/default/telecaster deleted file mode 100644 index 1309100..0000000 --- a/etc/default/telecaster +++ /dev/null @@ -1,12 +0,0 @@ -# Set to "yes" to start vncserver at boot -START_DAEMON=yes - -# The vncserver process will run under this user -USER=telecaster - -# The vncserver port (i.e. 2 for 5902) -PORT="2" - -# Options to pass to vncserver -OPTIONS="-geometry 1024x768 -depth 8" - diff --git a/etc/nginx/sites-available/telecaster.conf b/etc/nginx/sites-available/telecaster.conf index d0e107d..e8592ed 100644 --- a/etc/nginx/sites-available/telecaster.conf +++ b/etc/nginx/sites-available/telecaster.conf @@ -8,7 +8,7 @@ server { # the port your site will be served on listen 80; # the domain name it will serve for - server_name telecasting.parisson.com; # substitute your machine's IP address or FQDN + server_name _; # substitute your machine's IP address or FQDN charset utf-8; # max upload size diff --git a/etc/telecaster/telecaster.conf b/etc/telecaster/telecaster.conf index 911a572..90044b2 100755 --- a/etc/telecaster/telecaster.conf +++ b/etc/telecaster/telecaster.conf @@ -33,3 +33,6 @@ AUDIO_MP3_QUALITY=4.0 AUDIO_GAIN=12.0 JACK_OPTIONS="-dalsa -r48000 -p1024 -n3 -Chw:3 -Phw:3" + +DEEFUZZER_AUDIO_CONF="/etc/telecaster/deefuzzer/telecaster_mp3_monitor.yaml" +DEEFUZZER_VIDEO_CONF="/etc/telecaster/deefuzzer/telecaster_webm_monitor.yaml" diff --git a/media/mp3/silence.mp3 b/media/mp3/silence.mp3 new file mode 100644 index 0000000..17538c9 Binary files /dev/null and b/media/mp3/silence.mp3 differ diff --git a/media/ogg/silence.ogg b/media/ogg/silence.ogg new file mode 100644 index 0000000..5cfaddf Binary files /dev/null and b/media/ogg/silence.ogg differ diff --git a/src/home/telecaster/.fluxbox/autostart.sh b/src/home/telecaster/.fluxbox/autostart.sh deleted file mode 100755 index 24e92a3..0000000 --- a/src/home/telecaster/.fluxbox/autostart.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# --------------------- -# Audio channel -# --------------------- - -qjackctl & - -/home/telecaster/.fluxbox/scripts/tc_audio_mp3_icecast-gst1.sh & - -/home/telecaster/.fluxbox/scripts/tc_video_simple_webm_stream-gst1.sh & - -sleep 8 - -#Audio monitor -deefuzzer /etc/telecaster/deefuzzer/telecaster_mp3_monitor.yaml & - -#Video monitor -deefuzzer /etc/telecaster/deefuzzer/telecaster_webm_monitor.yaml & - -#sleep 3 - -#Wathdog for trash -#/home/telecaster/.fluxbox/scripts/monitor_check.py 10 /home/telecaster/trash/webm/ smtp.icp.fr informatique@icp.fr alerts@parisson.com & - diff --git a/src/home/telecaster/.fluxbox/init b/src/home/telecaster/.fluxbox/init deleted file mode 100644 index a47c424..0000000 --- a/src/home/telecaster/.fluxbox/init +++ /dev/null @@ -1,3 +0,0 @@ -session.menuFile: ~/.fluxbox/menu -session.keyFile: ~/.fluxbox/keys -session.configVersion: 13 diff --git a/src/home/telecaster/.fluxbox/init.ubuntu b/src/home/telecaster/.fluxbox/init.ubuntu deleted file mode 100644 index 86638e4..0000000 --- a/src/home/telecaster/.fluxbox/init.ubuntu +++ /dev/null @@ -1,4 +0,0 @@ -session.menuFile: ~/.fluxbox/menu -session.keyFile: ~/.fluxbox/keys -session.configVersion: 11 - diff --git a/src/home/telecaster/.fluxbox/scripts/launch-pa-virtual-mic.sh b/src/home/telecaster/.fluxbox/scripts/launch-pa-virtual-mic.sh deleted file mode 100755 index b515c3b..0000000 --- a/src/home/telecaster/.fluxbox/scripts/launch-pa-virtual-mic.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# https://unix.stackexchange.com/questions/576785/redirecting-pulseaudio-sink-to-a-virtual-source - -pactl load-module module-null-sink sink_name=mix-for-virtual-mic \ -sink_properties=device.description=Mix-for-Virtual-Microphone - -pactl load-module module-null-sink sink_name=silence \ -sink_properties=device.description=silent-sink-for-echo-cancel - -pactl load-module module-echo-cancel \ -sink_name=virtual-microphone source_name=virtual-microphone \ -source_master=mix-for-virtual-mic.monitor sink_master=silence aec_method=null \ -source_properties=device.description=Virtual-Microphone \ -sink_properties=device.description=Virtual-Microphone - diff --git a/src/home/telecaster/.fluxbox/scripts/launch-url2video.sh b/src/home/telecaster/.fluxbox/scripts/launch-url2video.sh deleted file mode 100755 index 212228c..0000000 --- a/src/home/telecaster/.fluxbox/scripts/launch-url2video.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -URL=https://e-learning.crfpa.pre-barreau.com/media/Pre-Barreau/CRFPA/2021/Libertes_-_Cours/3cf774cb990d9987/crfpa-libertes-cours-09_16_21-09:45:47.mp4 - -VIDEO_SINK_NAME="/dev/video12" -AUDIO_SINK_NAME="mix-for-virtual-mic" - -gst-launch-1.0 uridecodebin uri="$URL" name=uridec do-timestamp=true live=true \ - ! videoconvert \ - ! v4l2sink device=$VIDEO_SINK_NAME sync=true \ - uridec. \ - ! queue \ - ! audioconvert \ - ! pulsesink device=$AUDIO_SINK_NAME sync=true diff --git a/src/home/telecaster/.fluxbox/scripts/launch-v4l2loopback.sh b/src/home/telecaster/.fluxbox/scripts/launch-v4l2loopback.sh deleted file mode 100755 index a5061dc..0000000 --- a/src/home/telecaster/.fluxbox/scripts/launch-v4l2loopback.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -sudo modprobe v4l2loopback devices=1 video_nr=12 card_label="virtual webcam" exclusive_caps=1 max_buffers=2 diff --git a/src/home/telecaster/.fluxbox/scripts/monitor_check.py b/src/home/telecaster/.fluxbox/scripts/monitor_check.py deleted file mode 100755 index b78f7b6..0000000 --- a/src/home/telecaster/.fluxbox/scripts/monitor_check.py +++ /dev/null @@ -1,75 +0,0 @@ -import sys, time, logging, socket, datetime -from threading import Thread -from logging.handlers import SMTPHandler - -from watchdog.observers import Observer -from watchdog.events import * - - -IGNORE_PATTERNS = ['*.git/*', '*.swp', '*.swpx', '*~', '*.tmp',] -HOSTNAME = socket.gethostname() -LOG_MAX_PERIOD = 300 - -class EmailLogger(object): - """An email logging class""" - - def __init__(self, mailhost, fromaddr, toaddrs, subject): - self.logger = logging.getLogger('telecaster') - self.hdlr = SMTPHandler(mailhost, fromaddr, toaddrs, subject) - self.formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') - self.hdlr.setFormatter(self.formatter) - self.logger.addHandler(self.hdlr) - self.logger.setLevel(logging.INFO) - - -class ActivityEventHandler(PatternMatchingEventHandler): - - activity = True - - def on_modified(self, event): - super(ActivityEventHandler, self).on_modified(event) - self.activity = True - - -class ActivityCheck(Thread): - - def __init__(self, period, path, mailhost, fromaddr, toaddrs): - Thread.__init__(self) - self.period = int(period) - self.path = path - self.activity = False - self.last_time = datetime.datetime.now() - self.message_sent = False - self.subject = 'WARNING : ' + HOSTNAME + ' : ' + 'telecaster monitor activity' - self.logger = EmailLogger(mailhost, fromaddr, toaddrs, self.subject) - self.event_handler = ActivityEventHandler(ignore_patterns=IGNORE_PATTERNS) - self.observer = Observer() - self.observer.schedule(self.event_handler, path, recursive=True) - self.observer.start() - - def run(self): - while True: - if not self.event_handler.activity: - now = datetime.datetime.now() - delta = now - self.last_time - if delta.total_seconds() > LOG_MAX_PERIOD or not self.message_sent: - self.logger.logger.error('The monitor is NOT recording anymore in ' + self.path + ' ! ') - self.last_time = now - self.message_sent = True - else: - self.event_handler.activity = False - time.sleep(self.period) - - def stop(self): - self.observer.stop() - - -if __name__ == "__main__": - period = sys.argv[1] - path = sys.argv[2] - mailhost = sys.argv[3] - fromaddr = sys.argv[4] - toaddrs = sys.argv[5].split(',') - check = ActivityCheck(period, path, mailhost, fromaddr, toaddrs) - check.start() - check.join() diff --git a/src/home/telecaster/.fluxbox/scripts/tc_audio_jack_test.sh b/src/home/telecaster/.fluxbox/scripts/tc_audio_jack_test.sh deleted file mode 100755 index 88f5ac0..0000000 --- a/src/home/telecaster/.fluxbox/scripts/tc_audio_jack_test.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# Audio -AUDIO_CHANNELS=2 -AUDIO_OPUS_BITRATE=96000 -AUDIO_MP3_QUALITY=4.0 - -LOCAL_DIR=$(dirname "$0") -if [ -f $LOCAL_DIR/.env ]; then - source $LOCAL_DIR/.env -fi - -# GST launch -gst-launch-1.0 filesrc location=~/Sounds/Test/test_raw_voice_haik.wav \ - ! queue ! decodebin \ - ! queue ! audioconvert \ - ! queue ! audiocheblimit mode=high-pass cutoff=125 poles=4 \ - ! queue ! volume volume=2.5 \ - ! queue ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.125 ratio=0.125 \ - ! queue ! volume volume=1.5 \ - ! queue ! audiodynamic characteristics=hard-knee mode=compressor threshold=0.95 ratio=0.001 \ - ! queue ! pulsesink - diff --git a/src/home/telecaster/.fluxbox/scripts/tc_audio_mp3_icecast-gst1.sh b/src/home/telecaster/.fluxbox/scripts/tc_audio_mp3_icecast-gst1.sh deleted file mode 100755 index 6ca87d6..0000000 --- a/src/home/telecaster/.fluxbox/scripts/tc_audio_mp3_icecast-gst1.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# Audio -AUDIO_CHANNELS=2 -AUDIO_OPUS_BITRATE=96000 -AUDIO_MP3_QUALITY=4.0 -AUDIO_GAIN_PRE=2.5 -AUDIO_GAIN_POST=1.5 - -source /etc/telecaster/telecaster.conf - -# GST launch -gst-launch-1.0 jackaudiosrc connect=2 ! audio/x-raw, format=F32LE, channels=$AUDIO_CHANNELS \ - ! queue ! audiocheblimit mode=high-pass cutoff=120 poles=4 \ - ! queue ! volume volume=$AUDIO_GAIN_PRE \ - ! queue ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.125 ratio=0.125 \ - ! queue ! volume volume=$AUDIO_GAIN_POST \ - ! queue ! audiodynamic characteristics=hard-knee mode=compressor threshold=0.95 ratio=0.001 \ - ! queue ! audioconvert \ - ! queue ! lamemp3enc quality=$AUDIO_MP3_QUALITY \ - ! queue ! shout2send ip=127.0.0.1 port=8000 password=source2parisson mount=telecaster_live.mp3 - > /dev/null - diff --git a/src/home/telecaster/.fluxbox/scripts/tc_audio_mp3_icecast.sh b/src/home/telecaster/.fluxbox/scripts/tc_audio_mp3_icecast.sh deleted file mode 100755 index b80c57f..0000000 --- a/src/home/telecaster/.fluxbox/scripts/tc_audio_mp3_icecast.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -gst-launch jackaudiosrc connect=1 ! audio/x-raw-float, channels=1 \ - ! queue ! audioconvert ! queue ! lamemp3enc quality=4.0 \ - ! queue ! shout2send ip=127.0.0.1 port=8000 password=source2parisson mount=telecaster_live.mp3 - > /dev/null diff --git a/src/home/telecaster/.fluxbox/scripts/tc_jackd.sh b/src/home/telecaster/.fluxbox/scripts/tc_jackd.sh deleted file mode 100755 index 5718236..0000000 --- a/src/home/telecaster/.fluxbox/scripts/tc_jackd.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -e - -source /etc/telecaster/telecaster.conf - -jackd $JACK_OPTIONS - diff --git a/src/home/telecaster/.fluxbox/scripts/tc_video_simple_webm_stream-gst1-flip180.sh b/src/home/telecaster/.fluxbox/scripts/tc_video_simple_webm_stream-gst1-flip180.sh deleted file mode 100755 index dacfcd3..0000000 --- a/src/home/telecaster/.fluxbox/scripts/tc_video_simple_webm_stream-gst1-flip180.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -# Start TeleCaster video channel - -#WIDTH=640 -#HEIGHT=360 -WIDTH=864 -HEIGHT=480 -#WIDTH=1280 -#HEIGHT=720 -FRAMERATE=24 - -v4l2-ctl -d 0 -c power_line_frequency=1 -v4l2-ctl -d 0 -c zoom_absolute=135 -v4l2-ctl -d 0 -c focus_auto=0 -v4l2-ctl -d 0 -c focus_absolute=1 -v4l2-ctl -d 0 -c sharpness=100 - -# ! queue ! videoflip method=rotate-180 \ - -gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, format=YUY2, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE/1 \ - ! queue ! videoflip method=rotate-180 \ - ! queue ! videoconvert \ - ! queue ! vp8enc threads=4 deadline=2 \ - ! queue ! muxout. \ - jackaudiosrc connect=1 ! audio/x-raw, format=F32LE, channels=1 \ - ! queue ! audiocheblimit mode=high-pass cutoff=120 poles=4 \ - ! queue ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.16 ratio=0.15 \ - ! queue ! rgvolume pre-amp=6.0 headroom=1.0 \ - ! queue ! rglimiter \ - ! queue ! audioconvert \ - ! queue ! opusenc bitrate=96000 \ - ! queue ! muxout. \ - webmmux streamable=true name=muxout \ - ! queue ! tcpserversink host=127.0.0.1 port=9000 blocksize=65536 sync-method=1 \ - > /dev/null diff --git a/src/home/telecaster/.fluxbox/scripts/tc_video_simple_webm_stream-gst1.sh b/src/home/telecaster/.fluxbox/scripts/tc_video_simple_webm_stream-gst1.sh deleted file mode 100755 index 85c1a8d..0000000 --- a/src/home/telecaster/.fluxbox/scripts/tc_video_simple_webm_stream-gst1.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# Default TeleCaster video parameters - -# v4l2 -V4L2_ID=0 -V4L2_ZOOM=140 -V4L2_SHARPNESS=128 - -# C920 -#VIDEO_WIDTH=864 -#VIDEO_HEIGHT=480 -#VIDEO_FRAMERATE=24 - -# C922 -VIDEO_WIDTH=864 -VIDEO_HEIGHT=480 -VIDEO_FRAMERATE=24 -VIDEO_FLIP=none - -# Audio -AUDIO_CHANNELS=2 -AUDIO_OPUS_BITRATE=96000 -AUDIO_GAIN_PRE=2.5 -AUDIO_GAIN_POST=1.5 - -source /etc/telecaster/telecaster.conf - -# V4L2 setup -v4l2-ctl -d $V4L2_ID -c power_line_frequency=1 -v4l2-ctl -d $V4L2_ID -c zoom_absolute=$V4L2_ZOOM -v4l2-ctl -d $V4L2_ID -c focus_auto=0 -v4l2-ctl -d $V4L2_ID -c focus_absolute=1 -v4l2-ctl -d $V4L2_ID -c sharpness=$V4L2_SHARPNESS - -# GST launch -gst-launch-1.0 v4l2src device=/dev/video$V4L2_ID ! video/x-raw, format=YUY2, width=$VIDEO_WIDTH, height=$VIDEO_HEIGHT, framerate=$VIDEO_FRAMERATE/1 \ - ! queue ! videoflip method=$VIDEO_FLIP \ - ! queue ! videoconvert \ - ! queue ! vp8enc threads=4 deadline=2 \ - ! queue ! muxout. \ - jackaudiosrc connect=2 ! audio/x-raw, format=F32LE, channels=$AUDIO_CHANNELS \ - ! queue ! audiocheblimit mode=high-pass cutoff=120 poles=4 \ - ! queue ! volume volume=$AUDIO_GAIN_PRE \ - ! queue ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.125 ratio=0.125 \ - ! queue ! volume volume=$AUDIO_GAIN_POST \ - ! queue ! audiodynamic characteristics=hard-knee mode=compressor threshold=0.95 ratio=0.001 \ - ! queue ! audioconvert \ - ! queue ! opusenc bitrate=$AUDIO_OPUS_BITRATE \ - ! queue ! muxout. \ - webmmux streamable=true name=muxout \ - ! queue ! shout2send ip=127.0.0.1 port=8000 password=source2parisson mount=telecaster_live.webm - > /dev/null diff --git a/src/home/telecaster/.fluxbox/scripts/tc_video_simple_webm_stream.sh b/src/home/telecaster/.fluxbox/scripts/tc_video_simple_webm_stream.sh deleted file mode 100755 index 8a035e8..0000000 --- a/src/home/telecaster/.fluxbox/scripts/tc_video_simple_webm_stream.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# Start TeleCaster video channel - -#WIDTH=640 -#HEIGHT=360 -WIDTH=864 -HEIGHT=480 -#WIDTH=1280 -#HEIGHT=720 - -v4l2-ctl -d 0 -c power_line_frequency=1 -v4l2-ctl -d 0 -c zoom_absolute=100 -v4l2-ctl -d 0 -c focus_auto=0 -v4l2-ctl -d 0 -c focus_absolute=1 - -# ! queue ! videoflip method=rotate-180 \ - -gst-launch v4l2src device=/dev/video0 ! video/x-raw-rgb, width=$WIDTH, height=$HEIGHT, framerate={30/1} \ - ! queue ! ffmpegcolorspace \ - ! queue ! vp8enc speed=2 threads=4 quality=10.0 max-latency=25 max-keyframe-distance=30 auto-alt-ref-frames=true ! queue ! muxout. \ - jackaudiosrc connect=2 ! audio/x-raw-float, channels=2 \ - ! queue ! audioconvert ! queue ! vorbisenc quality=0.4 ! queue ! muxout. \ - webmmux streamable=true name=muxout \ - ! queue ! tcpserversink host=127.0.0.1 port=9000 protocol=none blocksize=65536 sync-method=1 \ - > /dev/null diff --git a/src/home/telecaster/.fluxbox/scripts/telecaster-restart-full b/src/home/telecaster/.fluxbox/scripts/telecaster-restart-full deleted file mode 100755 index 8e71444..0000000 --- a/src/home/telecaster/.fluxbox/scripts/telecaster-restart-full +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -sudo /etc/init.d/telecaster stop -sudo /etc/init.d/jackd stop - -sleep 3 - -sudo /etc/init.d/jackd start -sudo /etc/init.d/telecaster start diff --git a/src/home/telecaster/.fluxbox/startup b/src/home/telecaster/.fluxbox/startup deleted file mode 100644 index 9ac6941..0000000 --- a/src/home/telecaster/.fluxbox/startup +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh -# -# fluxbox startup-script: -# -# Lines starting with a '#' are ignored. - -# Change your keymap: -xmodmap "/home/telecaster/.Xmodmap" - -# Applications you want to run with fluxbox. -# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END. -# -# unclutter -idle 2 & -# wmnd & -# wmsmixer -w & -# idesk & -# -# Debian-local change: -# - fbautostart has been added with a quick hack to check to see if it -# exists. If it does, we'll start it up by default. -which fbautostart > /dev/null -if [ $? -eq 0 ]; then - fbautostart -fi - -FLUXBOX_DIR=/home/telecaster/.fluxbox - -# jackd - -$FLUXBOX_DIR/scripts/tc_jackd.sh & - -sleep 2 - -# telecaster - -konsole & - -qjackctl & - -sleep 1 - -$FLUXBOX_DIR/scripts/tc_audio_mp3_icecast-gst1.sh & - -sleep 1 - -$FLUXBOX_DIR/scripts/tc_video_simple_webm_stream-gst1.sh & - -sleep 1 - -# STEREO setup -# 1: L -# 2: R - -#jack_disconnect system:capture_1 gst-launch-1.0:in_jackaudiosrc0_1 -#jack_disconnect system:capture_2 gst-launch-1.0:in_jackaudiosrc0_2 - -#jack_disconnect system:capture_1 gst-launch-1.0-01:in_jackaudiosrc0_1 -#jack_disconnect system:capture_2 gst-launch-1.0-01:in_jackaudiosrc0_2 - -#jack_connect system:capture_1 gst-launch-1.0:in_jackaudiosrc0_1 -#jack_connect system:capture_2 gst-launch-1.0:in_jackaudiosrc0_2 - -# ADDITIONAL mics -# 3: C - -# jack_connect system:capture_3 gst-launch-1.0:in_jackaudiosrc0_1 -# jack_connect system:capture_3 gst-launch-1.0:in_jackaudiosrc0_2 - -# jack_connect system:capture_3 gst-launch-1.0-01:in_jackaudiosrc0_1 -# jack_connect system:capture_3 gst-launch-1.0-01:in_jackaudiosrc0_2 - -# Additional local bash scripts -if [ -f $FLUXBOX_DIR/startup.local ]; then - sh $FLUXBOX_DIR/startup.local -fi - -#Audio monitor -deefuzzer /etc/telecaster/deefuzzer/telecaster_mp3_monitor.yaml & - -#Video monitor -deefuzzer /etc/telecaster/deefuzzer/telecaster_webm_monitor.yaml & - - -# And last but not least we start fluxbox. -# Because it is the last app you have to run it with ''exec'' before it. - -exec fluxbox -# or if you want to keep a log: -# exec fluxbox -log "$$FLUXBOX_DIR/log" diff --git a/src/home/telecaster/.fluxbox/startup.ubuntu b/src/home/telecaster/.fluxbox/startup.ubuntu deleted file mode 100644 index af2145a..0000000 --- a/src/home/telecaster/.fluxbox/startup.ubuntu +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# -# fluxbox startup-script: -# -# Lines starting with a '#' are ignored. - -# Change your keymap: -xmodmap "/home/telecaster/.Xmodmap" - -# Applications you want to run with fluxbox. -# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END. -# -# unclutter -idle 2 & -# wmnd & -# wmsmixer -w & -# idesk & - -# And last but not least we start fluxbox. -# Because it is the last app you have to run it with ''exec'' before it. - -fluxbox & -# or if you want to keep a log: -# exec fluxbox -log "/home/telecaster/.fluxbox/log" - -fbpid=$! - -sleep 1 - -{ - -sh ~/.fluxbox/autostart.sh - -} & - -wait $fbpid diff --git a/src/home/telecaster/.vnc/xstartup b/src/home/telecaster/.vnc/xstartup deleted file mode 100755 index ce84087..0000000 --- a/src/home/telecaster/.vnc/xstartup +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# Uncomment the following two lines for normal desktop: -# unset SESSION_MANAGER -# exec /etc/X11/xinit/xinitrc - -[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup -[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources -xsetroot -solid grey -#xset s 0 -vncconfig -iconic & -#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & -#x-window-manager & -#jackd -R -dalsa -r44100 -p2048 -n4 -D -Chw:0,1 -Phw:0,1 -S & -startfluxbox & - diff --git a/src/home/telecaster/bin/backup_nile.sh b/src/home/telecaster/bin/backup_nile.sh deleted file mode 100755 index 44b8b1e..0000000 --- a/src/home/telecaster/bin/backup_nile.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -rsync -aq /home/telecaster/archives/Pre-Barreau/ /mnt/nile/Pre-Barreau/ -rsync -aq /home/telecaster/kdenlive/ /mnt/nile/Pre-Barreau/Pro-Barreau/kdenlive/ diff --git a/src/home/telecaster/bin/py/create_thumbs.py b/src/home/telecaster/bin/py/create_thumbs.py deleted file mode 100644 index dc3fd20..0000000 --- a/src/home/telecaster/bin/py/create_thumbs.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/python - -import os, sys, string -import logging - -class Logger: - """A logging object""" - - def __init__(self, file): - self.logger = logging.getLogger('myapp') - self.hdlr = logging.FileHandler(file) - self.formatter = logging.Formatter('%(message)s') - self.hdlr.setFormatter(self.formatter) - self.logger.addHandler(self.hdlr) - self.logger.setLevel(logging.INFO) - -log_file = 'thumbs.log' -logger = Logger(log_file) -root_dir = sys.argv[-1] -args = sys.argv[1:-1] -source_format = 'webm' -done = [] -preview_tc = '00:00:05' - -if os.path.exists(log_file): - f = open(log_file, 'r') - for line in f.readlines(): - done.append(line[:-1]) - f.close() - -for root, dirs, files in os.walk(root_dir): - for file in files: - path = os.path.abspath(root + os.sep + file) - name, ext = os.path.splitext(file) - if ext[1:] == source_format: - dest = os.path.abspath(root + os.sep + name + '.png') - if not dest in done or '--force' in args: - command = 'ffmpeg -ss '+ preview_tc + ' -i ' + path + ' -y ' + dest - os.system(command) - logger.logger.info(dest) - -print "DONE!" diff --git a/src/home/telecaster/bin/py/remux_fix_media.py b/src/home/telecaster/bin/py/remux_fix_media.py deleted file mode 100644 index 895fc93..0000000 --- a/src/home/telecaster/bin/py/remux_fix_media.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/python - -import os, sys, psutil -import datetime -from ebml.utils.ebml_data import * - -class FixCheckMedia(object): - - def __init__(self, dir, tmp_dir): - self.dir = dir - self.tmp_dir = tmp_dir - if not os.path.exists(self.tmp_dir): - os.makedirs(self.tmp_dir) - - def process(self): - webm_fixed_log = 'webm.fixed' - webm_tofix_log = 'webm.tofix' - mp3_fixed_log = 'mp3.fixed' - mp3_tofix_log = 'mp3.tofix' - - for root, dirs, files in os.walk(self.dir): - for filename in files: - source = root + os.sep + filename - name = os.path.splitext(filename)[0] - ext = os.path.splitext(filename)[1][1:] - - if (ext == 'webm' or ext == 'mp4') and os.path.getsize(source): - dir_files = os.listdir(root) - - if not webm_fixed_log in dir_files: - print(source) - self.fix_webm(source) - f = open(root + os.sep + webm_fixed_log, 'w') - f.close() - if os.path.exists(root + os.sep + webm_tofix_log): - os.remove(root + os.sep + webm_tofix_log) - - if mp3_tofix_log in dir_files or not mp3_fixed_log in dir_files: - for file in dir_files: - dest_ext = os.path.splitext(file)[1][1:] - if dest_ext == 'mp3': - dest = root + os.sep + file - print(dest) - self.fix_mp3(source, dest) - f = open(root + os.sep + mp3_fixed_log, 'w') - f.close() - if os.path.exists(root + os.sep + mp3_tofix_log): - os.remove(root + os.sep + mp3_tofix_log) - #break - - - def hard_fix_webm(self, path): - try: - tmp_file = self.tmp_dir + 'out.webm ' - command = 'ffmpeg -loglevel 0 -i "'+ path + '" -vcodec libvpx -vb 1500k -acodec libvorbis -aq 7 -f webm -y "' + tmp_file + '" > /dev/null' - print(command) - os.system(command) - command = 'mv ' + tmp_file + path - os.system(command) - except: - pass - - - def fix_webm(self, path): - try: - tmp_file = self.tmp_dir + 'out.webm' - command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" -vcodec copy -acodec copy -f webm -y "' + tmp_file + '" > /dev/null' - print(command) - os.system(command) - #ebml_obj = EBMLData(tmp_file) - #offset = ebml_obj.get_first_cluster_seconds() - command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + tmp_file + '" -vcodec copy -acodec copy -f webm -y "' + path + '" > /dev/null' - print(command) - os.system(command) - except: - pass - - def fix_mp3(self, source, path): - try: - command = '/usr/local/bin/ffmpeg -loglevel 0 -i "'+ source + '" -vn -aq 6 -y "' + path + '" > /dev/null' - print(command) - os.system(command) - except: - pass - -def get_pids(name, args=None): - """Get a process pid filtered by arguments and uid""" - pids = [] - for proc in psutil.process_iter(): - if proc.cmdline: - if name == proc.name: - if args: - if args in proc.cmdline: - pids.append(proc.pid) - else: - pids.append(proc.pid) - return pids - -dir = sys.argv[-2] -tmp_dir = sys.argv[-1] - -path = os.path.abspath(__file__) -pids = get_pids('python2.6',args=path) - -print(datetime.datetime.now()) -if len(pids) <= 1: - print('starting process...') - f = FixCheckMedia(dir, tmp_dir) - f.process() - print('process finished.\n') -else: - print('already started !\n') - diff --git a/src/home/telecaster/bin/py/transcode-pro.py b/src/home/telecaster/bin/py/transcode-pro.py deleted file mode 100644 index d353af7..0000000 --- a/src/home/telecaster/bin/py/transcode-pro.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/python - -import os, sys, string -import logging -import datetime - - -class Logger: - """A logging object""" - - def __init__(self, file): - self.logger = logging.getLogger('myapp') - self.hdlr = logging.FileHandler(file) - self.formatter = logging.Formatter('%(asctime)s %(message)s') - self.hdlr.setFormatter(self.formatter) - self.logger.addHandler(self.hdlr) - self.logger.setLevel(logging.INFO) - - -class TelemetaTranscode(object): - """docstring for TelemetaTranscode""" - - source_formats = ['mp4',] - dest_formats = { - 'mp3' : '-vn -acodec libmp3lame -aq 6', - 'png' : '-ss 0:1:0', - } - - date_limit = datetime.datetime(year=2021, month=6, day=24) - - def __init__(self, args): - self.args = args - self.log_file = args[-1] - self.root_dir = args[-2] - self.logger = Logger(self.log_file) - - def get_ext_in_dir(self, extension, root): - files = os.listdir(root) - exts = [] - for f in files: - name, ext = os.path.splitext(f) - ext = ext[1:] - if not ext in exts: - exts.append(ext) - return extension in exts - - def run(self): - for root, dirs, files in os.walk(self.root_dir): - for file in files: - path = os.path.abspath(root + os.sep + file) - name, ext = os.path.splitext(file) - ext = ext[1:] - date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(path)) - if ext in self.source_formats and date_dir > self.date_limit: - for format, ffmpeg_args in self.dest_formats.items(): - local_file = name + '.' + format - dest = os.path.abspath(root + os.sep + local_file) - local_files = os.listdir(root) - if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: - if ext == 'webm' and format == 'ogg': - ffmpeg_args = '-vn -acodec copy' - if format == 'png': - command = '/usr/local/bin/ffmpeg -loglevel 0 ' + ffmpeg_args + ' -i "' + path + '" -frames:v 1 -y "' + dest + '"' - else: - command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' - self.logger.logger.info(command) - if not '--dry-run' in self.args: - os.system(command) - print(command) - - -if __name__ == '__main__': - t = TelemetaTranscode(sys.argv[1:]) - t.run() diff --git a/src/home/telecaster/bin/py/transcode-vaapi.py b/src/home/telecaster/bin/py/transcode-vaapi.py deleted file mode 100644 index 8a03205..0000000 --- a/src/home/telecaster/bin/py/transcode-vaapi.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/python - -import os, sys, string -import logging -import datetime - - -class Logger: - """A logging object""" - - def __init__(self, file): - self.logger = logging.getLogger('myapp') - self.hdlr = logging.FileHandler(file) - self.formatter = logging.Formatter('%(asctime)s %(message)s') - self.hdlr.setFormatter(self.formatter) - self.logger.addHandler(self.hdlr) - self.logger.setLevel(logging.INFO) - - -class Transcode(object): - """docstring for Transcode""" - - source_formats = ['MOV',] - output_formats = { - 'mp4-hevc' : - {"ext": "mp4", - "opt_in": "-hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi", - "opt_out": "-vf 'scale_vaapi=format=p010' -c:v hevc_vaapi -profile 2 -b:v 15M", - } - } - - def __init__(self, args): - self.args = args - self.input_dir = args[-3] - self.output_dir = args[-2] - self.log_file = args[-1] - self.logger = Logger(self.log_file) - - def get_ext_in_dir(self, extension, root): - files = os.listdir(root) - exts = [] - for f in files: - name, ext = os.path.splitext(f) - ext = ext[1:] - if not ext in exts: - exts.append(ext) - return extension in exts - - def run(self): - for root, dirs, files in os.walk(self.input_dir): - for file in files: - input_path = os.path.abspath(root + os.sep + file) - name, ext = os.path.splitext(file) - ext = ext[1:] - if ext in self.source_formats: - for output_format in self.output_formats: - output_format = self.output_formats[output_format] - output_dir = root.replace(self.input_dir, self.output_dir) - if not os.path.exists(output_dir): - os.makedirs(output_dir) - output_file = name + '.' + output_format["ext"] - output_path = os.path.abspath(output_dir + os.sep + output_file) - local_files = os.listdir(output_dir) - print(output_path) - if not (output_file in local_files or self.get_ext_in_dir(output_format["ext"], root)) or '--force' in self.args: - command = 'ffmpeg ' + output_format['opt_in'] + ' -i "' + input_path + '" ' + \ - output_format['opt_out'] + ' -y "' + output_path + '"' - self.logger.logger.info(command) - if not '--dry-run' in self.args: - os.system(command) - print(command) - - -if __name__ == '__main__': - t = Transcode(sys.argv[1:]) - t.run() diff --git a/src/home/telecaster/bin/py/transcode.py b/src/home/telecaster/bin/py/transcode.py deleted file mode 100644 index 336802e..0000000 --- a/src/home/telecaster/bin/py/transcode.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/python - -import os, sys, string -import logging -import datetime - - -class Logger: - """A logging object""" - - def __init__(self, file): - self.logger = logging.getLogger('myapp') - self.hdlr = logging.FileHandler(file) - self.formatter = logging.Formatter('%(asctime)s %(message)s') - self.hdlr.setFormatter(self.formatter) - self.logger.addHandler(self.hdlr) - self.logger.setLevel(logging.INFO) - - -class TelemetaTranscode(object): - """docstring for TelemetaTranscode""" - - source_formats = ['webm',] - dest_formats = { - 'mp3' : '-vn -acodec libmp3lame -aq 6', - 'mp4' : '-c:v libx264 -maxrate 1100k -c:a aac -b:a 128k', - 'png' : '-ss 0:5:0', - } - - date_limit = datetime.datetime(year=2023, month=10, day=21) - - def __init__(self, args): - self.args = args - self.log_file = args[-1] - self.root_dir = args[-2] - self.logger = Logger(self.log_file) - - def get_ext_in_dir(self, extension, root): - files = os.listdir(root) - exts = [] - for f in files: - name, ext = os.path.splitext(f) - ext = ext[1:] - if not ext in exts: - exts.append(ext) - return extension in exts - - def run(self): - for root, dirs, files in os.walk(self.root_dir): - for file in files: - path = os.path.abspath(root + os.sep + file) - name, ext = os.path.splitext(file) - ext = ext[1:] - date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(path)) - if ext in self.source_formats and date_dir > self.date_limit: - for format, ffmpeg_args in self.dest_formats.items(): - local_file = name + '.' + format - dest = os.path.abspath(root + os.sep + local_file) - local_files = os.listdir(root) - if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: - if ext == 'webm' and format == 'ogg': - ffmpeg_args = '-vn -acodec copy' - if format == 'png': - command = '/usr/local/bin/ffmpeg -loglevel 0 ' + ffmpeg_args + ' -i "' + path + '" -frames:v 1 -y "' + dest + '"' - else: - command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' - self.logger.logger.info(command) - if not '--dry-run' in self.args: - os.system(command) - print(command) - - -if __name__ == '__main__': - t = TelemetaTranscode(sys.argv[1:]) - t.run() diff --git a/src/home/telecaster/bin/py/transcode_nonv.py b/src/home/telecaster/bin/py/transcode_nonv.py deleted file mode 100644 index ec450a3..0000000 --- a/src/home/telecaster/bin/py/transcode_nonv.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/python - -import os, sys, string -import logging -import datetime - - -class Logger: - """A logging object""" - - def __init__(self, file): - self.logger = logging.getLogger('myapp') - self.hdlr = logging.FileHandler(file) - self.formatter = logging.Formatter('%(asctime)s %(message)s') - self.hdlr.setFormatter(self.formatter) - self.logger.addHandler(self.hdlr) - self.logger.setLevel(logging.INFO) - - -class TelemetaTranscode(object): - """docstring for TelemetaTranscode""" - - source_formats = ['webm',] - - dest_formats = { - 'mp3' : '-vn -acodec libmp3lame -aq 6', - 'mp4' : '-c:v libx264 -crf 17 -maxrate 1100k -bufsize 1835k -c:a aac -b:a 128k', - 'png' : '-ss 0:0:10', - } - - date_limit = datetime.datetime(year=2021, month=6, day=24) - - def __init__(self, args): - self.args = args - self.log_file = args[-1] - self.root_dir = args[-2] - self.logger = Logger(self.log_file) - - def get_ext_in_dir(self, extension, root): - files = os.listdir(root) - exts = [] - for f in files: - name, ext = os.path.splitext(f) - ext = ext[1:] - if not ext in exts: - exts.append(ext) - return extension in exts - - def run(self): - for root, dirs, files in os.walk(self.root_dir): - for file in files: - path = os.path.abspath(root + os.sep + file) - name, ext = os.path.splitext(file) - ext = ext[1:] - date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(path)) - if ext in self.source_formats and date_dir > self.date_limit: - for format, ffmpeg_args in self.dest_formats.items(): - local_file = name + '.' + format - dest = os.path.abspath(root + os.sep + local_file) - local_files = os.listdir(root) - if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: - if ext == 'webm' and format == 'ogg': - ffmpeg_args = '-vn -acodec copy' - if format == 'png': - command = '/usr/local/bin/ffmpeg -loglevel 0 ' + ffmpeg_args + ' -i "' + path + '" -frames:v 1 -y "' + dest + '"' - else: - command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' - self.logger.logger.info(command) - if not '--dry-run' in self.args: - os.system(command) - print(command) - - -if __name__ == '__main__': - t = TelemetaTranscode(sys.argv[1:]) - t.run() diff --git a/src/home/telecaster/bin/py/transcode_nv-pro.py b/src/home/telecaster/bin/py/transcode_nv-pro.py deleted file mode 100644 index 32c16eb..0000000 --- a/src/home/telecaster/bin/py/transcode_nv-pro.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/python - -import os, sys, string -import logging -import datetime - - -class Logger: - """A logging object""" - - def __init__(self, file): - self.logger = logging.getLogger('myapp') - self.hdlr = logging.FileHandler(file) - self.formatter = logging.Formatter('%(asctime)s %(message)s') - self.hdlr.setFormatter(self.formatter) - self.logger.addHandler(self.hdlr) - self.logger.setLevel(logging.INFO) - - -class TelemetaTranscode(object): - """docstring for TelemetaTranscode""" - - source_formats = ['mp4',] - dest_formats = { - 'mp3' : '-vn -acodec libmp3lame -aq 6', - 'png' : '-ss 0:0:10', - } - - date_limit = datetime.datetime(year=2021, month=6, day=24) - - def __init__(self, args): - self.args = args - self.log_file = args[-1] - self.root_dir = args[-2] - self.logger = Logger(self.log_file) - - def get_ext_in_dir(self, extension, root): - files = os.listdir(root) - exts = [] - for f in files: - name, ext = os.path.splitext(f) - ext = ext[1:] - if not ext in exts: - exts.append(ext) - return extension in exts - - def run(self): - for root, dirs, files in os.walk(self.root_dir): - for file in files: - path = os.path.abspath(root + os.sep + file) - name, ext = os.path.splitext(file) - ext = ext[1:] - date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(path)) - if ext in self.source_formats and date_dir > self.date_limit: - for format, ffmpeg_args in self.dest_formats.items(): - local_file = name + '.' + format - dest = os.path.abspath(root + os.sep + local_file) - local_files = os.listdir(root) - if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: - if ext == 'webm' and format == 'ogg': - ffmpeg_args = '-vn -acodec copy' - if format == 'png': - command = '/usr/local/bin/ffmpeg -loglevel 0 ' + ffmpeg_args + ' -i "' + path + '" -frames:v 1 -y "' + dest + '"' - else: - command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' - self.logger.logger.info(command) - if not '--dry-run' in self.args: - os.system(command) - print(command) - - -if __name__ == '__main__': - t = TelemetaTranscode(sys.argv[1:]) - t.run() diff --git a/src/home/telecaster/bin/py/transcode_nv.py b/src/home/telecaster/bin/py/transcode_nv.py deleted file mode 100644 index e55fe29..0000000 --- a/src/home/telecaster/bin/py/transcode_nv.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/python - -import os, sys, string -import logging -import datetime - - -class Logger: - """A logging object""" - - def __init__(self, file): - self.logger = logging.getLogger('myapp') - self.hdlr = logging.FileHandler(file) - self.formatter = logging.Formatter('%(asctime)s %(message)s') - self.hdlr.setFormatter(self.formatter) - self.logger.addHandler(self.hdlr) - self.logger.setLevel(logging.INFO) - - -class TelemetaTranscode(object): - """docstring for TelemetaTranscode""" - - source_formats = ['webm',] - dest_formats = { - 'mp3' : '-vn -acodec libmp3lame -aq 6', - 'mp4' : '-c:v h264_nvenc -maxrate 1100k -c:a aac -b:a 128k', - 'png' : '-ss 0:0:10', - } - - date_limit = datetime.datetime(year=2023, month=10, day=24) - - def __init__(self, args): - self.args = args - self.log_file = args[-1] - self.root_dir = args[-2] - self.logger = Logger(self.log_file) - - def get_ext_in_dir(self, extension, root): - files = os.listdir(root) - exts = [] - for f in files: - name, ext = os.path.splitext(f) - ext = ext[1:] - if not ext in exts: - exts.append(ext) - return extension in exts - - def run(self): - for root, dirs, files in os.walk(self.root_dir): - for file in files: - path = os.path.abspath(root + os.sep + file) - name, ext = os.path.splitext(file) - ext = ext[1:] - date_dir = datetime.datetime.fromtimestamp(os.path.getmtime(path)) - if ext in self.source_formats and date_dir > self.date_limit: - for format, ffmpeg_args in self.dest_formats.items(): - local_file = name + '.' + format - dest = os.path.abspath(root + os.sep + local_file) - local_files = os.listdir(root) - if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: - if ext == 'webm' and format == 'ogg': - ffmpeg_args = '-vn -acodec copy' - if format == 'png': - command = '/usr/local/bin/ffmpeg -loglevel 0 ' + ffmpeg_args + ' -i "' + path + '" -frames:v 1 -y "' + dest + '"' - else: - command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' - self.logger.logger.info(command) - if not '--dry-run' in self.args: - os.system(command) - print(command) - - -if __name__ == '__main__': - t = TelemetaTranscode(sys.argv[1:]) - t.run() diff --git a/src/home/telecaster/bin/py/transcode_old.py.bak b/src/home/telecaster/bin/py/transcode_old.py.bak deleted file mode 100644 index 12719e6..0000000 --- a/src/home/telecaster/bin/py/transcode_old.py.bak +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/python - -import os, sys, string -import logging - - -class Logger: - """A logging object""" - - def __init__(self, file): - self.logger = logging.getLogger('myapp') - self.hdlr = logging.FileHandler(file) - self.formatter = logging.Formatter('%(asctime)s %(message)s') - self.hdlr.setFormatter(self.formatter) - self.logger.addHandler(self.hdlr) - self.logger.setLevel(logging.INFO) - - -class TelemetaTranscode(object): - """docstring for TelemetaTranscode""" - - threads = 4 - source_formats = ['webm', 'mp4'] - dest_formats = { - 'mp3' : '-vn -acodec libmp3lame -aq 6', - 'ogg' : '-vn -acodec libvorbis -aq 6', - 'mp4' : '-vcodec libx264 -threads ' + str(threads) + \ - ' -c:v libx264 -crf 17 -maxrate 1100k -bufsize 1835k -acodec aac -strict -2 -ab 96k', - 'png' : '-ss 0:0:10', - 'webm' : '-vcodec libvpx -threads ' + str(threads) + \ - ' -c:v libvpx -crf 17 -b:v 1100k', - } - - - def __init__(self, args): - self.args = args - self.log_file = args[-1] - self.root_dir = args[-2] - self.logger = Logger(self.log_file) - - - def get_ext_in_dir(self, extension, root): - files = os.listdir(root) - exts = [] - for f in files: - name, ext = os.path.splitext(f) - ext = ext[1:] - if not ext in exts: - exts.append(ext) - return extension in exts - - def run(self): - for root, dirs, files in os.walk(self.root_dir): - for file in files: - path = os.path.abspath(root + os.sep + file) - name, ext = os.path.splitext(file) - ext = ext[1:] - if ext in self.source_formats: - for format, ffmpeg_args in self.dest_formats.iteritems(): - local_file = name + '.' + format - dest = os.path.abspath(root + os.sep + local_file) - local_files = os.listdir(root) - if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: - if ext == 'webm' and format == 'ogg': - ffmpeg_args = '-vn -acodec copy' - command = 'ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' - self.logger.logger.info(command) - if not '--dry-run' in self.args: - os.system(command) - else: - print command - - -if __name__ == '__main__': - t = TelemetaTranscode(sys.argv[1:]) - t.run() diff --git a/src/home/telecaster/bin/py/transcode_pro_old.py b/src/home/telecaster/bin/py/transcode_pro_old.py deleted file mode 100644 index 0b44f54..0000000 --- a/src/home/telecaster/bin/py/transcode_pro_old.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/python - -import os, sys, string -import logging - - -class Logger: - """A logging object""" - - def __init__(self, file): - self.logger = logging.getLogger('myapp') - self.hdlr = logging.FileHandler(file) - self.formatter = logging.Formatter('%(asctime)s %(message)s') - self.hdlr.setFormatter(self.formatter) - self.logger.addHandler(self.hdlr) - self.logger.setLevel(logging.INFO) - - -class TelemetaTranscode(object): - """docstring for TelemetaTranscode""" - - threads = 15 - source_formats = ['mp4'] - dest_formats = { - 'mp3' : '-vn -acodec libmp3lame -aq 6', - 'ogg' : '-vn -acodec libvorbis -aq 6', - 'png' : '-ss 0:0:10', - 'webm' : '-vcodec libvpx -threads ' + str(threads) + \ - ' -c:v libvpx -crf 17 -b:v 1100k', - } - - - def __init__(self, args): - self.args = args - self.log_file = args[-1] - self.root_dir = args[-2] - self.logger = Logger(self.log_file) - - - def get_ext_in_dir(self, extension, root): - files = os.listdir(root) - exts = [] - for f in files: - name, ext = os.path.splitext(f) - ext = ext[1:] - if not ext in exts: - exts.append(ext) - return extension in exts - - def run(self): - for root, dirs, files in os.walk(self.root_dir): - for file in files: - path = os.path.abspath(root + os.sep + file) - name, ext = os.path.splitext(file) - ext = ext[1:] - if ext in self.source_formats: - for format, ffmpeg_args in self.dest_formats.iteritems(): - local_file = name + '.' + format - dest = os.path.abspath(root + os.sep + local_file) - local_files = os.listdir(root) - if not (local_file in local_files or self.get_ext_in_dir(format, root)) or '--force' in self.args: - if ext == 'webm' and format == 'ogg': - ffmpeg_args = '-vn -acodec copy' - command = 'ffmpeg -loglevel 0 -i "' + path + '" ' + ffmpeg_args + ' -y "' + dest + '"' - self.logger.logger.info(command) - if not '--dry-run' in self.args: - os.system(command) - else: - print command - - -if __name__ == '__main__': - t = TelemetaTranscode(sys.argv[1:]) - t.run() diff --git a/src/home/telecaster/bin/remux b/src/home/telecaster/bin/remux deleted file mode 100755 index e4e88a8..0000000 --- a/src/home/telecaster/bin/remux +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -ffmpeg -i $1 -c copy out.webm diff --git a/src/home/telecaster/bin/reverse_ssh_tunnel b/src/home/telecaster/bin/reverse_ssh_tunnel deleted file mode 100755 index cd81fe6..0000000 --- a/src/home/telecaster/bin/reverse_ssh_tunnel +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# ------------------------------ -# autossh reverse tunnel on boot -# ------------------------------ -# See autossh and google for reverse ssh tunnels to see how this works - -# When this script runs it will allow you to ssh into this machine even if it is behind a firewall or has a NAT'd IP address. -# From any ssh capable machine you just type ssh -p $PORT_MIDDLEMAN_WILL_LISTEN_ON localusername@middleman - -# This is the username on your local server who has public key authentication setup at the middleman -USER_TO_SSH_IN_AS=telecaster - -# This is the username and hostname/IP address for the middleman (internet accessible server) -MIDDLEMAN_SERVER_AND_USERNAME=telecaster@jimi.parisson.com - -# The following two numbers can be whatever you want, but need to be unique if you have multiple reverse ssh tunnels -# Port that the middleman will listen on (use this value as the -p argument when sshing) -PORT_MIDDLEMAN_WILL_LISTEN_ON=22012 - -# Connection monitoring port, don't need to know this one -AUTOSSH_PORT=27012 - -# Ensures that autossh keeps trying to connect -AUTOSSH_GATETIME=0 - -export AUTOSSH_PORT AUTOSSH_GATETIME - -su -c "autossh -f -N -R *:${PORT_MIDDLEMAN_WILL_LISTEN_ON}:localhost:22 ${MIDDLEMAN_SERVER_AND_USERNAME} -oLogLevel=error -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no" $USER_TO_SSH_IN_AS - diff --git a/src/home/telecaster/bin/seafile_sync.sh b/src/home/telecaster/bin/seafile_sync.sh deleted file mode 100755 index aece99e..0000000 --- a/src/home/telecaster/bin/seafile_sync.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -seaf-cli start - -seaf-cli sync -l 063a03f2-2947-4f90-b4a1-7d1e34eb62e0 -s http://localhost:9080 -d "/home/telecaster/seafile/CRFPA" -u "telecaster@parisson.com" -p "cab2GhetGoog" - diff --git a/src/home/telecaster/bin/telecaster_master-ae.sh b/src/home/telecaster/bin/telecaster_master-ae.sh deleted file mode 100755 index 3ccf8bc..0000000 --- a/src/home/telecaster/bin/telecaster_master-ae.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -organization=Pre-Barreau -department=AE -year=`date '+%Y'` -year2=$((year-1)) -media_dir=/home/telecaster/archives/$organization/$department/$year/ -server_media_dir=/mnt/ae-videos/$organization/$department/$year/ -backup_dir=/mnt/nile/$organization/$department/$year/ -tmp_log=/tmp/telecaster-$department.log -remux_log=/home/telecaster/log/remux-$department.log -transcode_log=/home/telecaster/log/transcode-$department.log -import_log=/var/log/app/import_media.log -tmp_dir=/home/telecaster/tmp/ -app_server=malcom.parisson.com -app_path=/srv/ae-docker -media_server=malcom.parisson.com -emails="webmaster@parisson.com,jeannot@parisson.com" -subject="TeleCaster remux ($departement)" -bwlimit=20000 - - -python ~/bin/py/remux_fix_media.py $media_dir $tmp_dir > $tmp_log - -cat $tmp_log >> $remux_log - -python ~/bin/py/transcode_nv.py $media_dir $transcode_log - -rsync -auLKr --bwlimit=$bwlimit --include="*/" --include="$year/**" --include="$year2/**" --exclude="*.webm" --exclude="@eaDir" $media_dir $media_server:$server_media_dir - -ssh $app_server "docker compose -f $app_path/docker-compose.yml -f $app_path/env/prod.yml exec -T app /srv/app/manage.py teleforma-import-conferences-2 $organization $department $import_log" - -python ~/apps/tools/message/mail_msg.py $subject $tmp_log $emails - - diff --git a/src/home/telecaster/bin/telecaster_master-crfpa-mp4-staging.sh b/src/home/telecaster/bin/telecaster_master-crfpa-mp4-staging.sh deleted file mode 100755 index 1668e9c..0000000 --- a/src/home/telecaster/bin/telecaster_master-crfpa-mp4-staging.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -year=`date '+%Y'` -media_dir=/home/telecaster/archives/Pre-Barreau/CRFPA/$year/ -backup_dir=/mnt/nile/Pre-Barreau/CRFPA/$year/ -tmp_log=/tmp/telecaster-remux-crfpa.log -log=/home/telecaster/log/remux-crfpa.log -tmp_dir=/home/telecaster/tmp/ -app_server=malcom.parisson.com -app_path=/srv/crfpa-docker-staging -media_server=malcom.parisson.com -emails="webmaster@parisson.com,jeannot@parisson.com" -subject="TeleCaster remux (CRFPA)" -bwlimit=20000 - -python ~/bin/py/remux_fix_media.py $media_dir $tmp_dir > $tmp_log - -cat $tmp_log >> $remux_log - -#rsync -uLKPr $media_dir $backup_dir - -#echo `date` >> ~/log/transcode-crfpa.log - -python ~/bin/py/transcode_nv.py $media_dir $transcode_log - -#find $backup_dir -type d -exec chmod 755 {} \; -#find $backup_dir -type f -exec chmod 644 {} \; - -#rsync -auLKPr --bwlimit=$bwlimit --include="*/" --include="$year/**" --exclude="*" $backup_dir $media_server:$media_dir -#rsync -uLKPr --bwlimit=$bwlimit --include="*/" --include="$year/**" --exclude=".webm" --exclude=".ogg" --exclude="*" $backup_dir $media_server:$media_dir -rsync -auLKPr --bwlimit=$bwlimit --include="*/" --include="$year/**" --exclude="*.webm" --exclude="@eaDir" $backup_dir $media_server:$media_dir - -ssh $app_server "docker-compose -f $app_path/docker-compose.yml -f $app_path/env/prod.yml exec app /srv/app/manage.py teleforma-import-conferences-2 Pre-Barreau CRFPA /var/log/app/import_media.log" - -#python ~/apps/tools/message/mail_msg.py $subject $tmp_log $emails - - diff --git a/src/home/telecaster/bin/telecaster_master-crfpa-mp4.sh b/src/home/telecaster/bin/telecaster_master-crfpa-mp4.sh deleted file mode 100755 index 413ffc4..0000000 --- a/src/home/telecaster/bin/telecaster_master-crfpa-mp4.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -organization=Pre-Barreau -department=CRFPA -year=`date '+%Y'` -media_dir=/home/telecaster/archives/$organization/$department/$year/ -server_media_dir=/mnt/crfpa-videos/$organization/$department/$year/ -backup_dir=/mnt/nile/$organization/$department/$year/ -tmp_log=/tmp/telecaster-$department.log -remux_log=/home/telecaster/log/remux-$department.log -transcode_log=/home/telecaster/log/transcode-$department.log -import_log=/var/log/app/import_media.log -tmp_dir=/home/telecaster/tmp/ -app_server=malcom.parisson.com -app_path=/srv/crfpa-docker -media_server=malcom.parisson.com -emails="webmaster@parisson.com,jeannot@parisson.com" -subject="TeleCaster remux (CRFPA)" -bwlimit=20000 - -python ~/bin/py/remux_fix_media.py $media_dir $tmp_dir > $tmp_log - -cat $tmp_log >> $remux_log - -python ~/bin/py/transcode_nv.py $media_dir $transcode_log - -#find $backup_dir -type d -exec chmod 755 {} \; -#find $backup_dir -type f -exec chmod 644 {} \; - -rsync -auLKr --bwlimit=$bwlimit --include="*/" --include="$year/**" --exclude="*.webm" --exclude="@eaDir" $media_dir $media_server:$server_media_dir - -ssh $app_server "docker compose -f $app_path/docker-compose.yml -f $app_path/env/prod.yml exec -T app /srv/app/manage.py teleforma-import-conferences-2 $organization $department $import_log" - -python ~/apps/tools/message/mail_msg.py $subject $tmp_log $emails - - diff --git a/src/home/telecaster/bin/telecaster_master-pro.sh b/src/home/telecaster/bin/telecaster_master-pro.sh deleted file mode 100755 index 8f3b26d..0000000 --- a/src/home/telecaster/bin/telecaster_master-pro.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -day=`date '+%Y-%m-%d_%H-%M-%S'` -year=`date '+%Y'` -#year=2020 - -script_dir="/home/telecaster/kdenlive/scripts/" -server="malcom.parisson.com" -tmp_dir="/home/telecaster/tmp/" -log_dir="/home/telecaster/log/" - - -for y in `seq $(($year)) $(($year+1))`; do - echo $y - media_dir="/home/telecaster/kdenlive/Final/$y/" - server_media_dir="/mnt/prob-videos/Pre-Barreau/Pro-Barreau/Final/$y/" - archives_dir="/home/telecaster/archives/Pre-Barreau/Pro-Barreau/$y/" - - #bash ~/apps/Telemeta/scripts/kdenlive/mlt_fix_threads.sh $script_dir - #python ~/apps/Telemeta/scripts/kdenlive/mlt_process_batch.py --fading $script_dir >> $log_dir/mlt.log - #python ~/apps/Telemeta/scripts/transcode/remux_fix_media.py $archives_dir $tmp_dir >> $log_dir/remux-pro.log - #python ~/apps/Telemeta/scripts/transcode/transcode.py $media_dir $log_dir/transcode-pro.log - - python ~/bin/py/remux_fix_media.py $archives_dir $tmp_dir >> $log_dir/remux-pro.log - python ~/bin/py/transcode_nv-pro.py $media_dir $log_dir/transcode-pro.log - - chmod -fR 664 $media_dir; chmod -fR +rX $media_dir - rsync -aquLKP --bwlimit=15000 --delete --exclude="@eaDir" $media_dir $server:$server_media_dir - - #ssh $server chmod -R 664 $server_media_dir - #ssh $server chmod -R +rX $server_media_dir - -done diff --git a/src/home/telecaster/media/mp3/silence.mp3 b/src/home/telecaster/media/mp3/silence.mp3 deleted file mode 100644 index 17538c9..0000000 Binary files a/src/home/telecaster/media/mp3/silence.mp3 and /dev/null differ diff --git a/src/home/telecaster/media/ogg/silence.ogg b/src/home/telecaster/media/ogg/silence.ogg deleted file mode 100644 index 5cfaddf..0000000 Binary files a/src/home/telecaster/media/ogg/silence.ogg and /dev/null differ diff --git a/tests/tc_audio_jack_test.sh b/tests/tc_audio_jack_test.sh new file mode 100755 index 0000000..88f5ac0 --- /dev/null +++ b/tests/tc_audio_jack_test.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -e + +# Audio +AUDIO_CHANNELS=2 +AUDIO_OPUS_BITRATE=96000 +AUDIO_MP3_QUALITY=4.0 + +LOCAL_DIR=$(dirname "$0") +if [ -f $LOCAL_DIR/.env ]; then + source $LOCAL_DIR/.env +fi + +# GST launch +gst-launch-1.0 filesrc location=~/Sounds/Test/test_raw_voice_haik.wav \ + ! queue ! decodebin \ + ! queue ! audioconvert \ + ! queue ! audiocheblimit mode=high-pass cutoff=125 poles=4 \ + ! queue ! volume volume=2.5 \ + ! queue ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.125 ratio=0.125 \ + ! queue ! volume volume=1.5 \ + ! queue ! audiodynamic characteristics=hard-knee mode=compressor threshold=0.95 ratio=0.001 \ + ! queue ! pulsesink + diff --git a/tests/tc_video_simple_webm_stream-gst1-va.sh b/tests/tc_video_simple_webm_stream-gst1-va.sh new file mode 100755 index 0000000..709c685 --- /dev/null +++ b/tests/tc_video_simple_webm_stream-gst1-va.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -e + +# Default TeleCaster video parameters + +# v4l2 +V4L2_ID=0 +V4L2_ZOOM=140 +V4L2_SHARPNESS=128 + +# C920 +#VIDEO_WIDTH=864 +#VIDEO_HEIGHT=480 +#VIDEO_FRAMERATE=24 + +# C922 +VIDEO_WIDTH=1920 +VIDEO_HEIGHT=1080 +VIDEO_FRAMERATE=30 +VIDEO_FLIP=none + +# Audio +AUDIO_CHANNELS=2 +AUDIO_OPUS_BITRATE=96000 +AUDIO_GAIN_PRE=2.5 +AUDIO_GAIN_POST=1.5 + +# source /etc/telecaster/telecaster.conf + +# V4L2 setup +# v4l2-ctl -d $V4L2_ID -c power_line_frequency=1 +# v4l2-ctl -d $V4L2_ID -c zoom_absolute=$V4L2_ZOOM +# v4l2-ctl -d $V4L2_ID -c focus_auto=0 +# v4l2-ctl -d $V4L2_ID -c focus_absolute=1 +# v4l2-ctl -d $V4L2_ID -c sharpness=$V4L2_SHARPNESS + +# GST launch +gst-launch-1.0 v4l2src device=/dev/video$V4L2_ID \ + ! videoconvert \ + ! vaapih264enc \ + ! h264parse \ + ! mp4mux \ + ! filesink location=/tmp/test.mp4