Skip to Content
MediaTofu

Tools

Eight simple endpoints that build the FFmpeg command for you.

Each tool is POST /v1/tools/<name> with a JSON body. They run on the same engine as Run FFmpeg.

curl "https://api.mediatofu.com/v1/tools/resize?wait=25" \
  -H "Authorization: Bearer $MEDIATOFU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "input": "https://example.com/clip.mov", "width": 1280 }'

Every tool takes these two fields, plus its own options below:

FieldRequiredDescription
inputYesA public URL or a file id.
webhook_urlNoA URL to notify when the job finishes. Paid plans only.

Options marked with a time accept seconds (90 or 1.5) or a timestamp (1:30 or 00:01:30.5).

probe

Reads a file's format and streams with ffprobe. The JSON appears in the job's result field. There are no options and no output files.

compress

Re-encodes video as H.264 with AAC audio at 128 kbps. Output: out.mp4.

OptionTypeRangeDefault
crfwhole number18 to 4028
max_heightwhole number144 to 2160No scaling

A lower crf means higher quality and a larger file. max_height caps the height and keeps the aspect ratio. Smaller videos aren't scaled up.

convert

Changes format. Output: out.<format>.

OptionTypeValuesDefault
formatstringmp4, webm, mov, mkv, mp3, m4a, wav, ogg, flacRequired

mp4, mov and mkv use H.264 and AAC at CRF 23. webm uses VP9 and Opus. Audio formats drop the video: mp3 is LAME at quality 2, m4a is AAC at 192 kbps, wav is 16-bit PCM, ogg is Vorbis at quality 5, and flac is lossless.

resize

Scales a video. Give width, height or both. If you give one, the other is set to keep the aspect ratio. Re-encodes as H.264 and AAC. Output: out.mp4.

OptionTypeRangeDefault
widthwhole number16 to 3840Unset
heightwhole number16 to 2160Unset

trim

Cuts a section from a video or audio file without re-encoding, so cuts land on the nearest keyframes. The input must have one of the extensions listed under convert, or no extension, which is treated as mp4. Output: out.<ext>, the input's extension.

OptionTypeDefault
starttime0
endtimeUnset, give this or duration
durationtimeUnset, give this or end

If you send both end and duration, end is used.

thumbnail

Saves one frame as a JPEG. Output: out.jpg.

OptionTypeRangeDefault
attimeAny0
widthwhole number16 to 3840The video's width

extract-audio

Pulls out the audio track. Output: out.<format>.

OptionTypeValuesDefault
formatstringmp3, m4a, wav, ogg, flacmp3

gif

Turns a section of video into an animated GIF. Output: out.gif.

OptionTypeRangeDefault
starttimeAny0
durationtimeAny5
widthwhole number16 to 1280480
fpswhole number1 to 3012

Option errors

Bad options return status 400 with a message naming the field, such as crf must be a whole number from 18 to 40. or format must be one of mp4, webm, mov, mkv, mp3, m4a, wav, ogg, flac. See Errors.

On this page