video: fix flush of closed file error

Use wait() instead of communicate() after manually closing stdin.
communicate() tries to flush stdin which fails if already closed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
michael 2026-01-31 08:42:06 -06:00
parent 29322cb3a5
commit fa58a15e58

View file

@ -193,7 +193,8 @@ def generate_and_stream_frames(base_img, pet_img, vinyl_img, needle_img, audio_d
logger.info(f"Frame progress: {frame_num + 1}/{frames_per_rotation}")
ffmpeg_process.stdin.close()
stdout, stderr = ffmpeg_process.communicate()
ffmpeg_process.wait()
stderr = ffmpeg_process.stderr.read()
if ffmpeg_process.returncode != 0:
logger.error(f"FFmpeg error: {stderr.decode()}")