Create encoding option

Prev Next

Available in Classic and VPC

Create encoding options for converting media source files stored in Object Storage for viewing on different devices, such as mobile and PC, in different quality.

Request

This section describes the request format. The method and URI are as follows:

Method URI
POST /api/v2/encoding-option

Request headers

For information about the headers common to all VOD Station APIs, see VOD Station request headers.

Request body

You can include the following data in the body of your request:

Field Type Required Description
encodingOptionType String Optional Encoding option type
  • NORMAL (default) | AUDIO
    • NORMAL: Preset containing custom encoding option type video and audio streams
    • AUDIO: Preset that contains only audio streams
name String Required Custom encoding option name
  • Enter 3 to 20 characters using a combination of English letters, numbers, and the special characters ":", "-", and "-".
format String Required Converted media file's container format
  • MP4 (valid value)
video Object Required Video encoding option information
  • Omit object if encodingOptionType is AUDIO.
video.codec String Required Video codec format
  • AVC (H.264 support)
video.codecOptions Object Required Video codec detailed option information
video.codecOptions.profile String Required Video codec profile
  • BASELINE | MAIN | HIGH
  • It is a pre-defined standard specification so specific technologies of the H.264 codec can be used according to the video's purpose of use.
video.codecOptions.level String Required Video codec level
  • 1 | 1b | 1.1 | 1.2 | 1.3 | 2.1 | 2.2 | 3.1 | 3.2 | 4.1 | 4.2 | 5.1 | 5.2
  • It is a standard specification that predefines the performance limits of the hardware required for playback (decoding).
video.bitrate Integer Required Video stream's bitrate (Kbps)
  • It's a very important element that determines the video's image quality, and it also decides how much data is in a video of 1 second.
video.width Integer Required Width of the output video (pixel)
  • -2 | {Width value}
  • 96-4096
  • Automatic (AUTO): -2
  • If only video.width is -2 (automatic), video.height is fixed and video.width is converted according to the video's ratio.
video.height Integer Required Height of the output video (pixel)
  • -2 | {Height value}
  • 96-4096
  • Automatic (AUTO): -2
  • If only video.height is -2 (automatic), video.width is fixed and video.height is converted according to the video's ratio.
video.framerate Double Required Frames per second (fps)
  • -2 (automatic) | 10 | 15 | 23.97 | 24 | 29.97 | 30 | 50 | 60
video.maxFramerate Double Optional Maximum number of frames per second (fps)
  • Use only when video.framerate is -2 (automatic).
  • 10-60
video.keyframeInterval Integer Required Interval of key frames created in video (second)
  • 1-100
video.rateControl String Required Bitrate allocation method when converting video
  • AUTO | ABR | CRF | CBR
    • AUTO: Automatic
    • ABR: Average bitrate. Maintain the average bitrate and convert variably depending on the required bitrate. Better than CBR and inferior to CRF for medium quality.
    • CRF: Constant Rate Factor. Scale bitrate to target a constant visual quality. High quality with good compression efficiency relative to size, but bitrate and file size cannot be specified before encoding, and final size is unpredictable.
    • CBR: Constant bitrate. Allocate the same bitrate to all frames, making it easier to predict the size of the resulting file, but lower quality.
  • If video.pass is 2-Pass, only ABR is allowed.
video.pass String Required Encoding pass settings when converting video
  • 1-Pass | 2-Pass
    • 1-Pass: Proceed with 1 encoding
    • 2-Pass: Proceed with 2 encodings
  • 2-Pass utilizes bitrate more efficiently compared to 1-Pass, but increases encoding time.
audio Object Required Audio encoding option information
audio.codec String Required Audio codec format
  • AAC | MP3
audio.bitrate Integer Required Audio stream's bitrate (Kbps)
  • 16-320
audio.channel Integer Required Output audio's channel settings
  • AUTO | 1 | 2
    • AUTO: Automatic
    • 1: Mono
    • 2: Stereo
  • The source's audio channel is used when set to AUTO.
  • If you set the audio channel during encoding differently than the audio channel in the input media file, you may experience volume variations.
