Calculate video bitrate and file size
calculate_bitrateCalculates the file size of a video export from its duration and bitrate, or (when target_size_mb is given) the highest video bitrate that fits that size with a 2% safety margin. Without an explicit bitrate it uses the reference value for the platform, resolution and frame rate (YouTube and Vimeo recommendations, Apple ProRes target data rates, or Rast's delivery target for Instagram and TikTok, which publish none). Also returns size-limit warnings (Meta 4 GB, TikTok ads 500 MB / 516 kbps) and a two-pass ffmpeg command.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fps | No | Frame rate, e.g. 24, 25, 29.97, 30, 50, 60. Default 30. 48 fps and above use the high-frame-rate tables. | |
| platform | No | Delivery target used for the reference bitrate: 'youtube', 'youtube_hdr', 'vimeo', 'instagram', 'tiktok', or a ProRes flavour ('prores_proxy', 'prores_lt', 'prores_422', 'prores_hq', 'prores_4444', 'prores_xq'). Default 'youtube'. | |
| audio_kbps | No | Audio bitrate in kbps; 0 = no audio. Default 320. | |
| resolution | No | '720p', '1080p' (also 1080x1920 vertical), '1440p', '2160p' (4K UHD) or 'dci4k' (4096x2160). Default '1080p'. | |
| target_size_mb | No | If set, calculate the maximum video bitrate that fits this file size in megabytes (1 MB = 1,000,000 bytes) instead of the file size. | |
| duration_seconds | Yes | Video length in seconds (e.g. 90 for 1:30). | |
| video_bitrate_mbps | No | Video bitrate in Mbps to calculate the file size with. Omit to use the platform reference value. |