> ## Documentation Index
> Fetch the complete documentation index at: https://bunnynet-cb9733c2-add-address-verification-note.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Add output codec to video

> Encodes and adds an additional output codec to an already-encoded video. Requires Premium Encoding to be enabled for the library and the codec to already be enabled for the library, and fails if the original source file is missing or the codec was already processed.



## OpenAPI

````yaml https://video.bunnycdn.com/openapi/bunnynet-video-api.public.json put /library/{libraryId}/videos/{videoId}/outputs/{outputCodecId}
openapi: 3.0.0
info:
  title: Stream API
  termsOfService: https://bunny.net/tos
  contact:
    name: bunny.net
    url: https://docs.bunny.net
    email: support@bunny.net
  version: 1.6.1
servers:
  - url: https://video.bunnycdn.com
security: []
tags:
  - name: Manage Collections
  - name: Manage Videos
paths:
  /library/{libraryId}/videos/{videoId}/outputs/{outputCodecId}:
    put:
      tags:
        - Manage Videos
      summary: Add output codec to video
      description: >-
        Encodes and adds an additional output codec to an already-encoded video.
        Requires Premium Encoding to be enabled for the library and the codec to
        already be enabled for the library, and fails if the original source
        file is missing or the codec was already processed.
      operationId: Video_ReencodeUsingCodec
      parameters:
        - name: libraryId
          in: path
          required: true
          description: The ID of the video library.
          schema:
            type: integer
            format: int64
          x-position: 1
        - name: videoId
          in: path
          required: true
          description: The GUID of the video.
          schema:
            type: string
            format: guid
          x-position: 2
        - name: outputCodecId
          in: path
          required: true
          description: >-
            The output codec to encode and add, must already be enabled for the
            library.
          schema:
            $ref: '#/components/schemas/EncoderOutputCodec'
          x-position: 3
      responses:
        '200':
          description: The details of the requested video
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoModel'
        '400':
          description: Invalid request or validation failed, check response
          content:
            application/json:
              schema:
                type: string
        '401':
          description: The request authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusModel'
        '403':
          description: The request authorization failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusModel'
        '404':
          description: The requested video was not found
        '500':
          description: Internal Server Error
      security:
        - AccessKey: []
