- Advanced Topics
- Command Chaining
Command Chaining
Run multiple FFmpeg commands sequentially on the same machine.
Run multiple FFmpeg commands sequentially on the same machine. This is efficient for multi-step pipelines as intermediate files stay local.
When to Use This
Use command chaining when a later command needs a file made by an earlier command.
Common uses:
- Create an intermediate encode, then package it.
- Extract frames, then encode a preview.
- Make many outputs from one downloaded input.
Example
{
"input_files": { "raw": "https://example.com/large.mov" },
"output_files": ["final.mp4"],
"ffmpeg_commands": [
"-i {{raw}} -vf scale=1920:1080 temp.mp4",
"-i temp.mp4 -c:v libx264 -crf 23 {{final.mp4}}"
]
}Each command in the ffmpeg_commands array runs in order. Files produced by an
earlier command, like temp.mp4, can be referenced by later commands.
Output Files
Only list files you want returned in output_files.
Intermediate files can be used in later commands without being listed as outputs.
{
"output_files": ["final.mp4"],
"ffmpeg_commands": [
"-i {{raw}} -vf scale=1920:1080 temp.mp4",
"-i temp.mp4 -c:v libx264 {{final.mp4}}"
]
}Notes
- Commands stop at the first failure.
- All commands run on the same worker.
- Intermediate files are not uploaded unless they are listed in
output_files.