ai-coding-minesIndexGitHub

On a 512MB instance, ffmpeg takes the whole worker down

Deploy and infrastructure

Symptom (it doesn't say OOM, so you don't recognize it)

Cause

With the Python process resident, fork+exec of ffmpeg as a subprocess spikes memory momentarily. The real peak came from libx264 re-encoding.

Fix — don't re-encode

If the source is already h264 mp4, just swap the audio.

ffmpeg -i v.mp4 -i a.mp3 -map 0:v:0 -map 1:a:0 \
  -c:v copy -c:a aac -b:a 128k -shortest -movflags +faststart out.mp4

Fallback: -preset ultrafast -crf 28 -threads 1

Note

WEB_CONCURRENCY=1 by default in the logs means you are on the smallest instance.