Video Transformation
Apply transformations to videos without re-uploading. All transformation commands use FFmpeg syntax — the industry-standard tool for video and audio processing.
How it works
Pass FFmpeg commands via the format query parameter. GFile executes the transformation, caches the result as a sub-file, and returns the processed output. Use $INPUT and $OUTPUT.<ext> as placeholders for the source and destination files.
/api/v1/tenants/:tenantId/buckets/:bucketId/files/:fileId/format?format=<ffmpeg-command>&apiKey=<your-api-key>
Available transformations
| Operation | Command | Description |
|---|---|---|
| Extract audio | -vn -acodec copy |
Strip video, keep audio |
| Trim/clip | -ss <start> -t <duration> |
Cut a segment from a video |
| Extract frame | -ss <time> -frames:v 1 |
Capture a single frame as image |
| Re-encode | -c:v libx264 -c:a aac |
Transcode to H.264/AAC |
| Change resolution | -vf scale=1280:720 |
Resize video |
| Remove audio | -an |
Strip audio track |
| Change format | $OUTPUT.<ext> |
Convert container (mp4, webm, avi) |
| Adjust speed | -filter:v "setpts=0.5*PTS" |
Speed up video (2x) |
| Extract thumbnail | -vf "thumbnail" -frames:v 1 |
Auto-select best frame |
Examples
Extract audio from video
Strip the video track and extract only the audio stream.
curl "/api/v1/tenants/:tenantId/buckets/:bucketId/files/:fileId/format?format=-i $INPUT -vn -acodec copy $OUTPUT.aac&apiKey=<your-api-key>"
-i $INPUTspecifies the source video-vndisables video recording-acodec copycopies the audio stream without re-encoding (fast, lossless)$OUTPUT.aacsets the output format to AAC audio
Create a clip from a video
Cut a specific time segment without re-encoding.
curl "/api/v1/tenants/:tenantId/buckets/:bucketId/files/:fileId/format?format=-i $INPUT -ss 30 -t 10 -c copy $OUTPUT.mp4&apiKey=<your-api-key>"
-ss 30seeks to the 30-second mark as the start point-t 10limits the output duration to 10 seconds-c copycopies both audio and video streams without re-encoding (fast)
Extract a frame as an image
Capture a single frame at a specific timestamp.
curl "/api/v1/tenants/:tenantId/buckets/:bucketId/files/:fileId/format?format=-i $INPUT -ss 5 -frames:v 1 $OUTPUT.jpg&apiKey=<your-api-key>"
-ss 5seeks to the 5-second mark-frames:v 1extracts exactly one video frame$OUTPUT.jpgsaves the frame as a JPEG image
Resize video resolution
Scale a video to a different resolution.
curl "/api/v1/tenants/:tenantId/buckets/:bucketId/files/:fileId/format?format=-i $INPUT -vf scale=1280:720 -c:a copy $OUTPUT.mp4&apiKey=<your-api-key>"
-vf scale=1280:720resizes to 1280×720 (720p)-c:a copykeeps the audio stream unchanged
Convert video format
Transcode a video to a different container or codec.
curl "/api/v1/tenants/:tenantId/buckets/:bucketId/files/:fileId/format?format=-i $INPUT -c:v libx264 -c:a aac $OUTPUT.mp4&apiKey=<your-api-key>"
-c:v libx264encodes video with H.264 codec-c:a aacencodes audio with AAC codec
Get video metadata
Retrieve detailed technical information (duration, codecs, bitrate):
curl "/api/v1/tenants/:tenantId/buckets/:bucketId/files/:fileId/info?apiKey=<your-api-key>"
Returns FFprobe JSON with streams, format, duration, codecs, and bitrate.