Spaces:
Sleeping
Sleeping
Update optimizers/speed.py
Browse files- optimizers/speed.py +4 -4
optimizers/speed.py
CHANGED
|
@@ -330,21 +330,21 @@ class ParallelGenerator:
|
|
| 330 |
logger.info(f"Segment {idx+1}/{n_segments} terminé")
|
| 331 |
|
| 332 |
# Assemblage des segments
|
| 333 |
-
|
| 334 |
clips = []
|
| 335 |
for r in segment_results:
|
| 336 |
if r and r.success and r.video_path:
|
| 337 |
-
clips.append(
|
| 338 |
|
| 339 |
if not clips:
|
| 340 |
raise RuntimeError("Aucun segment généré")
|
| 341 |
|
| 342 |
from pipeline.processor import OUTPUT_DIR
|
| 343 |
-
final =
|
| 344 |
out_path = OUTPUT_DIR / f"parallel_{int(time.time())}.mp4"
|
| 345 |
final.write_videofile(str(out_path), fps=config.fps,
|
| 346 |
codec="libx264", audio_codec="aac", logger=None)
|
| 347 |
return str(out_path)
|
| 348 |
|
| 349 |
|
| 350 |
-
import cv2 # noqa : import tardif pour éviter conflit
|
|
|
|
| 330 |
logger.info(f"Segment {idx+1}/{n_segments} terminé")
|
| 331 |
|
| 332 |
# Assemblage des segments
|
| 333 |
+
from moviepy import VideoFileClip, concatenate_videoclips
|
| 334 |
clips = []
|
| 335 |
for r in segment_results:
|
| 336 |
if r and r.success and r.video_path:
|
| 337 |
+
clips.append(VideoFileClip(r.video_path))
|
| 338 |
|
| 339 |
if not clips:
|
| 340 |
raise RuntimeError("Aucun segment généré")
|
| 341 |
|
| 342 |
from pipeline.processor import OUTPUT_DIR
|
| 343 |
+
final = concatenate_videoclips(clips, method="compose")
|
| 344 |
out_path = OUTPUT_DIR / f"parallel_{int(time.time())}.mp4"
|
| 345 |
final.write_videofile(str(out_path), fps=config.fps,
|
| 346 |
codec="libx264", audio_codec="aac", logger=None)
|
| 347 |
return str(out_path)
|
| 348 |
|
| 349 |
|
| 350 |
+
import cv2 # noqa : import tardif pour éviter conflit
|