Fix fps detection

This commit is contained in:
henryruhs 2023-06-09 08:25:53 +02:00
parent 703346da79
commit 6cd16c9f35
2 changed files with 3 additions and 3 deletions

View File

@ -187,7 +187,7 @@ def start() -> None:
torch.cuda.empty_cache()
if roop.globals.keep_fps:
update_status('Detecting fps...')
fps = detect_fps(roop.globals.source_path)
fps = detect_fps(roop.globals.target_path)
update_status(f'Creating video with {fps} fps...')
create_video(roop.globals.target_path, fps)
else:

View File

@ -22,8 +22,8 @@ def run_ffmpeg(args: List) -> None:
pass
def detect_fps(source_path: str) -> int:
command = ['ffprobe', '-v', 'error', '-select_streams', 'v:0', '-show_entries', 'stream=r_frame_rate', '-of', 'default=noprint_wrappers=1:nokey=1', source_path]
def detect_fps(target_path: str) -> int:
command = ['ffprobe', '-v', 'error', '-select_streams', 'v:0', '-show_entries', 'stream=r_frame_rate', '-of', 'default=noprint_wrappers=1:nokey=1', target_path]
output = subprocess.check_output(command).decode().strip()
try:
return int(eval(output))