---
title: "Transcode a video"
method: POST
path: "/transcode"
---

# Transcode a video

`POST /transcode`

`POST /transcode` transcodes a video file and uploads the results to the
specified storage service.
\
\
Transcoding is asynchronous so you will need to check the status of the
task in order to determine when transcoding is complete. The `id` field
in the response is the unique ID for the transcoding `Task`. The task
status can be queried using the [GET tasks
endpoint](https://docs.livepeer.org/reference/api/get-tasks):
\
\
When `status.phase` is `completed`,  transcoding will be complete and
the results will be stored in the storage service and the specified
output location.
\
\
The results will be available under `params.outputs.hls.path` and
`params.outputs.mp4.path` in the specified storage service.
## Input
\
This endpoint currently supports the following inputs:
- HTTP
- S3 API Compatible Service
\
\
**HTTP**
\
A public HTTP URL can be used to read a video file.
```json
{
    "url": "https://www.example.com/video.mp4"
}
```
| Name | Type   | Description                          |
| ---- | ------ | ------------------------------------ |
| url  | string | A public HTTP URL for the video file. |

Note: For IPFS HTTP gateway URLs, the API currently only supports “path
style” URLs and does not support “subdomain style” URLs. The API will
support both styles of URLs in a future update.
\
\
**S3 API Compatible Service**
\
\
S3 credentials can be used to authenticate with a S3 API compatible
service to read a video file.

```json
{
    "type": "s3",
    "endpoint": "https://gateway.storjshare.io",
    "credentials": {
        "accessKeyId": "$ACCESS_KEY_ID",
        "secretAccessKey": "$SECRET_ACCESS_KEY"
    },
    "bucket": "inbucket",
    "path": "/video/source.mp4"
}
```


## Storage
\
This endpoint currently supports the following storage services:
- S3 API Compatible Service
- Web3 Storage
\
\
**S3 API Compatible Service**
```json
{
  "type": "s3",
    "endpoint": "https://gateway.storjshare.io",
    "credentials": {
        "accessKeyId": "$ACCESS_KEY_ID",
        "secretAccessKey": "$SECRET_ACCESS_KEY"
    },
    "bucket": "mybucket"
}
```

**Web3 Storage**

```json
{
  "type": "web3.storage",
    "credentials": {
        "proof": "$UCAN_DELEGATION_PROOF",
    }
}
```



## Outputs
\
This endpoint currently supports the following output types:
- HLS
- MP4

**HLS**

```json
{
  "hls": {
        "path": "/samplevideo/hls"
    }
}
```


**MP4**

```json
{
  "mp4": {
        "path": "/samplevideo/mp4"
    }
}
```

## Request body

- TranscodePayload
  - `input` union, required
    - object — URL input video
      - `url` string, uri, required — URL of the video to transcode
    - object — S3-like storage input video
      - `type` 's3', required — Type of service. This is optional and defaults to `url` if ŚURL field is provided.
      - `endpoint` string, uri, required — Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io)
      - `bucket` string, required — Bucket with input file
      - `path` string, required — Path to the input file inside the bucket
      - `credentials` object, required — Credentials for the private input video storage
        - `accessKeyId` string, required — Access Key ID
        - `secretAccessKey` string, required — Secret Access Key
  - `storage` union, required
    - object — Storage for the output files
      - `type` 's3', required — Type of service used for output files
      - `endpoint` string, uri, required — Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io)
      - `bucket` string, required — Bucket with output files
      - `credentials` object, required — Credentials for the output video storage
        - `accessKeyId` string, required — Access Key ID
        - `secretAccessKey` string, required — Secret Access Key
    - object — Storage for the output files
      - `type` 'web3.storage', required — Type of service used for output files
      - `credentials` object, required — Delegation proof for Livepeer to be able to upload to web3.storage
        - `proof` string, required — Base64 encoded UCAN delegation proof
  - `outputs` object, required — Output formats
    - `hls` object — HLS output format
      - `path` string, required — Path for the HLS output
    - `mp4` object — MP4 output format
      - `path` string, required — Path for the MP4 output
    - `fmp4` object — FMP4 output format
      - `path` string, required — Path for the FMP4 output
  - `profiles` TranscodeProfile[]
    - `width` integer
    - `name` string
    - `height` integer
    - `bitrate` integer, required
    - `quality` integer — Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it.
    - `fps` integer
    - `fpsDen` integer
    - `gop` string
    - `profile` 'H264Baseline' | 'H264Main' | 'H264High' | 'H264ConstrainedHigh'
    - `encoder` 'H.264' | 'HEVC' | 'VP8' | 'VP9'
  - `targetSegmentSizeSecs` number — How many seconds the duration of each output segment should be
  - `creatorId` union
    - CreatorId
      - `type` 'unverified', required
      - `value` string, required — Developer-managed ID of the user who created the resource.
    - string — Helper syntax to specify an unverified creator ID, fully managed by the developer.
  - `c2pa` boolean — Decides if the output video should include C2PA signature

## Response `200`

Success

- Task — unresolved $ref

## Other responses

- `default` — Error

## Changes

- **2024-04-18** `fe72cbbf5a9b` — 2 warning
  - added the new `deleted` enum value to the `output/upload/assetSpec/status/phase` response property for the response status `200`
  - added the new `deleting` enum value to the `output/upload/assetSpec/status/phase` response property for the response status `200`
- **2024-03-25** `bfccb16136a3` — 1 info
  - added the optional property `output/upload/assetSpec/projectId` to the response with the `200` status
- **2024-03-11** `0e04362e1932` — 1 warning
  - removed the optional property `output/upload/assetSpec/projectId` from the response with the `200` status
- **2024-03-11** `bfccb16136a3` — 1 info
  - added the optional property `output/upload/assetSpec/projectId` to the response with the `200` status
- **2024-03-05** `19248ed5f60a` — 1 breaking, 1 info
  - added `subschema #1, subschema #3` to the `output/upload/assetSpec/source` response property `oneOf` list for the response status `200`
  - removed `subschema #1, subschema #3` from the `output/upload/assetSpec/source` response property `oneOf` list for the response status `200`

[Full history](https://skmtc.dev/livepeer/apis/livepeer-api-reference/changes/transcode/post.md)

---

[API](https://skmtc.dev/livepeer/apis/livepeer-api-reference.md) · [All operations](https://skmtc.dev/livepeer/apis/livepeer-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/livepeer/livepeer-api-reference/revisions/fe72cbbf5a9b/schema)
