---
title: "Transcode a video"
method: POST
path: "/transcode"
tags: ["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
    - object
      - `type` 'unverified', required
      - `value` string, required
    - 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-08-28** `974b6b23f2e9` — 1 info
  - added the optional property `projectId` to the response with the `200` status
- **2024-07-17** `7292d77807a3` — 1 breaking
  - the `output/upload/assetSpec/storage` response's property type/format changed from ``/`` to `object`/`` for status `200`
- **2024-06-18** `82356f03be94` — 4 breaking, 3 warning
  - the response property `output/upload/assetSpec/profiles/items/fps` became optional for the status `200`
  - the response property `output/upload/assetSpec/profiles/items/height` became optional for the status `200`
  - the response property `output/upload/assetSpec/profiles/items/name` became optional for the status `200`
  - the response property `output/upload/assetSpec/profiles/items/width` became optional for the status `200`
  - …3 more
- **2024-06-13** `5e75bbdc48f8` — 1 info
  - added the optional property `output/upload/assetSpec/profiles` to the response with the `200` status
- **2024-06-03** `91531fe2df78` — 1 breaking
  - the response property `output/upload/assetSpec/hash` became nullable for the 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/0d7e15217608/schema)
