preserve LivePortrait video with audio, if it exists

This commit is contained in:
Brandon Thomas
2024-07-24 16:24:18 -04:00
parent 319378e001
commit 8d94a8a041
@@ -57,9 +57,14 @@ def ensure_pipeline_input_present(source_path, input_name=None):
shutil.copy(left, right)
def ensure_output_present_at(right):
left = Path(COMFY_ROOT_DIRECTORY) / "output" / "vid2vid" / "LivePortrait_00001.mp4"
shutil.copy(left, right)
def ensure_output_present_at(new_filename):
directory = Path(COMFY_ROOT_DIRECTORY) / "output" / "vid2vid"
# Comfy will create a copy of the video that includes audio, but only if the driver video had audio.
output = directory / "LivePortrait_00001.mp4"
output_with_audio = directory / "LivePortrait_00001-audio.mp4"
if os.path.exists(output_with_audio):
output = output_with_audio
shutil.copy(output, new_filename)
def parse_args():
parser = argparse.ArgumentParser(description='Run Comfy')