omarbajouk commited on
Commit
3f90dc1
·
verified ·
1 Parent(s): a1b31ab

Update src/capsule_builder.py

Browse files
Files changed (1) hide show
  1. src/capsule_builder.py +18 -0
src/capsule_builder.py CHANGED
@@ -225,3 +225,21 @@ def export_project_zip():
225
  except Exception as e:
226
  print(f"[Export] ❌ Erreur ZIP : {e}")
227
  return None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  except Exception as e:
226
  print(f"[Export] ❌ Erreur ZIP : {e}")
227
  return None
228
+
229
+ def assemble_final_fast():
230
+ """Concaténation instantanée sans réencodage (FFmpeg direct)."""
231
+ import subprocess, os
232
+ if not capsules:
233
+ return None, "❌ Aucune capsule."
234
+ list_path = os.path.join(OUT_DIR, "concat_list.txt")
235
+ with open(list_path, "w", encoding="utf-8") as f:
236
+ for c in capsules:
237
+ f.write(f"file '{c['file']}'\n")
238
+ out_path = os.path.join(OUT_DIR, "VIDEO_COMPLETE_FAST.mp4")
239
+ cmd = [
240
+ "ffmpeg", "-f", "concat", "-safe", "0", "-i", list_path,
241
+ "-c", "copy", out_path
242
+ ]
243
+ subprocess.run(cmd, check=True)
244
+ return out_path, "🎉 Vidéo finale assemblée instantanément (sans réencodage)"
245
+