FFmpeg 6.0 or later is required for all video operations.
VideoTranscodeJob
Transcodes a video file to a different codec, bitrate, or encoding preset. Go method:Client.VideoTranscode(ctx, job)
Parameters
Path to the source video file.
Path for the transcoded output file.
Target video codec. Accepted values:
h264, h265, vp8, vp9, av1.Target video bitrate. Examples:
"2M", "5000k". Ignored when crf is set.Encoding speed preset. Accepted values:
ultrafast, fast, medium, slow, veryslow. Slower presets produce smaller files at the cost of encoding time.Constant Rate Factor for quality-based encoding. Range:
0 (lossless) to 51 (worst). A value of 23 is a good default for H.264.Audio codec for the output file. Examples:
"aac", "mp3", "opus".Codec comparison
| Codec | Best for | Notes |
|---|---|---|
h264 | General use | Best browser and device compatibility |
h265 | Storage efficiency | ~50% better compression than H.264 (HEVC) |
vp8 | WebM / older browsers | Open and royalty-free |
vp9 | WebM / modern browsers | Better compression than VP8 |
av1 | Maximum compression | Best quality per bit; slowest to encode |
Example
VideoResizeJob
Scales a video to specific dimensions, optionally preserving the aspect ratio. Go method:Client.VideoResize(ctx, job)
Parameters
Path to the source video file.
Path for the resized output file.
Target width in pixels. Can be omitted when
height is provided and maintain_aspect is true.Target height in pixels. Can be omitted when
width is provided and maintain_aspect is true.When
true, the unspecified dimension is calculated automatically to preserve the original aspect ratio. Defaults to false.