Job Ran Out of Memory
Why a job with many large inputs can fail partway through, and how to split it
You will see this when a job needs more memory than its worker has:
> FFmpeg command failed: the job ran out of memory and FFmpeg was stopped before
> it finished (SIGKILL). Split the work into smaller jobs or use lower-resolution
> sources: every input is decoded at full size, so several 4K clips in one job
> need the most memory.
The job ends with status failed and no output file.
Cause
When a job combines inputs with filters (scaling, cropping, concatenating,
overlaying), FFmpeg decodes every input at its full resolution and holds frames
from all of them while it works. Memory grows with the number of inputs and with
their resolution. A handful of 1080p clips is fine. Eight or ten 4K clips in a
single concat can need more memory than one worker has.
Solutions
Split the job
Concatenate in batches, then join the results. For ten clips, run two jobs of
five, then a third job that concatenates the two outputs. Each job holds far
fewer frames at once.
Scale the inputs down first
If the final video is 1080p or smaller, there is no need to feed 4K into the
combining job. Run one job per clip that scales it down:
{
"inputs": [{ "url": "https://example.com/clip-4k.mp4" }],
"outputFormat": "mp4",
"options": [{ "option": "-vf", "argument": "scale=-2:1080" }]
}
Then combine the smaller outputs.
Use lower-resolution sources
If you control the source files, export them at the resolution you need rather
than at 4K.
A related message
> FFmpeg crashed (SIGSEGV) before it finished
That is a crash inside FFmpeg rather than a memory limit. Try the job again. If
it happens again with the same inputs, email javid@ffmpeg-micro.com with the job
ID.
Can't find what you're looking for?