Zencoder Encoding Settings: Frame Rate

Product(s)
Zencoder
Role(s)
API Developer
Topic(s)
Encoding Settings
API(s)
Zencoder API

This topic contains details for encoding settings related to the video frame rate.

frame_rate

frame_rate:Float

API Versions: V1, V2

Parent: outputs

Default: The original (input) frame rate.

Compatible Job Types: All

Example: 25

Description:

The output frame rate to use, as a decimal number (e.g. 15, or 24.98).

We recommend that you do not use this setting – forcing a change to the video frame rate will result in a lower-quality video. If you want to prevent frame rates above a certain level, use max_frame_rate instead.

Frame rates above 60 are not allowed for resolutions greater than HD (i.e. 1920x1080).

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "frame_rate": 25
    }
  ]
}

See Also: max_frame_rate and decimate

max_frame_rate

max_frame_rate:Float

API Versions: V1, V2

Parent: outputs

Compatible Job Types: All

Example: 30

Description:

Limits the output frame rate to a certain number. If the frame rate would otherwise exceed this number (e.g. the input frame rate is too high), this will reduce the frame rate to the max_frame_rate setting

Example: if you set max_frame_rate to 29.97, and the input has a frame rate of 59.94, the output file will have a frame rate of 29.97.

We recommend using this setting rather than setting an exact frame_rate, for two reasons:

First, changing a frame_rate can result in a visual quality drop due to stuttering and jerky motion.

Second, setting frame rate to a fixed number may actually increase the frame rate of the output video beyond the frame rate of the input, which would result in an unneeded increase in file size (or decrease in quality).

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "max_frame_rate": 30
    }
  ]
}

See Also: frame_rate and decimate

decimate

decimate:Integer

API Versions: V1, V2

Parent: outputs

Valid Values: A positive integer

Compatible Job Types: All

Example: 2

Description:

Divide the input frame rate by the specified number. This is useful if you know you want to cut frame rate in half, but you don’t know what the input frame rate is. Given an input frame rate of 20, if you set decimate to 2, you’ll get an output frame rate of 10. You can still set max_frame_rate if you want to ensure that a decimated frame rate does not exceed a certain value.

 

The output video will have a frame_rate that is equal to the input frame rate divided by the decimate value. So if the input is 24 fps, and you set decimate to 4, the output would be 6 fps (24 / 4).

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "decimate": 2
    }
  ]
}

See Also: frame_rate and max_frame_rate

keyframe_interval

keyframe_interval:Integer

API Versions: V1, V2

Parent: outputs

Default: 250

Valid Values: A positive integer

Compatible Job Types: All

Example: 100

Description:

Set the maximum number of frames between each keyframe. By default, a keyframe will be created at least every 250 frames. Specifying a different keyframe interval will allow you to create more or less keyframes in your video. Keyframe interval should be specified as a positive integer. For example, a value of 100 will create a keyframe every 100 frames.

A greater number of keyframes will increase the size of your output file, but will allow for more precise scrubbing in most players.

Note that this is a maximum keyframe interval. Depending on scene transitions and other things, more keyframes may be used to ensure high quality encoding.

For H.264 video, keyframes are IDR frames.

keyframe_interval takes precidence over keyframe_rate.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "keyframe_interval": 100
    }
  ]
}

See Also: keyframe_rate

keyframe_rate

keyframe_rate:Float

API Versions: V1, V2

Parent: outputs

Default: keyframe_interval of 250

Compatible Job Types: All

Example: 1.5

Description:

Set the number of keyframes per second. So a value of 0.5 would result in one keyframe every two seconds. A value of 3 would result in three keyframes per second.

The default is to control keyframes via keyframe_interval, with a default value of 250. Depending on the video frame rate, this results in a keyframe every 8-11 seconds.

A greater number of keyframes will increase the size of your output file, but will allow for more precise scrubbing in most players.

keyframe_interval takes precidence over keyframe_rate.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "keyframe_rate": 1.5
    }
  ]
}

See Also: fixed_keyframe_interval, forced_keyframe_interval, and forced_keyframe_rate

fixed_keyframe_interval

fixed_keyframe_interval:Boolean

API Versions: V1, V2

Parent: outputs

Default: false

Valid Values: true or false

Compatible Job Types: All

Example: true

Description:

By default, a specified keyframe_interval only guarantees the max number of frames between two keyframes. The encoder may decide to place a keyframe before it is required by the keyframe_interval; for example, better compression might be achieved by putting a keyframe at a scene change. Setting this option to true prevents this variability.

This option only applies when using the H.264, HEVC or VP6 video_codec.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "fixed_keyframe_interval": true
    }
  ]
}

See Also: keyframe_interval, forced_keyframe_interval, and forced_keyframe_rate

forced_keyframe_interval

forced_keyframe_interval:Integer

API Versions: V1, V2

Parent: outputs

Valid Values: A positive integer

Compatible Job Types: All

Example: 10

Description:

Forces keyframes to be created at the specified frame interval (every N frames), while still allowing the encoder to place keyframes elsewhere, such as at scene cuts. As opposed to fixed_keyframe_interval which only puts keyframes at the specified interval.

This option only applies when using the H.264 or HEVC video_codec.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "forced_keyframe_interval": 10
    }
  ]
}

See Also: keyframe_interval, fixed_keyframe_interval, and forced_keyframe_rate

forced_keyframe_rate

forced_keyframe_rate:Floating point number

API Versions: V1, V2

Parent: outputs

Valid Values: 0.001 to 100

Compatible Job Types: All

Example: 0.1

Description:

Set the forced keyframe interval by specifying number of keyframes per second, taking frame rate into account.

This option is ignored if forced_keyframe_interval is specified.

This option only applies when using the H.264 or HEVC video_codec.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "forced_keyframe_rate": "0.1"
    }
  ]
}

See Also: keyframe_interval and fixed_keyframe_interval

generate_frame_index

generate_frame_index:Boolean

API Versions: V2

Parent: outputs

Default: false

Valid Values: true or false

Compatible Job Types: All

Example: true

Description:

Produces a tab-delimited file with three integer values: frame #, frame size (bytes) and last keyframe #. Each line is padded with spaces to a width of 42 columns.

This option cannot be used unless the output contains a video stream.

The default index filename 'frame_index.tab' can be overridden with frame_index_filename.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "generate_frame_index": true,
      "frame_index_filename": "my_frame_index.txt"
    }
  ]
}

See Also: frame_index_filename

frame_index_filename

frame_index_filename:String

API Versions: V2

Parent: outputs

Compatible Job Types: All

Example: my_frame_index.txt

Description:

Unless specified, the filename used for frame index generation will be 'frame_index.tab'.

This option requires that generate_frame_index is true.

{
  "input": "s3://zencodertesting/test.mov",
  "outputs": [
    {
      "generate_frame_index": true,
      "frame_index_filename": "my_frame_index.txt"
    }
  ]
}

See Also: generate_frame_index