audio.samplingRate Integer Required Output audio's sampling rate (Hz)
  • -2 (automatic) | 22050 | 32000 | 44100 | 48000
  • The source's audio sampling rate is used when set to -2 (automatic).

Request example

The request example is as follows:

curl --location --request POST 'https://vodstation.apigw.ntruss.com/api/v2/encoding-option' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--data '{
    "encodingOptionType": "NORMAL",
    "name": "vodstation_uhd",
    "format": "MP4",
    "video": {
        "codec": "AVC",
        "codecOptions": {
            "profile": "HIGH",
            "level": "5.1"
        },
        "bitrate": 18000,
        "width": 3840,
        "height": 2160,
        "framerate": -2.0,
        "maxFramerate": 30,
        "keyframeInterval": 2,
        "rateControl": "ABR",
        "pass": "1-Pass"
    },
    "audio": {
        "codec": "AAC",
        "bitrate": 192,
        "channel": 2,
        "samplingRate": 48000.0
    }
}'

Response

This section describes the response format.

Response body

The response body includes the following data:

Field Type Required Description
content Object - Response result
content.disabled Boolean - Whether Sub Account is disabled
  • true | false
    • true: Disabled
    • false: Enabled
content.id Integer - Encoding option ID
content.encodingOptionType String - Encoding option type
  • NORMAL | AUDIO
    • NORMAL: Video encoding option
    • AUDIO: Audio encoding option
content.name String - Encoding option name
content.format String - Converted media file's container format
content.video Object - Video encoding option information
content.video.codec String - Video codec format
content.video.codecOptions Object - Video codec detailed option information
content.video.codecOptions.profile String - Video codec profile
content.video.codecOptions.level String - Video codec level
content.video.bitrate Integer - Video stream's bitrate (Kbps)
content.video.width Integer - Output video width (pixel)
content.video.height Integer - Output video height (pixel)
content.video.framerate Double - Number of frames per second (fps)
content.video.maxFramerate Double - Maximum number of frames per second (fps)
content.video.keyframeInterval Double - Interval of key frames created in video (second)
content.video.rateControl String - Bitrate distribution method
  • AUTO | ABR | CRF | CBR
    • AUTO: Automatic
    • ABR: Average bitrate
    • CRF: Constant rate factor
    • CBR: Constant bitrate
content.video.pass String - Encoding pass settings when converting video
  • 1-Pass | 2-Pass
    • 1-Pass: Proceed with 1 encoding
    • 2-Pass: Proceed with 2 encodings
content.audio Object - Audio encoding option information
content.audio.codec String - Audio codec format
content.audio.bitrate Integer - Audio stream's bitrate (Kbps)
content.audio.channel Integer - Channel count settings for output audio
  • AUTO | 1 | 2
    • AUTO: Automatic
    • 1: Mono
    • 2: Stereo
content.audio.samplingRate Double - Output audio sampling rate (Hz)
content.regionNo String - Region number
  • 1 (valid value)
    • 1: Korea Region
content.memberNo Integer - Member number

Response status codes

For information about the HTTP status codes common to all VOD Station APIs, see VOD Station response status codes.

Response example

The response example is as follows:

{
    "content": {
        "disabled": false,
        "id": 1111,
        "encodingOptionType": "NORMAL",
        "name": "vodstation_uhd",
        "format": "MP4",
        "video": {
            "codec": "AVC",
            "codecOptions": {
                "profile": "HIGH",
                "level": "5.1"
            },
            "bitrate": 18000,
            "width": 3840,
            "height": 2160,
            "framerate": -2.0,
            "maxFramerate": 30.0,
            "keyframeInterval": 2.0,
            "rateControl": "ABR",
            "pass": "1-Pass"
        },
        "audio": {
            "codec": "AAC",
            "bitrate": 192,
            "channel": 2,
            "samplingRate": 48000.0
        },
        "regionNo": "1",
        "memberNo": 2*****2
    }
}