Fallbacks for audio

This commit is contained in:
henryruhs
2025-05-23 21:43:58 +02:00
parent c273a834f6
commit df8d4317a7

View File

@@ -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),