API Reference 2.0

Variables

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.

Usage

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"
    }
  }
}

Built-in variables

VariableTypeDescription
input.mime_typestring
input.file_sizeintsize in bytes
input.formatstring
input.widthint
input.heightint
input.fpsfloat
input.ifpsint
input.video_bitrateintbitrate in kbps
input.rotationintrotation in degrees. 0 if video is not rotated.
input.is_hdbooltrue if at least 720p
input.is_audio_onlybooltrue if audio only
input.durationintduration in second
input.video_codecstring
input.audio_codecstring
input.channelsint2 for stereo, 1 for mono, 0 for no audio
input.audio_bitrateintbitrate in kbps
input.sample_rateintsample rate in Hz

Metadata as variables

Since the API 2023-001, we also provide all the input metadata as variables.

VariableTypeValue
input.metadata.format.filenameString3dd060d9b4b09ea4cfa31ad1b9d67096
input.metadata.format.nb_streamsInteger2
input.metadata.format.nb_programsInteger0
input.metadata.format.format_nameStringmov,mp4,m4a,3gp,3g2,mj2
input.metadata.format.format_long_nameStringQuickTime / MOV
input.metadata.format.start_timeString0.000000
input.metadata.format.durationString60.067000
input.metadata.format.sizeString7047204
input.metadata.format.bit_rateString938579
input.metadata.format.probe_scoreInteger100
input.metadata.format.tags.major_brandStringisom
input.metadata.format.tags.minor_versionString512
input.metadata.format.tags.compatible_brandsStringisomiso2avc1mp41
input.metadata.format.tags.titleStringBig Buck Bunny, Sunflower version
input.metadata.format.tags.artistStringBlender Foundation 2008, Janus Bager Kristensen 2013
input.metadata.format.tags.composerStringSacha Goedegebure
input.metadata.format.tags.encoderStringLavf57.25.100
input.metadata.format.tags.commentStringCreative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
input.metadata.format.tags.genreStringAnimation
input.metadata.streams.lengthInteger2
input.metadata.streams[0].indexInteger0
input.metadata.streams[0].codec_nameStringh264
input.metadata.streams[0].codec_long_nameStringH.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
input.metadata.streams[0].profileStringHigh
input.metadata.streams[0].codec_typeStringvideo
input.metadata.streams[0].codec_time_baseString1/60
input.metadata.streams[0].codec_tag_stringStringavc1
input.metadata.streams[0].codec_tagString0x31637661
input.metadata.streams[0].widthInteger854
input.metadata.streams[0].heightInteger480
input.metadata.streams[0].coded_widthInteger864
input.metadata.streams[0].coded_heightInteger480
input.metadata.streams[0].has_b_framesInteger2
input.metadata.streams[0].sample_aspect_ratioString1280:1281
input.metadata.streams[0].display_aspect_ratioString16:9
input.metadata.streams[0].pix_fmtStringyuv420p
input.metadata.streams[0].levelInteger31
input.metadata.streams[0].chroma_locationStringleft
input.metadata.streams[0].refsInteger1
input.metadata.streams[0].is_avcStringtrue
input.metadata.streams[0].nal_length_sizeString4
input.metadata.streams[0].r_frame_rateString30/1
input.metadata.streams[0].avg_frame_rateString30/1
input.metadata.streams[0].time_baseString1/15360
input.metadata.streams[0].start_ptsInteger323
input.metadata.streams[0].start_timeFloat0.021029
input.metadata.streams[0].duration_tsInteger922624
input.metadata.streams[0].durationFloat60.066667
input.metadata.streams[0].bit_rateInteger865345
input.metadata.streams[0].bits_per_raw_sampleInteger8
input.metadata.streams[0].nb_framesInteger1802
input.metadata.streams[0].tags.languageStringund
input.metadata.streams[0].tags.handler_nameStringVideoHandler
input.metadata.streams[1].indexInteger1
input.metadata.streams[1].codec_nameStringaac
input.metadata.streams[1].codec_long_nameStringAAC (Advanced Audio Coding)
input.metadata.streams[1].profileStringLC
input.metadata.streams[1].codec_typeStringaudio
input.metadata.streams[1].codec_time_baseString1/48000
input.metadata.streams[1].codec_tag_stringStringmp4a
input.metadata.streams[1].codec_tagString0x6134706d
input.metadata.streams[1].sample_fmtStringfltp
input.metadata.streams[1].sample_rateString48000
input.metadata.streams[1].channelsInteger6
input.metadata.streams[1].channel_layoutString5.1
input.metadata.streams[1].bits_per_sampleInteger0
input.metadata.streams[1].r_frame_rateString0/0
input.metadata.streams[1].avg_frame_rateString0/0
input.metadata.streams[1].time_baseString1/48000
input.metadata.streams[1].start_ptsInteger0
input.metadata.streams[1].start_timeFloat0.000000
input.metadata.streams[1].duration_tsInteger2880512
input.metadata.streams[1].durationFloat60.010667
input.metadata.streams[1].bit_rateInteger64505
input.metadata.streams[1].max_bit_rateInteger64505
input.metadata.streams[1].nb_framesInteger2813
input.metadata.streams[1].tags.languageStringund
input.metadata.streams[1].tags.handler_nameStringSoundHandler