Simple fix to enforce vp9 for webm

This commit is contained in:
henryruhs 2024-11-02 14:37:41 +01:00
parent 89e3051342
commit 4a16ccabab

View File

@ -69,8 +69,11 @@ def merge_video(target_path : str, output_video_resolution : str, output_video_f
temp_video_fps = restrict_video_fps(target_path, output_video_fps)
temp_file_path = get_temp_file_path(target_path)
temp_frames_pattern = get_temp_frames_pattern(target_path, '%08d')
commands = [ '-r', str(temp_video_fps), '-i', temp_frames_pattern, '-s', str(output_video_resolution), '-c:v', state_manager.get_item('output_video_encoder') ]
is_webm = filetype.guess_mime(target_path) == 'video/webm'
if is_webm:
state_manager.set_item('output_video_encoder', 'libvpx-vp9')
commands = [ '-r', str(temp_video_fps), '-i', temp_frames_pattern, '-s', str(output_video_resolution), '-c:v', state_manager.get_item('output_video_encoder') ]
if state_manager.get_item('output_video_encoder') in [ 'libx264', 'libx265' ]:
output_video_compression = round(51 - (state_manager.get_item('output_video_quality') * 0.51))
commands.extend([ '-crf', str(output_video_compression), '-preset', state_manager.get_item('output_video_preset') ])