Creating encoding options
    • PDF

    Creating encoding options

    • PDF

    Article summary

    VOD Station provides an API to create encoding options, and provides an encoding option list query API and an encoding option information query APIto query the created encoding options.

    Requests

    POST https://vodstation.apigw.ntruss.com/api/v2/encoding-option
    

    Request headers

    Header nameDescription
    x-ncp-region_codeNAVER Cloud Platform's region code
    x-ncp_region_code:{Region Code}
    x-ncp-apigw-timestampThis is the number of milliseconds that have elapsed since January 1, 1970 00:00:00 UTC.
    If the time difference compared to the API Gateway server is more than 5 minutes, then the request is considered invalid.
    x-ncp-apigw-timestamp:{Timestamp}
    x-ncp-iam-access-keyAccess key ID value issued by the NAVER Cloud Platform portal
    x-ncp-iam-access-key:{Sub Account Access Key}
    x-ncp-apigw-signature-v2Signature encrypted with the Access Key ID value and Secret Key
    x-ncp-apigw-signature-v2:{API Gateway Signature}
    Content-TypeSpecify the request body content type as application/json
    Content-Type: application/json

    Request body

    API field names in the request body are case sensitive.

    Field nameRequirement statusTypeRestrictionsDefault valueDescription
    nameYesString3 to 20 characters consisting of English letters, numbers, colons (:), hyphens (-), and underscores (_) are allowed.Name of user-defined encoding option to be created
    formatYesStringMP4Converted media file's container format
    encodingOptionTypeNoStringNORMAL, AUDIONORMAL- Type of user-defined encoding option
    Select either the normal preset including video and audio, or audio preset including only audio streams.
    audioYesObjectObject for setting transcoding audio option
    audio.codecYesStringAACAudio codec settings
    audio.channelYesStringAUTO, 1, 2- Output audio's channel settings
    Use the original audio channel when setting up AUTO 참고: 인풋 미디어 파일의 오디오 채널과 다른 설정으로 인코딩 시 볼륨의 변화가 발생 할 수 있음
    audio.bitrateYesIntegerAn integer between 16 and 320, unit: KbpsBit transfer rate settings of the video stream subject for transcoding
    audio.samplingRateYesIntegerAUTO, -2, 22050 , 32000, 44100, 48000 Unit: HzOutput audio's sampling rate settings. The source's audio sampling rate is used when set to AUTO.
    videoYesObject- Object for setting transcoding video option
    The video object is omitted when encodingOptionType is AUDIO.
    video.codecYesStringAVCVideo codec settings
    Supports AVC (H.264)
    video.codecOptionsYesObjectObject for setting video codec detailed options
    video.codecOptions.profileYesStringBASELINE, MAIN, HIGHVideo codec profile 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.levelYesString1, 1b, 1.1, 1.2, 1.3, 2.1, 2.2, 3.1, 3.2, 4.1, 4.2, 5.1, 5.2Video codec level is a standard specification set to indicate how many resources are required by the player (decoder) of the device that plays the video.
    video.bitrateYesIntegerBitrate> 0, unit: KbpsVideo stream's bit transfer rate settings. It's a very important element that determines the video's image quality, and it also decides how much data is in a 1 second video.
    video.widthYesIntegerAUTO (-2), an integer between 96 and 4096, unit: pixelThe horizontal length of the output video. If only the output video's width is set to AUTO, then the height will be fixed and the width will change according to the video's ratio.
    video.heightYesIntegerAUTO (-2), an integer between 96 and 4096, unit: pixelThe vertical length of the output video. If only the output video's height is set to AUTO, then the width will be fixed and the height will change according to the video's ratio.
    video.framerateYesDoubleAUTO(-2), 10, 15, 23.97, 24, 29.97, 30, 50, 60Sets the number of frames per second and how many frames per second to show in a video stream.
    video.maxFramerateNoIntegerInteger value between 10 and 60Only used when video.framerate is AUTO and sets the maximum framerate.
    video.keyframeIntervalYesIntegerAn integer between 1 and 100Key frame interval settings, interval of key frames created in video (unit: seconds)
    video.rateControlYesStringAUTO,ABR, CRF, CBR
    Only ABR is allowed when the video.pass is 2-pass.
    ABR- Bitrate distribution method when converting videos
    CBR: fixed bitrate, converts with equal bitrates in all frames. The bitrate is fixed, which makes predicting the result's size easy, but the quality is low compared to ABR or CRF.
    CRF: has good compression efficiency, but the bitrate and file size can't be specified before encoding.
    ABR: converts variably according to bitrate needed while maintaining an average bitrate with available bitrates.
    video.passYesString1-Pass, 2-Pass- Encoding method to be used when converting video
    2-pass uses given bitrates more efficiently than 1-pass, but the encoding time is longer.

    Responses

    Field nameTypeDescriptionRemarks
    errorObjectResponds when a request fails
    Error response code and message
    error.codeIntegerError response code
    error.messageStringError response message
    contentObjectVOD Station OPEN API response object
    content.disabledBooleanFiled provided to sub accounts
    Resource activation status for the Sub Account
    content.idStringEncoding option ID
    content.nameStringEncoding option name
    content.formatStringConverted media file's container format
    content.encodingOptionTypeStringEncoding option type
    content.audioObjectObject for setting transcoding audio option
    content.audio.codecStringAudio codec settings
    content.audio.channelIntegerOutput audio's channel settings
    content.audio.bitrateIntegerBit transfer rate settings of the video stream subject for transcoding (unit: Kbps)
    content.audio.samplingRateIntegerOutput audio sampling rate (unit: Hz)
    content.videoObjectObject for setting transcoding video option
    content.video.codecStringVideo codec settings
    content.video.codecOptionsObjectObject for setting video codec detailed options
    content.video.codecOptions.profileStringConfigured video codec profile
    content.video.codecOptions.levelStringConfigured video codec level
    content.video.bitrateIntegerVideo stream's bit transfer rate (unit: Kbps)
    content.video.widthIntegerOutput video’s width
    content.video.heightIntegerOutput video’s height
    content.video.framerateDoubleNumber of frames per second
    content.video.keyframeIntervalIntegerInterval at which key frames are created in the video (unit: seconds)
    content.video.rateControlStringBitrate distribution method
    content.defaultSetBooleanWhether there's a preset provided by system

    Examples

    Request examples

    POST https://vodstation.apigw.ntruss.com/api/v2/encoding-option
    
    POST /api/v2/encoding-option
    HOST: vodstation.apigw.ntruss.com
    Content-Type: application/json
    x-ncp-region_code:KR
    x-ncp-apigw-timestamp:1521787414578
    x-ncp-iam-access-key:6uxz1nKkcYwUjWRG5Q1V7NsW0i5jErlu2NjBXXgy
    x-ncp-apigw-signature-v2:iJFK773KH0WwQ79PasqJ+ZGixtpDQ/abS57WGQdld2M=
    
    Reqeust body
    {
      "audio": {
        "bitrate": 192,
        "channel": 2,
        "codec": "AAC",
        "samplingRate": 44100
      },
      "encodingOptionType": "NORMAL",
      "format": "MP4",
      "name": "basic-enc-option",
      "video": {
        "bitrate": 5000,
        "codec": "AVC",
        "codecOptions": {
          "level": "3.1",
          "profile": "MAIN"
        },
        "framerate": 30.0,
        "height": 1080,
        "keyframeInterval": 2,
        "pass": "1-Pass",
        "rateControl": "ABR",
        "maxFramerate": 30,
        "width": 1920
      }
    }
    

    Response examples

    HTTP/1.1 200 OK
    Server: nginx
    Date: Wed, 12 Sep 2018 09:53:32 GMT
    Content-Type: application/json;charset=utf-8
    Connection: keep-alive
    Access-Control-Allow-Origin: *
    x-ncp-trace-id: 36c9k60om4p3238cpmc9gm4cj4
    
    {
      "content": {
        "disabled": false,
        "id": 10058,
        "encodingOptionType": "NORMAL",
        "name": "basic-enc-option",
        "format": "MP4",
        "video": {
          "codec": "AVC",
          "codecOptions": {
            "profile": "MAIN",
            "level": "3.1"
          },
          "bitrate": 5000,
          "width": 1920,
          "height": 1080,
          "framerate": 30,
          "maxFramerate": 30,
          "keyframeInterval": 2,
          "rateControl": "ABR",
          "pass": "1-Pass"
        },
        "audio": {
          "codec": "AAC",
          "bitrate": 192,
          "channel": 2,
          "samplingRate": 44100
        }
      }
    }
    

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.