# Custom transcoding (/en/api-reference/api-ref/broadcast-streaming/transcoding/custom)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

## Create a custom transcoding template [#create-a-custom-transcoding-template]

Creates a custom transcoding template for the specified entry point.

### HTTP request [#http-request]

```bash
POST https://api.agora.io/v1/projects/{appid}/fls/entry_points/{entry_point}/settings/transcode/custom?id={name}
```

#### Path parameter [#path-parameter]

| Parameter     | Type   | Description                                                                                                                                                                     |
| :------------ | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `appid`       | String | Required. The App ID retrieved from Agora Console.                                                                                                                              |
| `entry_point` | String | Required. The entry point name.                                                                                                                                                 |
| `name`        | String | Required. The name of the custom transcoding template. This name must be different from the `name` of any [preset transcoding templates](standard); otherwise, an error occurs. |

#### Request body [#request-body]

The request body is in the JSON Object type, and contains the following fields:

| Field             | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| :---------------- | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `width`           | Integer | Required. The width (pixels) of the video. The value range is \[0, 1920], where 0 means to adapt using the original aspect ratio.                                                                                                                                                                                                                                                                                                                                                    |
| `height`          | Integer | Required. The height (pixels) of the video. The value range is \[0,1920], where 0 means to adapt using the original aspect ratio.                                                                                                                                                                                                                                                                                                                                                    |
| `videoCodec`      | String  | Optional. The video encoding format. Only H.264 is supported. If `videoBitrate` and `profile` are specified, this field is required.                                                                                                                                                                                                                                                                                                                                                 |
| `videoBitrate`    | Integer | Optional. The video bitrate (bit/s). The value range is \[200, 6000].                                                                                                                                                                                                                                                                                                                                                                                                                |
| `profile`         | String  | Optional. The encoding profile. Each profile represents a set of encoding parameters. Generally speaking, a higher profile means better video quality and requires more resources for encoding and decoding. Possible values include the following:- `base`: The base profile, which is suitable for mobile devices.

- `main`: The standard profile, which is suitable for standard-resolution devices.

- `high`: The high profile, which is suitable for high-resolution devices. |
| `audioCodec`      | String  | Optional. The audio encoding format. Only AAC is supported. If `audioBitrate` and `audioSampleRate `are specified, this field is required.                                                                                                                                                                                                                                                                                                                                           |
| `audioBitrate`    | Integer | Optional. The audio bitrate (bit/s). The value range is \[100,500].                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `audioSampleRate` | Integer | Optional. The audio sampling rate (Hz). Possible values include: 96000, 88200, 64000, 48000, 44100, 32000, and 16000.                                                                                                                                                                                                                                                                                                                                                                |

### HTTP response [#http-response]

If the returned HTTP status code is 200, the request is successful.

