Add ability to generate thumbnails

This commit is contained in:
Brett Williams
2022-12-11 17:52:56 -08:00
parent 9f291a1282
commit d945d51e56
5 changed files with 81 additions and 18 deletions

View File

@@ -9,9 +9,16 @@ def file_info(path):
return None
def save_first_frame(source_path, dest_path, max_width=1280, run_async=False):
stream = ffmpeg.input(source_path)
stream = ffmpeg.output(stream, dest_path, **{'vf': f'format=yuv420p,scale={max_width}:-2', 'vframes': '1'})
return _run_output(stream, run_async)
def generate_fast_preview(source_path, dest_path, max_width=1280, run_async=False):
stream = ffmpeg.input(source_path)
stream = ffmpeg.output(stream, dest_path, **{'vf': 'format=yuv420p,scale={width}:-2'.format(width=max_width), 'preset': 'ultrafast'})
stream = ffmpeg.output(stream, dest_path, **{'vf': 'format=yuv420p,scale={width}:-2'.format(width=max_width),
'preset': 'ultrafast'})
return _run_output(stream, run_async)