components:
  schemas:
    EncoderOutputCodec:
      type: integer
      description: ''
      oneOf:
        - title: x264
          type: integer
          enum:
            - 0
        - title: vp9
          type: integer
          enum:
            - 1
        - title: hevc
          type: integer
          enum:
            - 2
        - title: av1
          type: integer
          enum:
            - 3
    VideoModel:
      type: object
      additionalProperties: false
      required:
        - videoLibraryId
        - guid
        - title
        - dateUploaded
        - views
        - isPublic
        - length
        - status
        - framerate
        - width
        - height
        - outputCodecs
        - thumbnailCount
        - encodeProgress
        - storageSize
        - hasMP4Fallback
        - averageWatchTime
        - totalWatchTime
      properties:
        videoLibraryId:
          type: integer
          description: The ID of the video library that the video belongs to
          format: int64
        guid:
          type: string
          description: The unique ID of the video
          minLength: 1
        title:
          type: string
          description: The title of the video
          minLength: 1
        description:
          type: string
          description: The description of the video
          nullable: true
        dateUploaded:
          type: string
          description: The date when the video was uploaded
          format: date-time
          minLength: 1
        views:
          type: integer
          description: The number of views the video received
          format: int64
        isPublic:
          type: boolean
          description: Determines if the video is publically accessible
        length:
          type: integer
          description: The duration of the video in seconds
          format: int32
        status:
          description: The status of the video. See VideoModelStatus.
          oneOf:
            - $ref: '#/components/schemas/VideoModelStatus'
        framerate:
          type: number
          description: The framerate of the video
          format: double
        rotation:
          type: integer
          description: >-
            Rotation of the source file in degrees as read from container
            metadata (e.g. 90, -90, 180, 270); null when no rotation metadata is
            present.
          nullable: true
        width:
          type: integer
          description: The width of the original video file
          format: int32
        height:
          type: integer
          description: The height of the original video file
          format: int32
        availableResolutions:
          type: string
          description: >-
            Comma-separated list of resolution labels (e.g. "360p,720p,1080p")
            that have finished encoding and are available for playback.
          nullable: true
        outputCodecs:
          type: string
          description: >-
            Comma-separated list of output codecs generated for this video (e.g.
            "x264,vp9"). See EncoderOutputCodec for possible values.
          minLength: 1
        thumbnailCount:
          type: integer
          description: The number of thumbnails generated for this video
          format: int32
        encodeProgress:
          type: integer
          description: >-
            Encoding progress as a percentage from 0 to 100; reaches 100 when
            transcoding finishes.
          format: int32
        storageSize:
          type: integer
          description: Total storage used by this video, in bytes.
          format: int64
        captions:
          type: array
          description: The list of captions available for the video
          nullable: true
          items:
            $ref: '#/components/schemas/CaptionModel'
        hasMP4Fallback:
          type: boolean
          description: Determines if the video has MP4 fallback files generated
        collectionId:
          type: string
          description: The ID of the collection where the video belongs
          nullable: true
        thumbnailFileName:
          type: string
          description: The file name of the thumbnail inside of the storage
          nullable: true
        thumbnailUrl:
          type: string
          description: The CDN URL of the thumbnail
          nullable: true
        thumbnailBlurhash:
          type: string
          description: >-
            Thumbnail blurhash to show while the actual thumbnail is being
            loaded
          nullable: true
        averageWatchTime:
          type: integer
          description: The average watch time of the video in seconds
          format: int64
        totalWatchTime:
          type: integer
          description: The total video watch time in seconds
          format: int64
        category:
          type: string
          description: >-
            Automatically detected content category label; "untagged" when no
            category has been determined yet.
          nullable: true
        chapters:
          type: array
          description: The list of chapters available for the video
          nullable: true
          items:
            $ref: '#/components/schemas/ChapterModel'
        moments:
          type: array
          description: The list of moments available for the video
          nullable: true
          items:
            $ref: '#/components/schemas/MomentModel'
        metaTags:
          type: array
          description: The list of meta tags that have been added to the video
          nullable: true
          items:
            $ref: '#/components/schemas/MetaTagModel'
        transcodingMessages:
          type: array
          description: >-
            The list of transcoding messages that describe potential issues
            while the video was transcoding
          nullable: true
          items:
            $ref: '#/components/schemas/TranscodingMessageModel'
        jitEncodingEnabled:
          type: boolean
          description: >-
            Whether just-in-time encoding is enabled for this specific video,
            overriding the video library's default JitEncodingEnabled setting
            when set. Null means the library default applies.
          nullable: true
        smartGenerateStatus:
          description: >-
            Aggregate smart generate status derived from per-feature statuses
            when present: InProgress, then Queued, then Failed, then Finished;
            otherwise the stored legacy value. See SmartGenerateFeaturesStatus.
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/SmartGenerateStatus'
        smartGenerateFeaturesStatus:
          description: >-
            Per-feature smart generate statuses (title, description, chapters,
            moments). Null for a feature on legacy rows.
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/SmartGenerateFeaturesStatusModel'
        hasOriginal:
          type: boolean
          description: Determines if video has the original file available in storage
          nullable: true
        originalHash:
          type: string
          description: Original uploaded file SHA256 hash
          nullable: true
        hasHighQualityPreview:
          type: boolean
          description: >-
            Whether a high-quality animated preview has been generated for this
            video.
          nullable: true
    StatusModel:
      type: object
      additionalProperties: false
      properties:
        success:
          type: boolean
          description: Determines if the request was successful
        message:
          type: string
          description: >-
            Human-readable message describing the result, typically populated
            with error details when Success is false.
          nullable: true
        statusCode:
          type: integer
          description: The HTTP status code corresponding to the result of the request.
          format: int32
    VideoModelStatus:
      type: integer
      description: ''
      oneOf:
        - title: Created
          type: integer
          enum:
            - 0
        - title: Uploaded
          type: integer
          enum:
            - 1
        - title: Processing
          type: integer
          enum:
            - 2
        - title: Transcoding
          type: integer
          enum:
            - 3
        - title: Finished
          type: integer
          enum:
            - 4
        - title: Error
          type: integer
          enum:
            - 5
        - title: UploadFailed
          type: integer
          enum:
            - 6
        - title: JitSegmenting
          type: integer
          enum:
            - 7
        - title: JitPlaylistsCreated
          type: integer
          enum:
            - 8
    CaptionModel:
      type: object
      additionalProperties: false
      properties:
        srclang:
          type: string
          description: The unique srclang shortcode for the caption
          nullable: true
        label:
          type: string
          description: The text description label for the caption
          nullable: true
        version:
          type: integer
          description: >-
            Increments each time this caption is replaced; useful as a
            cache-busting value for the caption file URL.
          format: int32
    ChapterModel:
      type: object
      additionalProperties: false
      required:
        - title
      properties:
        title:
          type: string
          description: The title of the chapter, up to 255 characters.
          minLength: 1
        start:
          type: integer
          description: >-
            The start time of the chapter in seconds. Must be less than End and
            within the video's duration; chapters must not overlap each other.
          format: int32
        end:
          type: integer
          description: >-
            The end time of the chapter in seconds. Must be greater than Start
            and within the video's duration; chapters must not overlap each
            other.
          format: int32
    MomentModel:
      type: object
      additionalProperties: false
      required:
        - label
      properties:
        label:
          type: string
          description: The text description label for the moment, up to 255 characters.
          minLength: 1
        timestamp:
          type: integer
          description: >-
            The timestamp of the moment in seconds. Must be within the video's
            duration.
          format: int32
    MetaTagModel:
      type: object
      additionalProperties: false
      properties:
        property:
          type: string
          description: >-
            The meta tag key. Must match ^[A-Za-z0-9._:'"-]+$. Setting a tag
            with the property "description" also updates the video's Description
            field.
          nullable: true
        value:
          type: string
          description: >-
            The meta tag value. HTML/markup is stripped and the value is stored
            as plain text.
          nullable: true
    TranscodingMessageModel:
      type: object
      additionalProperties: false
      properties:
        timeStamp:
          type: string
          description: Date and time when this message was added (UTC).
          format: date-time
        level:
          description: Message severity. See Severity.
          oneOf:
            - $ref: '#/components/schemas/Severity'
        issueCode:
          description: >-
            Issue code identifying the specific transcoding problem. See
            IssueCodes.
          oneOf:
            - $ref: '#/components/schemas/IssueCodes'
        message:
          type: string
          description: Human-readable description of the issue.
          nullable: true
        value:
          type: string
          description: >-
            Additional context value for the issue, if applicable; otherwise
            empty.
          nullable: true
    SmartGenerateStatus:
      type: integer
      description: ''
      oneOf:
        - title: None
          type: integer
          enum:
            - 0
        - title: Queued
          type: integer
          enum:
            - 1
        - title: InProgress
          type: integer
          enum:
            - 2
        - title: Finished
          type: integer
          enum:
            - 3
        - title: Failed
          type: integer
          enum:
            - 4
    SmartGenerateFeaturesStatusModel:
      type: object
      additionalProperties: false
      properties:
        title:
          description: Smart generate status for the video title, when applicable.
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/SmartGenerateStatus'
        description:
          description: Smart generate status for the video description, when applicable.
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/SmartGenerateStatus'
        chapters:
          description: Smart generate status for chapters, when applicable.
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/SmartGenerateStatus'
        moments:
          description: Smart generate status for moments, when applicable.
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/SmartGenerateStatus'
    Severity:
      type: integer
      description: ''
      oneOf:
        - title: Undefined
          type: integer
          description: Shouldn't be used
          enum:
            - 0
        - title: Information
          type: integer
          description: An info message to the user, shouldn't break anythying
          enum:
            - 1
        - title: Warning
          type: integer
          description: >-
            A warning message, for example that the transcoded video may break
            when playing
          enum:
            - 2
        - title: Error
          type: integer
          description: An error, meaning that the video will most likely not be playable
          enum:
            - 3
    IssueCodes:
      type: integer
      description: ''
      oneOf:
        - title: Undefined
          type: integer
          description: Shouldn't be used
          enum:
            - 0
        - title: StreamLengthsDifference
          type: integer
          description: >-
            Marks that there is a mismatch between lengths of audio and video
            streams in the transcoded file
          enum:
            - 1
        - title: TranscodingWarnings
          type: integer
          description: Marks that transcoding completed with warnings
          enum:
            - 2
        - title: IncompatibleResolution
          type: integer
          description: >-
            Marks that original video file has incompatible resolution or isn't
            a video stream
          enum:
            - 3
        - title: InvalidFramerate
          type: integer
          description: Marks that original video file has invalid framerate
          enum:
            - 4
        - title: VideoExceededMaxDuration
          type: integer
          description: Marks that video stream exceeded max duration
          enum:
            - 5
        - title: AudioExceededMaxDuration
          type: integer
          description: Marks that audio stream exceeded max duration
          enum:
            - 6
        - title: OriginalCorrupted
          type: integer
          description: >-
            Marks that video file is corrupted and couldn't be processed
            properly
          enum:
            - 7
        - title: TranscriptionFailed
          type: integer
          description: >-
            Marks that video transcription finished with errors and might not be
            complete
          enum:
            - 8
        - title: JitIncompatible
          type: integer
          description: Marks that video file is not compatible with JIT encoding
          enum:
            - 9
        - title: JitFailed
          type: integer
          description: Marks that video failed JIT encoding
          enum:
            - 10
        - title: CaptionGenerationFailed
          type: integer
          description: Marks that captions generation failed
          enum:
            - 11
  securitySchemes:
    AccessKey:
      type: apiKey
      description: AccessKey based authentication
      name: AccessKey
      in: header

````