Update app.py
Browse files
app.py
CHANGED
|
@@ -134,12 +134,12 @@ def extend_video_simple(video_path, audio_path, output_path):
|
|
| 134 |
# Create a reversed version of the full video
|
| 135 |
reversed_clip = "reversed.mp4"
|
| 136 |
subprocess.run(
|
| 137 |
-
f"ffmpeg -i {video_path} -vf reverse -an {reversed_clip}", shell=True
|
| 138 |
)
|
| 139 |
|
| 140 |
# Merge original + reversed
|
| 141 |
subprocess.run(
|
| 142 |
-
f"ffmpeg -i {video_path} -i {reversed_clip} -filter_complex \"[0:v:0][1:v:0]concat=n=2:v=1[outv]\" -map \"[outv]\" -an {output_path}",
|
| 143 |
shell=True
|
| 144 |
)
|
| 145 |
|
|
@@ -176,15 +176,14 @@ def generate_video():
|
|
| 176 |
inference_ckpt_path = request.form.get('inference_ckpt_path', 'checkpoints/latentsync_unet.pt')
|
| 177 |
unet_config_path = request.form.get('unet_config_path', 'configs/unet/second_stage.yaml')
|
| 178 |
|
| 179 |
-
extended_output_video = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4").name
|
| 180 |
|
| 181 |
-
extend_video_simple(temp_video_path, temp_audio_path,
|
| 182 |
|
| 183 |
try:
|
| 184 |
run_inference(
|
| 185 |
video_path=temp_video_path,
|
| 186 |
audio_path=temp_audio_path,
|
| 187 |
-
video_out_path=
|
| 188 |
inference_ckpt_path=inference_ckpt_path,
|
| 189 |
unet_config_path=unet_config_path,
|
| 190 |
inference_steps=int(request.form.get('inference_steps', 20)),
|
|
|
|
| 134 |
# Create a reversed version of the full video
|
| 135 |
reversed_clip = "reversed.mp4"
|
| 136 |
subprocess.run(
|
| 137 |
+
f"ffmpeg -y -i {video_path} -vf reverse -an {reversed_clip}", shell=True
|
| 138 |
)
|
| 139 |
|
| 140 |
# Merge original + reversed
|
| 141 |
subprocess.run(
|
| 142 |
+
f"ffmpeg -y -i {video_path} -i {reversed_clip} -filter_complex \"[0:v:0][1:v:0]concat=n=2:v=1[outv]\" -map \"[outv]\" -an {output_path}",
|
| 143 |
shell=True
|
| 144 |
)
|
| 145 |
|
|
|
|
| 176 |
inference_ckpt_path = request.form.get('inference_ckpt_path', 'checkpoints/latentsync_unet.pt')
|
| 177 |
unet_config_path = request.form.get('unet_config_path', 'configs/unet/second_stage.yaml')
|
| 178 |
|
|
|
|
| 179 |
|
| 180 |
+
extend_video_simple(temp_video_path, temp_audio_path, output_video)
|
| 181 |
|
| 182 |
try:
|
| 183 |
run_inference(
|
| 184 |
video_path=temp_video_path,
|
| 185 |
audio_path=temp_audio_path,
|
| 186 |
+
video_out_path=output_video,
|
| 187 |
inference_ckpt_path=inference_ckpt_path,
|
| 188 |
unet_config_path=unet_config_path,
|
| 189 |
inference_steps=int(request.form.get('inference_steps', 20)),
|