Variables are useful to make conditional outputs. For example, you can avoid upscaling, create a shorter video if the duration is longer than 5 minutes, cap the FPS if original video is > 60FPS, etc. Very powerful and flexible.
Variables must be used inside curly brackets like this: {{ variable }}
{
"outputs": {
"mp4:1080p::quality=4": {
"key": "mp4:1080p",
"path": "/mp4/1080p/video.mp4",
"if": "{{ input.width }} >= 1920"
},
"mp4:2160p::quality=4": {
"key": "mp4:2160p",
"path": "/mp4/2160p/video.mp4",
"if": "{{ input.width }} >= 3840"
}
}
}
Variable | Type | Description |
---|---|---|
input.mime_type | string | |
input.file_size | int | size in bytes |
input.format | string | |
input.width | int | |
input.height | int | |
input.fps | float | |
input.ifps | int | |
input.video_bitrate | int | bitrate in kbps |
input.rotation | int | rotation in degrees. 0 if video is not rotated. |
input.is_hd | bool | true if at least 720p |
input.is_audio_only | bool | true if audio only |
input.duration | int | duration in second |
input.video_codec | string | |
input.audio_codec | string | |
input.channels | int | 2 for stereo, 1 for mono, 0 for no audio |
input.audio_bitrate | int | bitrate in kbps |
input.sample_rate | int | sample rate in Hz |
Since the API 2023-001, we also provide all the input metadata as variables.
Variable | Type | Value |
---|---|---|
input.metadata.format.filename | String | 3dd060d9b4b09ea4cfa31ad1b9d67096 |
input.metadata.format.nb_streams | Integer | 2 |
input.metadata.format.nb_programs | Integer | 0 |
input.metadata.format.format_name | String | mov,mp4,m4a,3gp,3g2,mj2 |
input.metadata.format.format_long_name | String | QuickTime / MOV |
input.metadata.format.start_time | String | 0.000000 |
input.metadata.format.duration | String | 60.067000 |
input.metadata.format.size | String | 7047204 |
input.metadata.format.bit_rate | String | 938579 |
input.metadata.format.probe_score | Integer | 100 |
input.metadata.format.tags.major_brand | String | isom |
input.metadata.format.tags.minor_version | String | 512 |
input.metadata.format.tags.compatible_brands | String | isomiso2avc1mp41 |
input.metadata.format.tags.title | String | Big Buck Bunny, Sunflower version |
input.metadata.format.tags.artist | String | Blender Foundation 2008, Janus Bager Kristensen 2013 |
input.metadata.format.tags.composer | String | Sacha Goedegebure |
input.metadata.format.tags.encoder | String | Lavf57.25.100 |
input.metadata.format.tags.comment | String | Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net |
input.metadata.format.tags.genre | String | Animation |
input.metadata.streams.length | Integer | 2 |
input.metadata.streams[0].index | Integer | 0 |
input.metadata.streams[0].codec_name | String | h264 |
input.metadata.streams[0].codec_long_name | String | H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 |
input.metadata.streams[0].profile | String | High |
input.metadata.streams[0].codec_type | String | video |
input.metadata.streams[0].codec_time_base | String | 1/60 |
input.metadata.streams[0].codec_tag_string | String | avc1 |
input.metadata.streams[0].codec_tag | String | 0x31637661 |
input.metadata.streams[0].width | Integer | 854 |
input.metadata.streams[0].height | Integer | 480 |
input.metadata.streams[0].coded_width | Integer | 864 |
input.metadata.streams[0].coded_height | Integer | 480 |
input.metadata.streams[0].has_b_frames | Integer | 2 |
input.metadata.streams[0].sample_aspect_ratio | String | 1280:1281 |
input.metadata.streams[0].display_aspect_ratio | String | 16:9 |
input.metadata.streams[0].pix_fmt | String | yuv420p |
input.metadata.streams[0].level | Integer | 31 |
input.metadata.streams[0].chroma_location | String | left |
input.metadata.streams[0].refs | Integer | 1 |
input.metadata.streams[0].is_avc | String | true |
input.metadata.streams[0].nal_length_size | String | 4 |
input.metadata.streams[0].r_frame_rate | String | 30/1 |
input.metadata.streams[0].avg_frame_rate | String | 30/1 |
input.metadata.streams[0].time_base | String | 1/15360 |
input.metadata.streams[0].start_pts | Integer | 323 |
input.metadata.streams[0].start_time | Float | 0.021029 |
input.metadata.streams[0].duration_ts | Integer | 922624 |
input.metadata.streams[0].duration | Float | 60.066667 |
input.metadata.streams[0].bit_rate | Integer | 865345 |
input.metadata.streams[0].bits_per_raw_sample | Integer | 8 |
input.metadata.streams[0].nb_frames | Integer | 1802 |
input.metadata.streams[0].tags.language | String | und |
input.metadata.streams[0].tags.handler_name | String | VideoHandler |
input.metadata.streams[1].index | Integer | 1 |
input.metadata.streams[1].codec_name | String | aac |
input.metadata.streams[1].codec_long_name | String | AAC (Advanced Audio Coding) |
input.metadata.streams[1].profile | String | LC |
input.metadata.streams[1].codec_type | String | audio |
input.metadata.streams[1].codec_time_base | String | 1/48000 |
input.metadata.streams[1].codec_tag_string | String | mp4a |
input.metadata.streams[1].codec_tag | String | 0x6134706d |
input.metadata.streams[1].sample_fmt | String | fltp |
input.metadata.streams[1].sample_rate | String | 48000 |
input.metadata.streams[1].channels | Integer | 6 |
input.metadata.streams[1].channel_layout | String | 5.1 |
input.metadata.streams[1].bits_per_sample | Integer | 0 |
input.metadata.streams[1].r_frame_rate | String | 0/0 |
input.metadata.streams[1].avg_frame_rate | String | 0/0 |
input.metadata.streams[1].time_base | String | 1/48000 |
input.metadata.streams[1].start_pts | Integer | 0 |
input.metadata.streams[1].start_time | Float | 0.000000 |
input.metadata.streams[1].duration_ts | Integer | 2880512 |
input.metadata.streams[1].duration | Float | 60.010667 |
input.metadata.streams[1].bit_rate | Integer | 64505 |
input.metadata.streams[1].max_bit_rate | Integer | 64505 |
input.metadata.streams[1].nb_frames | Integer | 2813 |
input.metadata.streams[1].tags.language | String | und |
input.metadata.streams[1].tags.handler_name | String | SoundHandler |