+++ /dev/null
-#!/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
-
--- /dev/null
+#!/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!"
--- /dev/null
+#!/bin/bash
+
+ffmpeg -i $1 -c copy out.webm
--- /dev/null
+#!/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')
+
--- /dev/null
+#!/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()
--- /dev/null
+#!/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()
--- /dev/null
+#!/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()
--- /dev/null
+#!/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()
--- /dev/null
+#!/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()
--- /dev/null
+#!/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()
--- /dev/null
+#!/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()
--- /dev/null
+#!/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()
--- /dev/null
+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()
--- /dev/null
+#!/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/
--- /dev/null
+#!/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"
+
--- /dev/null
+#!/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
+
+
--- /dev/null
+#!/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
+
+
--- /dev/null
+#!/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
+
+
--- /dev/null
+#!/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
--- /dev/null
+#!/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 &
+
--- /dev/null
+#!/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
+
--- /dev/null
+#!/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
--- /dev/null
+#!/bin/bash
+
+sudo modprobe v4l2loopback devices=1 video_nr=12 card_label="virtual webcam" exclusive_caps=1 max_buffers=2
--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/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
+
--- /dev/null
+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
--- /dev/null
+#!/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
--- /dev/null
+#!/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 &
+
--- /dev/null
+session.menuFile: ~/.fluxbox/menu
+session.keyFile: ~/.fluxbox/keys
+session.configVersion: 13
--- /dev/null
+#!/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"
--- /dev/null
+#!/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 &
+
+++ /dev/null
-# 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"
-
+++ /dev/null
-# 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"
-
# 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
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"
+++ /dev/null
-#!/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 &
-
+++ /dev/null
-session.menuFile: ~/.fluxbox/menu
-session.keyFile: ~/.fluxbox/keys
-session.configVersion: 13
+++ /dev/null
-session.menuFile: ~/.fluxbox/menu
-session.keyFile: ~/.fluxbox/keys
-session.configVersion: 11
-
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
+++ /dev/null
-#!/bin/bash
-
-sudo modprobe v4l2loopback devices=1 video_nr=12 card_label="virtual webcam" exclusive_caps=1 max_buffers=2
+++ /dev/null
-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()
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
+++ /dev/null
-#!/usr/bin/env bash
-
-set -e
-
-source /etc/telecaster/telecaster.conf
-
-jackd $JACK_OPTIONS
-
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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"
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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 &
-
+++ /dev/null
-#!/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/
+++ /dev/null
-#!/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!"
+++ /dev/null
-#!/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')
-
+++ /dev/null
-#!/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()
+++ /dev/null
-#!/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()
+++ /dev/null
-#!/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()
+++ /dev/null
-#!/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()
+++ /dev/null
-#!/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()
+++ /dev/null
-#!/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()
+++ /dev/null
-#!/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()
+++ /dev/null
-#!/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()
+++ /dev/null
-#!/bin/bash
-
-ffmpeg -i $1 -c copy out.webm
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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"
-
+++ /dev/null
-#!/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
-
-
+++ /dev/null
-#!/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
-
-
+++ /dev/null
-#!/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
-
-
+++ /dev/null
-#!/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
--- /dev/null
+#!/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
+
--- /dev/null
+#!/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