|
| 1 | +--- |
| 2 | +title: "getTranscodeDecision" |
| 3 | +linkTitle: "getTranscodeDecision" |
| 4 | +categories: |
| 5 | +- Transcoding |
| 6 | +description: > |
| 7 | + Returns a transcode decision for a given media file. |
| 8 | +--- |
| 9 | + |
| 10 | +`http://your-server/rest/getTranscodeDecision` |
| 11 | + |
| 12 | +Returns a transcode decision for a given media file. This endpoint is used by clients to determine if a media file should be transcoded before streaming. The server will analyze the provided client information and return a decision. |
| 13 | + |
| 14 | +### Parameters |
| 15 | + |
| 16 | +| Parameter | Req. | OpenS. | Default | Comment | |
| 17 | +| --- | --- | --- | --- | --- | |
| 18 | +| `songId` | **Yes** | | | The ID of the song to be transcoded. | |
| 19 | + |
| 20 | +### Request Body |
| 21 | + |
| 22 | +The request body must be a JSON object containing the client's capabilities. See the [`ClientInfo`](../payloads/clientinfo) documentation for more details. |
| 23 | + |
| 24 | +{{< tabpane persist=false >}} |
| 25 | +{{< tab header="**Example**:" disabled=true />}} |
| 26 | +{{< tab header="ClientInfo" lang="json">}} |
| 27 | +{ |
| 28 | + "name": "Pixel 8 Pro", |
| 29 | + "platform": "Sonos", |
| 30 | + "maxAudioBitrate": 512000, |
| 31 | + "maxTranscodingAudioBitrate": 256000, |
| 32 | + "directPlayProfiles": [ |
| 33 | + { |
| 34 | +"container": "mp3", |
| 35 | +"audioCodec": "mp3", |
| 36 | +"protocol": "http", |
| 37 | +"maxAudioChannels": 2 |
| 38 | + }, |
| 39 | + { |
| 40 | +"container": "flac", |
| 41 | +"audioCodec": "flac", |
| 42 | +"protocol": "*", |
| 43 | +"maxAudioChannels": 2 |
| 44 | + } |
| 45 | + , |
| 46 | + { |
| 47 | +"container": "mp4", |
| 48 | +"audioCodec": "flac,aac,alac", |
| 49 | +"protocol": "*", |
| 50 | +"maxAudioChannels": 2 |
| 51 | + } |
| 52 | + ], |
| 53 | + "transcodingProfiles": [ |
| 54 | + { |
| 55 | +"container": "mp3", |
| 56 | +"audioCodec": "mp3", |
| 57 | +"protocol": "http", |
| 58 | +"maxAudioChannels": 2 |
| 59 | + }, |
| 60 | + { |
| 61 | +"container": "flac", |
| 62 | +"audioCodec": "flac", |
| 63 | +"protocol": "*", |
| 64 | +"maxAudioChannels": 2 |
| 65 | + } |
| 66 | + ], |
| 67 | + "codecProfiles": [ |
| 68 | + { |
| 69 | + "type": "AudioCodec", |
| 70 | + "name": "mp3", |
| 71 | + "limitations": [ |
| 72 | + { "name": "audioBitrate", "comparison": "LessThanEqual", "value": "320000", "required": true } |
| 73 | + ] |
| 74 | + }, |
| 75 | + { |
| 76 | + "type": "AudioCodec", |
| 77 | + "name": "flac", |
| 78 | + "limitations": [ |
| 79 | + { "name": "audioSamplerate", "comparison": "LessThanEqual", "value": "192000", "required": false }, |
| 80 | + { "name": "audioChannels", "comparison": "LessThanEqual", "value": "2", "required": false } |
| 81 | + ] |
| 82 | + } |
| 83 | + ] |
| 84 | +} |
| 85 | +{{< /tab >}} |
| 86 | +{{< /tabpane >}} |
| 87 | + |
| 88 | +### Example |
| 89 | + |
| 90 | +{{< alert color="primary" >}} `http://your-server/rest/getTranscodeDecision.view?songId=123&u=demo&p=demo&v=1.16.1&c=AwesomeClientName&f=json` {{< /alert >}} |
| 91 | + |
| 92 | +### Result |
| 93 | + |
| 94 | +A [`subsonic-response`](../../responses/subsonic-response) element with a nested [`transcodeDecision`](../../responses/transcodedecision) element on success. |
| 95 | + |
| 96 | +{{< tabpane persist=false >}} |
| 97 | +{{< tab header="**Example**:" disabled=true />}} |
| 98 | +{{< tab header="OpenSubsonic" lang="json">}} |
| 99 | +{ |
| 100 | + "subsonic-response": { |
| 101 | + "status": "ok", |
| 102 | + "version": "1.16.1", |
| 103 | + "type": "AwesomeServerName", |
| 104 | + "serverVersion": "0.1.3 (tag)", |
| 105 | + "openSubsonic": true, |
| 106 | + "transcodeDecision": { |
| 107 | + "canDirectPlay": false, |
| 108 | + "canTranscode": true, |
| 109 | + "transcodeReason": ["AudioCodecNotSupported"], |
| 110 | + "errorReason": "", |
| 111 | + "transcodeParams": "0001-0005-004",, |
| 112 | + "sourceStream": { |
| 113 | + "protocol": "http", |
| 114 | + "container": "flac", |
| 115 | + "codec": "flac", |
| 116 | + "audioChannels": 6, |
| 117 | + "audioBitrate": 3000000, |
| 118 | + "audioProfile": "", |
| 119 | + "audioSamplerate": 96000, |
| 120 | + "audioBitdepth": 24 |
| 121 | + }, |
| 122 | + "transcodeStream": { |
| 123 | + "protocol": "hls", |
| 124 | + "container": "mp4", |
| 125 | + "codec": "aac", |
| 126 | + "audioChannels": 2, |
| 127 | + "audioBitrate": 256000, |
| 128 | + "audioProfile": "xHE-AAC", |
| 129 | + "audioSamplerate": 48000, |
| 130 | + "audioBitdepth": 16 |
| 131 | + } |
| 132 | + } |
| 133 | + } |
| 134 | +} |
| 135 | +{{< /tab >}} |
| 136 | +{{< /tabpane >}} |
| 137 | + |
| 138 | +| Field | Type | Req. | OpenS. | Details | |
| 139 | +| --- | --- | --- | --- | --- | |
| 140 | +| `transcodeDecision` | [`transcodeDecision`](../../responses/transcodedecision) | **Yes** | | The transcode decision | |
0 commit comments