Update api/ltx_server.py
Browse files- api/ltx_server.py +14 -13
api/ltx_server.py
CHANGED
|
@@ -674,19 +674,20 @@ class VideoService:
|
|
| 674 |
return nova_lista
|
| 675 |
|
| 676 |
def _concat_mp4s_no_reencode(self, mp4_a: str, mp4_b: str, out_path: str):
|
| 677 |
-
|
| 678 |
-
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
|
|
|
| 690 |
|
| 691 |
def _concat_mp4s_no_reencode2(self, mp4_list: List[str], out_path: str):
|
| 692 |
"""
|
|
|
|
| 674 |
return nova_lista
|
| 675 |
|
| 676 |
def _concat_mp4s_no_reencode(self, mp4_a: str, mp4_b: str, out_path: str):
|
| 677 |
+
# Concat demuxer do ffmpeg (sem reencode)
|
| 678 |
+
import tempfile, subprocess, shlex, os
|
| 679 |
+
with tempfile.NamedTemporaryFile("w", delete=False, suffix=".txt") as f:
|
| 680 |
+
f.write(f"file '{os.path.abspath(mp4_a)}'\n")
|
| 681 |
+
f.write(f"file '{os.path.abspath(mp4_b)}'\n")
|
| 682 |
+
list_path = f.name
|
| 683 |
+
cmd = f"ffmpeg -y -f concat -safe 0 -i {list_path} -c copy {out_path}"
|
| 684 |
+
print(f"[DEBUG] Concat: {cmd}")
|
| 685 |
+
try:
|
| 686 |
+
subprocess.check_call(shlex.split(cmd))
|
| 687 |
+
finally:
|
| 688 |
+
try: os.remove(list_path)
|
| 689 |
+
except Exception: pass
|
| 690 |
+
|
| 691 |
|
| 692 |
def _concat_mp4s_no_reencode2(self, mp4_list: List[str], out_path: str):
|
| 693 |
"""
|