Fix/extrating merging progress bar total (#868)
* Introduce predict_video_frame_total() to fix progress bar while extracting and merging * Introduce predict_video_frame_total() to fix progress bar while extracting and merging * Use floor over ceil
This commit is contained in:
@@ -8,9 +8,9 @@ from tqdm import tqdm
|
||||
import facefusion.choices
|
||||
from facefusion import ffmpeg_builder, logger, process_manager, state_manager, wording
|
||||
from facefusion.filesystem import get_file_format, remove_file
|
||||
from facefusion.temp_helper import get_temp_file_path, get_temp_frames_pattern, resolve_temp_frame_paths
|
||||
from facefusion.temp_helper import get_temp_file_path, get_temp_frames_pattern
|
||||
from facefusion.types import AudioBuffer, Commands, EncoderSet, Fps, UpdateProgress
|
||||
from facefusion.vision import count_trim_frame_total, detect_video_duration, detect_video_fps
|
||||
from facefusion.vision import detect_video_duration, detect_video_fps, predict_video_frame_total
|
||||
|
||||
|
||||
def run_ffmpeg_with_progress(commands : Commands, update_progress : UpdateProgress) -> subprocess.Popen[bytes]:
|
||||
@@ -100,7 +100,7 @@ def get_available_encoder_set() -> EncoderSet:
|
||||
|
||||
|
||||
def extract_frames(target_path : str, temp_video_resolution : str, temp_video_fps : Fps, trim_frame_start : int, trim_frame_end : int) -> bool:
|
||||
extract_frame_total = count_trim_frame_total(target_path, trim_frame_start, trim_frame_end)
|
||||
extract_frame_total = predict_video_frame_total(target_path, temp_video_fps, trim_frame_start, trim_frame_end)
|
||||
temp_frames_pattern = get_temp_frames_pattern(target_path, '%08d')
|
||||
commands = ffmpeg_builder.chain(
|
||||
ffmpeg_builder.set_input(target_path),
|
||||
@@ -200,11 +200,11 @@ def replace_audio(target_path : str, audio_path : str, output_path : str) -> boo
|
||||
return run_ffmpeg(commands).returncode == 0
|
||||
|
||||
|
||||
def merge_video(target_path : str, temp_video_fps : Fps, output_video_resolution : str, output_video_fps : Fps) -> bool:
|
||||
def merge_video(target_path : str, temp_video_fps : Fps, output_video_resolution : str, output_video_fps : Fps, trim_frame_start : int, trim_frame_end : int) -> bool:
|
||||
output_video_encoder = state_manager.get_item('output_video_encoder')
|
||||
output_video_quality = state_manager.get_item('output_video_quality')
|
||||
output_video_preset = state_manager.get_item('output_video_preset')
|
||||
merge_frame_total = len(resolve_temp_frame_paths(target_path))
|
||||
merge_frame_total = predict_video_frame_total(target_path, output_video_fps, trim_frame_start, trim_frame_end)
|
||||
temp_file_path = get_temp_file_path(target_path)
|
||||
temp_frames_pattern = get_temp_frames_pattern(target_path, '%08d')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user