From a7f2fedb99e84dd284f3680735169a6ccb7da7a2 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Sat, 19 Jan 2019 20:06:39 +0000 Subject: [PATCH 1/2] Add transcoding to AV1 to default set For this to work in production, a new fileformat 'av1' must be added. Fixes #127 --- fkbeta/fk/fixtures/frikanalen.json | 7 +++++++ utils/move_and_process.py | 6 ++++++ utils/test_move_and_process.py | 6 ++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/fkbeta/fk/fixtures/frikanalen.json b/fkbeta/fk/fixtures/frikanalen.json index 5a83ad12..57c79575 100644 --- a/fkbeta/fk/fixtures/frikanalen.json +++ b/fkbeta/fk/fixtures/frikanalen.json @@ -55,6 +55,13 @@ "fsname": "srt" } }, + { + "model": "fk.fileformat", + "pk": 9, + "fields": { + "fsname": "av1" + } + }, { "model": "fk.category", "pk": 119, diff --git a/utils/move_and_process.py b/utils/move_and_process.py index 1e20b3a2..b9641148 100755 --- a/utils/move_and_process.py +++ b/utils/move_and_process.py @@ -34,6 +34,7 @@ 'original': 6, 'theora': 7, 'srt': 8, + 'av1': 9, } for k, v in list(VF_FORMATS.items()): VF_FORMATS[v] = k @@ -56,6 +57,10 @@ class Converter(object): '-qscale:v 7 -qscale:a 2 -vf scale=720:-1'), 'ext': 'ogv', }, + 'av1': { + 'ffmpeg': '-c:v libaom-av1 -strict -2', + 'ext': 'avi', + }, 'broadcast': { 'ffmpeg': '-target pal-dv', 'ext': 'dv', @@ -95,6 +100,7 @@ def get_formats(cls, filepath): else: assert 'broadcast' in path formats.append('theora') + formats.append('av1') return formats diff --git a/utils/test_move_and_process.py b/utils/test_move_and_process.py index c83acebf..079aff43 100644 --- a/utils/test_move_and_process.py +++ b/utils/test_move_and_process.py @@ -46,10 +46,12 @@ def test_generate(self): ('/tmp/original/test.ogv', [ '/tmp/large_thumb/test.jpg', '/tmp/broadcast/test.dv', - '/tmp/theora/test.ogv']), + '/tmp/theora/test.ogv', + '/tmp/av1/test.avi']), ('/tmp/broadcast/test.ogv', [ '/tmp/large_thumb/test.jpg', - '/tmp/theora/test.ogv']), + '/tmp/theora/test.ogv', + '/tmp/av1/test.avi']), ) nop = lambda *_, **__: None for t in tests: From 2712ba8b585824e00af5ed523ebbf051f1a863d8 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Sat, 19 Jan 2019 21:38:44 +0000 Subject: [PATCH 2/2] Log subprocess output also with non-zero exit code. --- utils/move_and_process.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/move_and_process.py b/utils/move_and_process.py index b9641148..1cfd7674 100755 --- a/utils/move_and_process.py +++ b/utils/move_and_process.py @@ -117,7 +117,11 @@ def run(cls, cmd, filepath=None, reprocess=False): else: logging.info("SKIP already existing file: %s", filepath) return - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) + try: + output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as ex: # error code <> 0 + logging.debug(ex.output.decode('utf-8')) + raise logging.debug(output.decode('utf-8'))