From df8d4317a74cba118da25e60ff6bb8d8e0d4e474 Mon Sep 17 00:00:00 2001 From: henryruhs Date: Fri, 23 May 2025 21:43:58 +0200 Subject: [PATCH] Fallbacks for audio --- facefusion/ffmpeg.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/facefusion/ffmpeg.py b/facefusion/ffmpeg.py index ef02749..04774bb 100644 --- a/facefusion/ffmpeg.py +++ b/facefusion/ffmpeg.py @@ -164,8 +164,12 @@ def restore_audio(target_path : str, output_path : str, trim_frame_start : int, output_audio_volume = state_manager.get_item('output_audio_volume') target_video_fps = detect_video_fps(target_path) temp_video_path = get_temp_file_path(target_path) + temp_video_format = get_file_format(temp_video_path) temp_video_duration = detect_video_duration(temp_video_path) + if temp_video_format in [ 'avi', 'mov' ] and output_audio_encoder == 'flac': + output_audio_encoder = 'aac' + commands = ffmpeg_builder.chain( ffmpeg_builder.set_input(temp_video_path), ffmpeg_builder.select_media_range(trim_frame_start, trim_frame_end, target_video_fps), @@ -187,8 +191,12 @@ def replace_audio(target_path : str, audio_path : str, output_path : str) -> boo output_audio_quality = state_manager.get_item('output_audio_quality') output_audio_volume = state_manager.get_item('output_audio_volume') temp_video_path = get_temp_file_path(target_path) + temp_video_format = get_file_format(temp_video_path) temp_video_duration = detect_video_duration(temp_video_path) + if temp_video_format in [ 'avi', 'mov' ] and output_audio_encoder == 'flac': + output_audio_encoder = 'aac' + commands = ffmpeg_builder.chain( ffmpeg_builder.set_input(temp_video_path), ffmpeg_builder.set_input(audio_path),