+def concat_videos(paths):
+ return ffmpeg_concat(paths, '.mkv')
+
+def concat_audio(paths):
+ std_paths = [
+ standardize_audio(p)
+ for p in paths
+ ]
+ output = ffmpeg_concat(std_paths, '.flac')
+ for p in std_paths:
+ unlink(p)
+ return output
+
+def standardize_audio(p):
+ output = NamedTemporaryFile(prefix='standarize', suffix='.flac', delete=False)
+ output.close()
+ subprocess.run(
+ ['ffmpeg', '-y', '-i', p, '-sample_fmt', 's16', '-acodec', 'flac', '-ac', '2', '-ar', '44100', output.name],
+ check=True)
+ return output.name
+
+def standardize_video(p):
+ output = NamedTemporaryFile(prefix='standarize', suffix='.mkv', delete=False)
+ output.close()
+ subprocess.run(
+ ['ffmpeg', '-y', '-i', p, output.name],
+ check=True)
+ return output.name
+
+
+