Accept additional command-line options

This commit is contained in:
Ritiek Malhotra
2020-04-12 14:13:21 +05:30
parent 0a8a0db54e
commit a253c308a6
13 changed files with 108 additions and 55 deletions

View File

@@ -28,7 +28,7 @@ class TestEncodingDefaults:
]
return command
def m4a_to_webm_encoder(input_path, target_path):
def m4a_to_opus_encoder(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
'-i', input_path,
@@ -36,7 +36,7 @@ class TestEncodingDefaults:
'-vbr', 'on',
'-b:a', '192k',
'-vn',
'-f', 'webm',
'-f', 'opus',
target_path
]
return command
@@ -68,7 +68,7 @@ class TestEncodingDefaults:
@pytest.mark.parametrize("files, expected_command", [
(("test.m4a", "test.mp3"), m4a_to_mp3_encoder("test.m4a", "test.mp3")),
(("abc.m4a", "cba.webm"), m4a_to_webm_encoder("abc.m4a", "cba.webm")),
(("abc.m4a", "cba.opus"), m4a_to_opus_encoder("abc.m4a", "cba.opus")),
(("bla bla.m4a", "ble ble.m4a"), m4a_to_m4a_encoder("bla bla.m4a", "ble ble.m4a")),
(("😛.m4a", "• tongue.flac"), m4a_to_flac_encoder("😛.m4a", "• tongue.flac")),
])
@@ -92,7 +92,7 @@ class TestEncodingInDebugMode:
]
return command
def m4a_to_webm_encoder_with_debug(input_path, target_path):
def m4a_to_opus_encoder_with_debug(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-loglevel', 'debug',
'-i', input_path,
@@ -100,7 +100,7 @@ class TestEncodingInDebugMode:
'-vbr', 'on',
'-b:a', '192k',
'-vn',
'-f', 'webm',
'-f', 'opus',
target_path
]
return command
@@ -132,7 +132,7 @@ class TestEncodingInDebugMode:
@pytest.mark.parametrize("files, expected_command", [
(("test.m4a", "test.mp3"), m4a_to_mp3_encoder_with_debug("test.m4a", "test.mp3")),
(("abc.m4a", "cba.webm"), m4a_to_webm_encoder_with_debug("abc.m4a", "cba.webm")),
(("abc.m4a", "cba.opus"), m4a_to_opus_encoder_with_debug("abc.m4a", "cba.opus")),
(("bla bla.m4a", "ble ble.m4a"), m4a_to_m4a_encoder_with_debug("bla bla.m4a", "ble ble.m4a")),
(("😛.m4a", "• tongue.flac"), m4a_to_flac_encoder_with_debug("😛.m4a", "• tongue.flac")),
])
@@ -158,7 +158,7 @@ class TestEncodingAndTrimSilence:
]
return command
def m4a_to_webm_encoder_and_trim_silence(input_path, target_path):
def m4a_to_opus_encoder_and_trim_silence(input_path, target_path):
command = [
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
'-i', input_path,
@@ -167,7 +167,7 @@ class TestEncodingAndTrimSilence:
'-b:a', '192k',
'-vn',
'-af', 'silenceremove=start_periods=1',
'-f', 'webm',
'-f', 'opus',
target_path
]
return command
@@ -201,7 +201,7 @@ class TestEncodingAndTrimSilence:
@pytest.mark.parametrize("files, expected_command", [
(("test.m4a", "test.mp3"), m4a_to_mp3_encoder_and_trim_silence("test.m4a", "test.mp3")),
(("abc.m4a", "cba.webm"), m4a_to_webm_encoder_and_trim_silence("abc.m4a", "cba.webm")),
(("abc.m4a", "cba.opus"), m4a_to_opus_encoder_and_trim_silence("abc.m4a", "cba.opus")),
(("bla bla.m4a", "ble ble.m4a"), m4a_to_m4a_encoder_and_trim_silence("bla bla.m4a", "ble ble.m4a")),
(("😛.m4a", "• tongue.flac"), m4a_to_flac_encoder_and_trim_silence("😛.m4a", "• tongue.flac")),
])