Skip to main content

FFmpeg Editor API

Process and transform media using your own FFmpeg command safely on our infrastructure. Submit a job with your media and a command template, then poll the job until it finishes and download the result.

Endpoint​

POST /api/uploadposts/ffmpeg/jobs/upload

Headers​

NameValueDescription
AuthorizationApikey your-api-key-hereYour API key for authentication.

Parameters​

NameTypeRequiredDescription
fileFile (binary)YesMedia file to process.
full_commandStringYesFFmpeg command template that MUST use {input} and {output} placeholders. Example: ffmpeg -y -i {input} -c:v libx264 -crf 23 {output}
output_extensionStringYesDesired output file extension (e.g., mp4, wav, mp3, mov, webm).

Note: A job is charged for the longer of its inputs and its output: max(input duration, output duration). When the job is accepted, the quota reserved is the longest of the input duration, any duration the command declares (-t, -to, a lavfi d=/duration=), and the inputs multiplied by the repetitions of -stream_loop N when nothing bounds the output. When the job finishes, the charge is settled at max(measured inputs, measured output), so a looped or generated output is charged for its real length and a declared -t longer than what was produced is given back. If the duration of the input media cannot be detected, the system assumes 60 seconds until the output is measured.

Command Template Rules​

For security and reliability, only safe FFmpeg commands are accepted.

  • Use placeholders: {input} (or indexed {input0}, {input1}, …) for input files and {output} for the output file; do not hardcode filenames. The first input can be referenced as {input} or {input0}.
  • Allowed pattern starts with ffmpeg and may include typical flags (e.g., -y, -i, -c:v, -c:a, -r, -b:v, filters, etc.).
  • Every -i must be an uploaded input ({input}, {input0}, {input1}, …) or a generated source with -f lavfi (e.g. -f lavfi -i color=c=black:s=1080x1920:d=5). {output} is the only output allowed.
  • No protocols or URLs inside the command (http://, https://, concat:, subfile,, file:, tcp:, …). Send remote media in files or input_url and reference it as {input0}, {input1}, … The only pipe allowed is -progress pipe:1 / -progress pipe:2.
  • Filters that open files or sockets on their own are rejected: movie=, amovie=, sendcmd, zmq, ladspa, lv2, frei0r. File arguments such as textfile=, subtitles=, ass= or lut3d= may only reference uploaded inputs ({input1}, …).
  • No absolute paths and no ... The only exception is system fonts under /usr/share/fonts/ (e.g. fontfile=/usr/share/fonts/...).
  • -safe 0 is rejected, as are options that write extra files (-dump_attachment, -vstats_file, -passlogfile, -hls_segment_filename, …).
  • Commands that would never end need a bound: -stream_loop -1, -loop 1 or a lavfi source without a duration require -t, -shortest or -frames. -stream_loop accepts values from -1 to 100.
  • Blocked characters/constructs to prevent command injection: ;, |, &, $, \``, $(, and destructive commands like rm/rmdir`.
  • Newlines and carriage returns in the command string are automatically replaced with spaces (not blocked), so pasting multi-line commands works. To render multi-line text in the drawtext filter, use the literal escape \n (backslash + n) — in JSON, send \\n.
  • If validation fails, the API returns 400 Bad Request with a helpful message.

Responses​

  • 202 Accepted (job created)
{
"success": true,
"job_id": "a97bbb5a-139b-46ca-b893-6e8d303d5934",
"status": "PENDING"
}

Check Job Status​

Poll the job until it finishes.

GET /api/uploadposts/ffmpeg/jobs/{job_id}

Example response:

{
"job_id": "a97bbb5a-139b-46ca-b893-6e8d303d5934",
"status": "FINISHED",
"duration_seconds": 120,
"output_extension": "mp4",
"result": {
"media_url": "https://<storage>/mcp-ingest/tmp/.../output.mp4?X-Amz-Signature=...",
"media_url_expires_in_seconds": 21600,
"download_url": "https://api.upload-post.com/api/uploadposts/ffmpeg/jobs/a97bbb5a-139b-46ca-b893-6e8d303d5934/download",
"download_auth": "Authorization: Apikey <your Upload-Post API key>"
}
}

Statuses: PENDING, PROCESSING, FINISHED, ERROR.

Two ways to get a finished output:

  • result.media_url is a temporary public link to a copy of the output (video and image outputs only). It needs no API key, so you can pass it straight to the upload endpoints as video_url or photos[], or to an n8n / Make step, to publish the processed file without downloading it. The signature in the link lasts media_url_expires_in_seconds; poll the job again to get a fresh one. The copy itself is deleted 24 hours after the job finished, so publish or download within that window.
  • result.download_url is the authenticated endpoint described below. It requires your API key, so it is not a public link: do not pass it as video_url.

Audio outputs (wav, mp3, ...) only get download_url.

Download Result​

When status is FINISHED, download the processed file.

GET /api/uploadposts/ffmpeg/jobs/{job_id}/download

Response headers include the appropriate Content-Type and a Content-Disposition attachment filename (e.g., output.mp4, output.wav). The response body is the binary media.

Example: Convert to MP4 (H.264)​

curl \
-H 'Authorization: Apikey your-api-key-here' \
-F 'file=@/path/to/input.mov' \
-F 'full_command=ffmpeg -y -i {input} -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 128k {output}' \
-F 'output_extension=mp4' \
-X POST https://api.upload-post.com/api/uploadposts/ffmpeg/jobs/upload

Example: Extract Audio to WAV​

curl \
-H 'Authorization: Apikey your-api-key-here' \
-F 'file=@/path/to/input.mp4' \
-F 'full_command=ffmpeg -y -i {input} -vn -acodec pcm_s16le -ar 44100 -ac 2 {output}' \
-F 'output_extension=wav' \
-X POST https://api.upload-post.com/api/uploadposts/ffmpeg/jobs/upload

Concatenate/Merge multiple videos (NEW)​

The API now supports multiple input files for operations like concatenation. You can use placeholders {input0}, {input1}, {input2}, etc., in full_command.

Option A: Send multiple URLs (JSON endpoint)​

curl -X POST https://api.upload-post.com/api/uploadposts/ffmpeg/jobs/upload \
-H 'Content-Type: application/json' \
-H 'Authorization: Apikey your-api-key-here' \
-d '{
"files": [
"https://tu-cdn.com/video1.mp4",
"https://tu-cdn.com/video2.mp4",
"https://tu-cdn.com/video3.mp4"
],
"full_command": "ffmpeg -y -hide_banner -i {input0} -i {input1} -i {input2} -filter_complex \"[0:v][0:a][1:v][1:a][2:v][2:a]concat=n=3:v=1:a=1[outv][outa]\" -map \"[outv]\" -map \"[outa]\" -c:v h264_nvenc -preset p5 -cq 23 -c:a aac -b:a 128k {output}",
"output_extension": "mp4",
"publish": true
}'

Option B: Upload multiple files (multipart/form-data)​

curl -X POST https://api.upload-post.com/api/uploadposts/ffmpeg/jobs/upload \
-H 'Authorization: Apikey your-api-key-here' \
-F "file=@/ruta/video1.mp4" \
-F "file1=@/ruta/video2.mp4" \
-F "file2=@/ruta/video3.mp4" \
-F 'full_command=ffmpeg -y -hide_banner -i {input0} -i {input1} -i {input2} -filter_complex "[0:v][0:a][1:v][1:a][2:v][2:a]concat=n=3:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -c:v h264_nvenc -preset p5 -cq 23 -c:a aac -b:a 128k {output}' \
-F "output_extension=mp4" \
-F "publish=true"

Concatenation examples​

Simple concatenation (2 videos):

{
"files": ["https://cdn.com/part1.mp4", "https://cdn.com/part2.mp4"],
"full_command": "ffmpeg -y -i {input0} -i {input1} -filter_complex \"[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]\" -map \"[v]\" -map \"[a]\" -c:v h264_nvenc -cq 23 -c:a aac {output}",
"output_extension": "mp4"
}

Concatenation with re-encoding (multiple videos):

{
"files": [
"https://cdn.com/intro.mp4",
"https://cdn.com/contenido.mp4",
"https://cdn.com/outro.mp4"
],
"full_command": "ffmpeg -y -hwaccel cuda -i {input0} -i {input1} -i {input2} -filter_complex \"[0:v][0:a][1:v][1:a][2:v][2:a]concat=n=3:v=1:a=1[outv][outa]\" -map \"[outv]\" -map \"[outa]\" -c:v h264_nvenc -preset p5 -rc vbr -cq 23 -b:v 4M -c:a aac -b:a 128k {output}",
"output_extension": "mp4"
}

About the concat demuxer: a concat list (-f concat -i list.txt) needs paths to the other files and usually -safe 0, and both absolute paths and -safe 0 are rejected. Use the concat filter shown above instead.

{input} still points to the first file. Extra files are {input0}, {input1}, {input2}, … The presets (h264_social, hevc_social, copy_mux) and ffmpeg_args only accept one file; multiple inputs need full_command.

Example: Draw Multi-Line Text on Video​

Use the drawtext filter with \n for line breaks. In JSON, escape as \\n:

curl \
-H 'Authorization: Apikey your-api-key-here' \
-F 'file=@/path/to/input.mp4' \
-F 'full_command=ffmpeg -y -i {input} -vf "drawtext=text='"'"'Line 1\nLine 2\nLine 3'"'"':fontsize=24:fontcolor=white:x=10:y=10" {output}' \
-F 'output_extension=mp4' \
-X POST https://api.upload-post.com/api/uploadposts/ffmpeg/jobs/upload

JSON body example:

{
"full_command": "ffmpeg -y -i {input} -vf \"drawtext=text='Hello World\\nSecond Line':fontsize=28:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2\" {output}",
"output_extension": "mp4",
"input_url": "https://example.com/video.mp4"
}

Quotas by Plan (minutes of media/month)​

PlanMinutes/Month
free30
basic300
professional1000
advanced3000
business10000

Resets on the 1st of each month at 00:00 UTC.

Check Your FFmpeg Consumption​

To check your current FFmpeg usage and remaining quota, use:

GET /api/uploadposts/ffmpeg/consumption

Example response:

{
"success": true,
"consumption": {
"used_minutes": 45.5,
"remaining_minutes": 254.5,
"quota_minutes": 300,
"usage_percentage": 15.2,
"total_requests": 12,
"current_month": "2024-01",
"plan": "basic"
},
"history": [
{
"duration_seconds": 180,
"duration_minutes": 3.0,
"timestamp": "2024-01-15T10:30:00.000Z",
"month": "2024-01",
"type": "video_processing"
}
],
"quota_info": {
"plan": "basic",
"quota_minutes": 300,
"reset_day": 1,
"next_reset": "2024-02-01"
}
}

You can also view your FFmpeg usage on the API Keys page.

Errors​

  • 400 Bad Request: Invalid or unsafe FFmpeg command (see Command Template Rules), missing parameters. The error field says which part of the command was rejected.
  • 401 Unauthorized: Invalid or expired API key.
  • 404 Not Found: Job not found.
  • 429 Too Many Requests: Monthly quota exceeded (response includes current usage when applicable).
  • 500 Internal Server Error: Processing error.

Notes​

  • Jobs are asynchronous; always poll the job status before attempting to download the output.
  • Each job is charged max(input duration, output duration): looping or generating media is charged for the output it produces.