Prerequisites
Before you begin, you’ll need:
- An FFHub account (sign up here)
- An API key from your dashboard
FFmpeg API Quickstart
1. Create a transcoding task
Submit an FFmpeg command to transcode a video:
curl -X POST https://api.ffhub.io/v1/tasks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"command": "ffmpeg -i https://storage.ffhub.io/Sample_Video_File_100MB.mp4 -c:v libx264 -preset fast output.mp3"
}'
2. Check task status
Poll the task endpoint to check progress:
curl https://api.ffhub.io/v1/tasks/{task_id} \
-H "Authorization: Bearer YOUR_API_KEY"
3. Get results
When the task completes, you’ll receive the output file URLs:
{
"task_id": "abc123",
"status": "completed",
"progress": 100,
"outputs": [
{
"filename": "output.mp4",
"url": "https://storage.ffhub.io/outputs/abc123/output.mp4",
"size": 1234567
}
]
}
Storage API Quickstart
Upload a file
curl -X POST https://files-api.ffhub.io/api/upload/file \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@/path/to/image.png"
curl -X POST https://files-api.ffhub.io/api/upload/base64 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"data": "data:image/png;base64,iVBORw0KGgo..."}'
curl -X POST https://files-api.ffhub.io/api/upload/url \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/image.png"}'
Response
All upload methods return the same response format:
{
"url": "https://storage.ffhub.io/uploads/user123/abc123.png",
"cn_url": "https://beijing-user-upload-tmp.tos-cn-beijing.volces.com/uploads/user123/abc123.png",
"key": "uploads/user123/abc123.png",
"size": 12345,
"content_type": "image/png",
"expires_at": "2024-01-17T00:00:00.000Z"
}
Files expire after 1 day. Download them before expiration if you need permanent storage.
Next Steps