Refactor embedding metadata to media

This commit is contained in:
Ritiek Malhotra
2020-03-25 02:04:24 +05:30
parent d154b2be20
commit c9a804268d
13 changed files with 349 additions and 261 deletions

View File

@@ -15,47 +15,47 @@ class TestEncoderFFmpeg:
class TestEncodingDefaults:
def m4a_to_mp3_encoder(input_file, output_file):
def m4a_to_mp3_encoder(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
'-i', input_file,
'-i', input_path,
'-codec:v', 'copy',
'-codec:a', 'libmp3lame',
'-ar', '48000',
'-b:a', '192k',
'-vn', output_file
'-vn', target_path
]
return command
def m4a_to_webm_encoder(input_file, output_file):
def m4a_to_webm_encoder(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
'-i', input_file,
'-i', input_path,
'-codec:a', 'libopus',
'-vbr', 'on',
'-b:a', '192k',
'-vn', output_file
'-vn', target_path
]
return command
def m4a_to_m4a_encoder(input_file, output_file):
def m4a_to_m4a_encoder(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
'-i', input_file,
'-i', input_path,
'-acodec', 'copy',
'-b:a', '192k',
'-vn', output_file
'-vn', target_path
]
return command
def m4a_to_flac_encoder(input_file, output_file):
def m4a_to_flac_encoder(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
'-i', input_file,
'-i', input_path,
'-codec:a', 'flac',
'-ar', '48000',
'-b:a', '192k',
'-vn', output_file
'-vn', target_path
]
return command
@@ -71,47 +71,47 @@ class TestEncodingDefaults:
class TestEncodingInDebugMode:
def m4a_to_mp3_encoder_with_debug(input_file, output_file):
def m4a_to_mp3_encoder_with_debug(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-loglevel', 'debug',
'-i', input_file,
'-i', input_path,
'-codec:v', 'copy',
'-codec:a', 'libmp3lame',
'-ar', '48000',
'-b:a', '192k',
'-vn', output_file
'-vn', target_path
]
return command
def m4a_to_webm_encoder_with_debug(input_file, output_file):
def m4a_to_webm_encoder_with_debug(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-loglevel', 'debug',
'-i', input_file,
'-i', input_path,
'-codec:a', 'libopus',
'-vbr', 'on',
'-b:a', '192k',
'-vn', output_file
'-vn', target_path
]
return command
def m4a_to_m4a_encoder_with_debug(input_file, output_file):
def m4a_to_m4a_encoder_with_debug(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-loglevel', 'debug',
'-i', input_file,
'-i', input_path,
'-acodec', 'copy',
'-b:a', '192k',
'-vn', output_file
'-vn', target_path
]
return command
def m4a_to_flac_encoder_with_debug(input_file, output_file):
def m4a_to_flac_encoder_with_debug(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-loglevel', 'debug',
'-i', input_file,
'-i', input_path,
'-codec:a', 'flac',
'-ar', '48000',
'-b:a', '192k',
'-vn', output_file
'-vn', target_path
]
return command
@@ -128,55 +128,55 @@ class TestEncodingInDebugMode:
class TestEncodingAndTrimSilence:
def m4a_to_mp3_encoder_and_trim_silence(input_file, output_file):
def m4a_to_mp3_encoder_and_trim_silence(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
'-i', input_file,
'-i', input_path,
'-codec:v', 'copy',
'-codec:a', 'libmp3lame',
'-ar', '48000',
'-b:a', '192k',
'-vn',
'-af', 'silenceremove=start_periods=1',
output_file
target_path
]
return command
def m4a_to_webm_encoder_and_trim_silence(input_file, output_file):
def m4a_to_webm_encoder_and_trim_silence(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
'-i', input_file,
'-i', input_path,
'-codec:a', 'libopus',
'-vbr', 'on',
'-b:a', '192k',
'-vn',
'-af', 'silenceremove=start_periods=1',
output_file
target_path
]
return command
def m4a_to_m4a_encoder_and_trim_silence(input_file, output_file):
def m4a_to_m4a_encoder_and_trim_silence(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
'-i', input_file,
'-i', input_path,
'-acodec', 'copy',
'-b:a', '192k',
'-vn',
'-af', 'silenceremove=start_periods=1',
output_file
target_path
]
return command
def m4a_to_flac_encoder_and_trim_silence(input_file, output_file):
def m4a_to_flac_encoder_and_trim_silence(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
'-i', input_file,
'-i', input_path,
'-codec:a', 'flac',
'-ar', '48000',
'-b:a', '192k',
'-vn',
'-af', 'silenceremove=start_periods=1',
output_file
target_path
]
return command