Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -308,16 +308,15 @@ async def create_full_video_with_subtitles_v2(
|
|
| 308 |
print("--- STEP 1/6: ACQUIRING ASSETS ---")
|
| 309 |
with open(subtitle_path, "wb") as buffer:
|
| 310 |
shutil.copyfileobj(subtitle_file.file, buffer)
|
|
|
|
| 311 |
|
| 312 |
image_urls = json.loads(image_urls_json)
|
| 313 |
local_image_paths = []
|
| 314 |
|
| 315 |
async with aiohttp.ClientSession(headers=BROWSER_HEADERS) as session:
|
| 316 |
-
|
| 317 |
-
await download_asset(session, audio_url, audio_path)
|
| 318 |
print("SUCCESS: Audio downloaded.")
|
| 319 |
|
| 320 |
-
# Baixa imagens
|
| 321 |
for i, url in enumerate(image_urls):
|
| 322 |
local_path = os.path.join(temp_processing_dir, f"image_{i:02d}.jpg")
|
| 323 |
await download_asset(session, url, local_path)
|
|
@@ -358,7 +357,6 @@ async def create_full_video_with_subtitles_v2(
|
|
| 358 |
|
| 359 |
silent_video_path = os.path.join(temp_processing_dir, "silent_video_with_transitions.mp4")
|
| 360 |
|
| 361 |
-
# Correção final e crucial da sintaxe do filter_complex
|
| 362 |
final_filter_chain = f"{filter_complex_chain}[{last_stream}]format=yuv420p,fps=25[final_v]"
|
| 363 |
|
| 364 |
cmd_video_transitions = (
|
|
@@ -366,7 +364,6 @@ async def create_full_video_with_subtitles_v2(
|
|
| 366 |
f"-filter_complex \"{final_filter_chain}\" "
|
| 367 |
f"-map \"[final_v]\" -y {shlex.quote(silent_video_path)}"
|
| 368 |
)
|
| 369 |
-
|
| 370 |
await run_subprocess(cmd_video_transitions)
|
| 371 |
print("SUCCESS: Video with transitions created.")
|
| 372 |
|
|
|
|
| 308 |
print("--- STEP 1/6: ACQUIRING ASSETS ---")
|
| 309 |
with open(subtitle_path, "wb") as buffer:
|
| 310 |
shutil.copyfileobj(subtitle_file.file, buffer)
|
| 311 |
+
print("SUCCESS: Subtitle file saved.")
|
| 312 |
|
| 313 |
image_urls = json.loads(image_urls_json)
|
| 314 |
local_image_paths = []
|
| 315 |
|
| 316 |
async with aiohttp.ClientSession(headers=BROWSER_HEADERS) as session:
|
| 317 |
+
await download_asset(session, audio_url, audio_path, "audio")
|
|
|
|
| 318 |
print("SUCCESS: Audio downloaded.")
|
| 319 |
|
|
|
|
| 320 |
for i, url in enumerate(image_urls):
|
| 321 |
local_path = os.path.join(temp_processing_dir, f"image_{i:02d}.jpg")
|
| 322 |
await download_asset(session, url, local_path)
|
|
|
|
| 357 |
|
| 358 |
silent_video_path = os.path.join(temp_processing_dir, "silent_video_with_transitions.mp4")
|
| 359 |
|
|
|
|
| 360 |
final_filter_chain = f"{filter_complex_chain}[{last_stream}]format=yuv420p,fps=25[final_v]"
|
| 361 |
|
| 362 |
cmd_video_transitions = (
|
|
|
|
| 364 |
f"-filter_complex \"{final_filter_chain}\" "
|
| 365 |
f"-map \"[final_v]\" -y {shlex.quote(silent_video_path)}"
|
| 366 |
)
|
|
|
|
| 367 |
await run_subprocess(cmd_video_transitions)
|
| 368 |
print("SUCCESS: Video with transitions created.")
|
| 369 |
|