diff --git a/facefusion/ffmpeg.py b/facefusion/ffmpeg.py index d7f7c480..9aabaa61 100644 --- a/facefusion/ffmpeg.py +++ b/facefusion/ffmpeg.py @@ -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') ])