If the returned HTTP status code is not 200, the request fails. You can refer to the [HTTP status codes ](#http-code)for possible reasons.

### Example [#example]

**Request line**

```bash
POST https://api.agora.io/v1/projects/{your_appid}/fls/entry_points/live/settings/transcode/custom?id={name} HTTP/1.1
```

**Request body**

```json
{
    "width": 0,
    "height": 360,
    "videoCodec": "h264",
    "videoBitrate": 1200,
    "profile": "base",
    "audioCodec": "aac",
    "audioBitrate": 320,
    "audioSampleRate": 44100
}
```

**Response line**

```bash
HTTP/1.1 200 OK
```

## Update a custom transcoding template [#update-a-custom-transcoding-template]

Updates the custom transcoding template for the specified entry point.

### HTTP request [#http-request-1]

```bash
PATCH https://api.agora.io/v1/projects/{appid}/fls/entry_points/{entry_point}/settings/transcode/custom/{name}
```

#### Path parameter [#path-parameter-1]

| Parameter     | Type   | Description                                            |
| :------------ | :----- | :----------------------------------------------------- |
| `appid`       | String | Required. The App ID retrieved from Agora Console.     |
| `entry_point` | String | Required. The entry point name.                        |
| `name`        | String | Required. The name of the custom transcoding template. |

#### Request body [#request-body-1]

The request body is in the JSON Object type, and contains the following fields:

| Field             | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| :---------------- | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `width`           | Integer | Optional. The width (pixels) of the video. The value range is \[0, 1920], where 0 means to adapt using the original aspect ratio. If `height` is specified, this field is required.                                                                                                                                                                                                                                                                                                  |
| `height`          | Integer | Optional. The height (pixels) of the video. The value range is \[0,1920], where 0 means to adapt using the original aspect ratio. If `width` is specified, this field is required.                                                                                                                                                                                                                                                                                                   |
| `videoCodec`      | String  | Optional. The video encoding format. Only H.264 is supported. If `videoBitrate` and `profile` are specified, this field is required.                                                                                                                                                                                                                                                                                                                                                 |
| `videoBitrate`    | Integer | Optional. The video bitrate (bit/s). The value range is \[200, 6000].                                                                                                                                                                                                                                                                                                                                                                                                                |
| `profile`         | String  | Optional. The encoding profile. Each profile represents a set of encoding parameters. Generally speaking, a higher profile means better video quality and requires more resources for encoding and decoding. Possible values include the following:- `base`: The base profile, which is suitable for mobile devices.

- `main`: The standard profile, which is suitable for standard-resolution devices.

- `high`: The high profile, which is suitable for high-resolution devices. |
| `audioCodec`      | String  | Optional. The audio encoding format. Only AAC is supported. If `audioBitrate` and `audioSampleRate `are specified, this field is required.                                                                                                                                                                                                                                                                                                                                           |
| `audioBitrate`    | Integer | Optional. The audio bitrate (bit/s). The value range is \[100,500].                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `audioSampleRate` | Integer | Optional. The audio sampling rate (Hz). Possible values include: 96000, 88200, 64000, 48000, 44100, 32000, and 16000.                                                                                                                                                                                                                                                                                                                                                                |

### HTTP response [#http-response-1]

If the returned HTTP status code is 200, the request is successful.

If the returned HTTP status code is not 200, the request fails. You can refer to the [HTTP status codes ](#http-code)for possible reasons.

### Example [#example-1]

**Request line**

```bash
PATCH https://api.agora.io/v1/projects/{your_appid}/fls/entry_points/live/settings/transcode/custom/{name} HTTP/1.1
```

**Request body**

```json
{
    "width": 0,
    "height": 360,
    "videoCodec": "h264",
    "videoBitrate": 1200,
    "profile": "base",
    "audioCodec": "aac",
    "audioBitrate": 320,
    "audioSampleRate": 44100
}
```

**Response line**

```bash
HTTP/1.1 200 OK
```

## Delete a custom transcoding template [#delete-a-custom-transcoding-template]

Deletes the custom transcoding template for the specified entry point.

### HTTP request [#http-request-2]

```bash
DELETE https://api.agora.io/v1/projects/{appid}/fls/entry_points/{entry_point}/settings/transcode/custom/{name}
```

#### Path parameter [#path-parameter-2]

| Parameter     | Type   | Description                                            |
| :------------ | :----- | :----------------------------------------------------- |
| `appid`       | String | Required. The App ID retrieved from Agora Console.     |
| `entry_point` | String | Required. The entry point name.                        |
| `name`        | String | Required. The name of the custom transcoding template. |

### HTTP response [#http-response-2]

If the returned HTTP status code is 200, the request is successful.

If the returned HTTP status code is not 200, the request fails. You can refer to the [HTTP status codes ](#http-code)for possible reasons.

### Example [#example-2]

**Request line**

```bash
DELETE https://api.agora.io/v1/projects/{your_appid}/fls/entry_points/live/settings/transcode/custom/{name} HTTP/1.1
```

**Response line**

```bash
HTTP/1.1 200 OK
```

## List custom transcoding templates [#list-custom-transcoding-templates]

Lists the custom transcoding templates for the specified entry point.

### HTTP request [#http-request-3]

```bash
GET https://api.agora.io/v1/projects/{appid}/fls/entry_points/{entry_point}/settings/transcode/custom
```

#### Path parameter [#path-parameter-3]

| Parameter     | Type   | Description                                            |
| :------------ | :----- | :----------------------------------------------------- |
| `appid`       | String | Required. The App ID retrieved from Agora Console.     |
| `entry_point` | String | Required. The entry point name.                        |
| `name`        | String | Required. The name of the custom transcoding template. |

### HTTP response [#http-response-3]

If the returned HTTP status code is 200, the request is successful. The response body contains the following fields:

* `transcodeList`: JSON Array. The list of custom transcoding templates for the entry point. Each custom transcoding template corresponds to a JSON Object and contains the following fields:

| Field             | Type    | Description                                                                                                                                                                                                                                                      |
| ----------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`            | String  | Required. The transcoding template name.                                                                                                                                                                                                                         |
| `width`           | Integer | Required. The width of the video.                                                                                                                                                                                                                                |
| `height`          | Integer | Required. The height of the video.                                                                                                                                                                                                                               |
| `videoCodec`      | String  | Optional. The video encoding format. Only H.264 is supported.                                                                                                                                                                                                    |
| `videoBitrate`    | Integer | Optional. The video bitrate (bit/s).                                                                                                                                                                                                                             |
| `profile`         | String  | Optional. The encoding profile.* `base`: The base profile, which is suitable for mobile devices.

* `main`: The standard profile, which is suitable for standard-resolution devices.

* `high`: The high profile, which is suitable for high-resolution devices. |
| `audioCodec`      | String  | Optional. The audio encoding format. Only AAC is supported.                                                                                                                                                                                                      |
| `audioBitrate`    | Integer | Optional. The audio bitrate (bit/s).                                                                                                                                                                                                                             |
| `audioSampleRate` | Integer | Optional. The audio sampling rate (Hz).                                                                                                                                                                                                                          |

If the returned HTTP status code is not 200, the request fails. You can refer to the [HTTP status codes ](#http-code)for possible reasons.

### Example [#example-3]

**Request line**

```bash
GET https://api.agora.io/v1/projects/{your_appid}/fls/entry_points/live/settings/transcode/custom HTTP/1.1
```

**Request body**

```json
{
    "transcodeList": [
        {
            "name": "{your_transcode_name}",
            "width": 0,
            "height": 360,
            "videoCodec": "h264",
            "videoBitrate": 1200,
            "profile": "base",
            "audioCodec": "aac",
            "audioBitrate": 320,
            "audioSampleRate": 44100
        }
    ]
}
```

**Response line**

```bash
HTTP/1.1 200 OK
```

<a name="http-code" />

## HTTP status codes [#http-status-codes]

| Status code | Description                                                                                                                                              |
| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 200         | The request succeeds.                                                                                                                                    |
| 400         | The parameter is invalid, for example the `appid` or the `entry_point` is empty, or the `region` parameter value is invalid.                             |
| 401         | Unauthorized (the customer ID and the customer secret do not match).                                                                                     |
| 404         | The server cannot find the resource according to the request, which means the requested entry point does not exist or the requested URI path is invalid. |
| 500         | An internal error occurs in the server, so the server is not able to complete the request.                                                               |
| 504         | An internal error occurs in the server. The gateway or the proxy server did not receive a timely request from the remote server.                         |
