Fix fps detection
This commit is contained in:
parent
703346da79
commit
6cd16c9f35
@ -187,7 +187,7 @@ def start() -> None:
|
|||||||
torch.cuda.empty_cache()
|
torch.cuda.empty_cache()
|
||||||
if roop.globals.keep_fps:
|
if roop.globals.keep_fps:
|
||||||
update_status('Detecting 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...')
|
update_status(f'Creating video with {fps} fps...')
|
||||||
create_video(roop.globals.target_path, fps)
|
create_video(roop.globals.target_path, fps)
|
||||||
else:
|
else:
|
||||||
|
@ -22,8 +22,8 @@ def run_ffmpeg(args: List) -> None:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def detect_fps(source_path: str) -> int:
|
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', source_path]
|
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()
|
output = subprocess.check_output(command).decode().strip()
|
||||||
try:
|
try:
|
||||||
return int(eval(output))
|
return int(eval(output))
|
||||||
|
Loading…
Reference in New Issue
Block a user