fix(clips): +faststart en el render final para que el navegador reproduzca

El concat de reframe_v2 (el camino real de prod) y el merge de
process_video_to_vertical escribían el moov atom al final del MP4. Sin
faststart el <video> del navegador no puede empezar a reproducir hasta
descargar el fichero entero → el preview se queda con el spinner eterno.
Descargar el clip funcionaba (por eso pasó desapercibido), pero
previsualizarlo en la app no.

Verificado con ffprobe: antes moov al 98%, ahora al frente. Bug
preexistente, no introducido por el scrub de metadata.
This commit is contained in:
juancarlos.cavero 2026-07-23 11:11:05 +02:00
parent 6ea46ca5d2
commit 6dd3ef8117
2 changed files with 9 additions and 2 deletions

View file

@ -965,12 +965,14 @@ def process_video_to_vertical(input_video, final_output_video, aspect_ratio=ASPE
if os.path.exists(temp_audio_output): if os.path.exists(temp_audio_output):
merge_command = [ merge_command = [
'ffmpeg', '-y', '-i', temp_video_output, '-i', temp_audio_output, 'ffmpeg', '-y', '-i', temp_video_output, '-i', temp_audio_output,
'-c:v', 'copy', '-c:a', 'copy', *METADATA_SCRUB, final_output_video '-c:v', 'copy', '-c:a', 'copy', *METADATA_SCRUB,
'-movflags', '+faststart', final_output_video
] ]
else: else:
merge_command = [ merge_command = [
'ffmpeg', '-y', '-i', temp_video_output, 'ffmpeg', '-y', '-i', temp_video_output,
'-c:v', 'copy', *METADATA_SCRUB, final_output_video '-c:v', 'copy', *METADATA_SCRUB,
'-movflags', '+faststart', final_output_video
] ]
try: try:

View file

@ -239,6 +239,11 @@ def render(input_video, final_output_video, aspect_ratio):
"-i", input_video, "-i", input_video,
"-map", "0:v:0", "-map", "1:a:0?", "-map", "0:v:0", "-map", "1:a:0?",
"-c:v", "copy", "-c:a", "copy", *METADATA_SCRUB, "-c:v", "copy", "-c:a", "copy", *METADATA_SCRUB,
# +faststart moves the moov atom to the front so the browser <video>
# can start playing before the whole file downloads. Without it the
# in-app preview spins forever (download still works) — the moov
# lands at the end of a plain concat.
"-movflags", "+faststart",
final_output_video, final_output_video,
]) ])
finally: finally: