Spaces:
Sleeping
Sleeping
roychao19477
commited on
Commit
·
05eb1f3
1
Parent(s):
bfc7913
Add limitations
Browse files
app.py
CHANGED
@@ -195,8 +195,6 @@ def extract_faces(video_file):
|
|
195 |
[cv2.cvtColor(cv2.resize(f, (224, 224)), cv2.COLOR_BGR2RGB) for f in frames],
|
196 |
fps=fps
|
197 |
)
|
198 |
-
from moviepy.video.fx.MirrorY import MirrorY
|
199 |
-
clip = clip.with_effects([MirrorY().copy()])
|
200 |
|
201 |
# Save audio from original, resampled to 16kHz
|
202 |
audio_path = os.path.join(tmpdir, "audio_16k.wav")
|
@@ -210,15 +208,21 @@ def extract_faces(video_file):
|
|
210 |
vn=None # no video
|
211 |
).run(overwrite_output=True)
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
# ------------------------------- #
|
217 |
# AVSE models
|
218 |
|
219 |
enhanced_audio_path = run_avse_inference(output_path, audio_path)
|
220 |
|
221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
return output_path, enhanced_audio_path
|
223 |
#return output_path, audio_path
|
224 |
|
|
|
195 |
[cv2.cvtColor(cv2.resize(f, (224, 224)), cv2.COLOR_BGR2RGB) for f in frames],
|
196 |
fps=fps
|
197 |
)
|
|
|
|
|
198 |
|
199 |
# Save audio from original, resampled to 16kHz
|
200 |
audio_path = os.path.join(tmpdir, "audio_16k.wav")
|
|
|
208 |
vn=None # no video
|
209 |
).run(overwrite_output=True)
|
210 |
|
|
|
|
|
|
|
211 |
# ------------------------------- #
|
212 |
# AVSE models
|
213 |
|
214 |
enhanced_audio_path = run_avse_inference(output_path, audio_path)
|
215 |
|
216 |
|
217 |
+
clip_to_mirror = VideoFileClip(existing_video_path)
|
218 |
+
mirrored_clip = clip_to_mirror.with_effects([MirrorY().copy()])
|
219 |
+
mirrored_clip.write_videofile(
|
220 |
+
output_path,
|
221 |
+
codec='libx264', # Common H.264 codec
|
222 |
+
audio_codec='aac' # Common audio codec if your clip has audio
|
223 |
+
# You can also specify fps if needed: fps=mirrored_clip.fps
|
224 |
+
)
|
225 |
+
|
226 |
return output_path, enhanced_audio_path
|
227 |
#return output_path, audio_path
|
228 |
|