Update api/ltx_server.py
Browse files- api/ltx_server.py +12 -15
api/ltx_server.py
CHANGED
|
@@ -414,22 +414,19 @@ class VideoService:
|
|
| 414 |
return primeira, segunda
|
| 415 |
|
| 416 |
def _concat_mp4s_no_reencode(self, mp4_a: str, mp4_b: str, out_path: str):
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
except Exception: pass
|
| 430 |
|
| 431 |
-
|
| 432 |
-
|
| 433 |
# --- 6. GERAÇÃO ---
|
| 434 |
def generate(
|
| 435 |
self,
|
|
|
|
| 414 |
return primeira, segunda
|
| 415 |
|
| 416 |
def _concat_mp4s_no_reencode(self, mp4_a: str, mp4_b: str, out_path: str):
|
| 417 |
+
# Concat demuxer do ffmpeg (sem reencode)
|
| 418 |
+
with tempfile.NamedTemporaryFile("w", delete=False, suffix=".txt") as f:
|
| 419 |
+
f.write(f"file '{os.path.abspath(mp4_a)}'\n")
|
| 420 |
+
f.write(f"file '{os.path.abspath(mp4_b)}'\n")
|
| 421 |
+
list_path = f.name
|
| 422 |
+
cmd = f"ffmpeg -y -f concat -safe 0 -i {list_path} -c copy {out_path}"
|
| 423 |
+
print(f"[DEBUG] Concat: {cmd}")
|
| 424 |
+
try:
|
| 425 |
+
subprocess.check_call(shlex.split(cmd))
|
| 426 |
+
finally:
|
| 427 |
+
try: os.remove(list_path)
|
| 428 |
+
except Exception: pass
|
|
|
|
| 429 |
|
|
|
|
|
|
|
| 430 |
# --- 6. GERAÇÃO ---
|
| 431 |
def generate(
|
| 432 |
self,
|