Trim audio online — slice to any window, hosted MP3 out.
Fotovid can trim audio without re-encoding — codec and bitrate pass through, so the clip matches its source. One call, nothing to install.
curl -X POST https://api.fotovid.co/v1/audio/trim \
-H "Authorization: Bearer p6_YOUR_KEY_ID:YOUR_SECRET" \
-H "Content-Type: application/json" \
-d '{
"source_url": "https://cdn.yoursite.com/voice-note.mp3",
"params": {
"start": 18.7,
"end": 42
}
}'Why not just run ffmpeg yourself?
Trimming audio is a one-line ffmpeg command — until you try to ship it on serverless. The ffmpeg binary is far larger than most function bundle limits, cold starts balloon, and you still have to download the source file, spawn a subprocess, capture the output, and push the result somewhere durable. That is a lot of undifferentiated plumbing for something as simple as trimming a clip.
- The ffmpeg static binary blows past Lambda/Vercel/Netlify bundle and memory limits, and layers are fragile to maintain
- You have to fetch the input, shell out to a subprocess, and stream stdout without blowing the function's disk or timeout
- The trimmed file still needs a home — you own the storage, hosting, and cleanup
- Reach for this endpoint when you want a ringtone, a short sample, a trimmed voice note, or a preview clip without operating any of that
Request parameters
POST /v1/audio/trim
| Field | Type | Default | Description |
|---|---|---|---|
| source_url* | string (URL) | — | HTTPS URL of the source audio (MP3, M4A, WAV, ...) |
| params.start* | string | number | — | "HH:MM:SS(.mmm)" or seconds (e.g. 18.73) |
| params.end* | string | number | — | Must be greater than start; truncated at EOF |
Your first call in three steps
- 1Get a free API key
Sign up and create a key from the dashboard. Every request authenticates with an Authorization: Bearer p6_<key_id>:<secret> header. New keys start with free usage credits — most operations, including audio trim, cost 1 credit ($1 = 100 credits).
- 2POST to /v1/audio/trim
Send a JSON envelope with source_url pointing at the https URL of your input audio and a params object holding start and end. Both accept either an HH:MM:SS.mmm timestamp string or a number of seconds — for example start: "00:00:12.500", end: "00:00:27". Fotovid downloads the source, slices that window, and encodes the result as MP3.
- 3Use the returned MP3 URL
The response is flat JSON: { id, type, url, expires_at, duration }. The url is a Fotovid-hosted MP3 of your trimmed clip. Play it directly or download it and store your own copy in your bucket so you control retention.
Frequently asked questions
Ship it with one API call
Grab a free key and make your first call in under five minutes.
