Get All Transcode Sessions
When Plex can't direct play a media item it will decide to transcode the media so it can be streamed to the client. This API command will return all active transcode sessions on the Plex server.
URL
GET http://{ip_address}:32400/transcode/sessions/?X-Plex-Token={plex_token}
Parameters
Name | Description |
---|---|
ip_address | The IP address of the Plex Media server. |
plex_token | The Plex token. |
Return Status
HTTP Code | Description |
---|---|
200 | Success - The request was successful. |
401 | Unauthorized - The Plex token provided was not valid. |
Response
XML string value that lists all the currently active transcode sessions on the server. An example of the XML returned from the request is shown below:
<?xml version="1.0" encoding="UTF-8"?> <MediaContainer size="1"> <TranscodeSession key="ac99lf8sr9h9i7jfahvge6un" throttled="0" complete="0" progress="50" size="-22" speed="2.4000000953674316" error="0" duration="10000" remaining="2" context="streaming" sourceVideoCodec="hevc" videoDecision="transcode" protocol="http" container="mkv" videoCodec="h264" transcodeHwRequested="1" timeStamp="1676047584.4802699" maxOffsetAvailable="0" minOffsetAvailable="0" /> </MediaContainer>
The XML returned provides a list of the all the active transcode sessions on the Plex server. The root is the MediaContainer
element. This element contains a single attribute that indicates the number of active transcode sessions.
Attribute | Description |
---|---|
size | The number of transcode sessions. |
The MediaContainer
element will still be returned if no transcode session is active. The size
attribute will be 0, and there will be no TranscodeSession
child elements.
Within the MediaContainer
there are one or more TranscodeSession
child elements. Each TranscodeSession
element represents one transcode session that is active on the Plex server.
Attribute | Description |
---|---|
key | The unique key for the transcode session. |
throttled | Transcode session is throttled, meaning the server is able to transcode than necessary, so the server is throttled down. 0 - the server is not throttled, 1- the server is throttled. |
complete | Flag indicating if transcode session is complete. 0 - transcode session is not complete, 1 - transcode session is complete. |
progress | The progress, as a percentage, of the transcode session. |
size | Unknown. |
speed | The speed of the transcode. A value of 1.0 or greater means the transcode is sufficient for streaming the media. |
error | Flag indicating there is an error. 0 - no error, 1 - an error occurred. |
duration | The duration, in milliseconds, of the media. |
remaining | The remaining amount of media to be transcoded. |
context | The context of the transcode session. |
sourceVideoCodec | The video codec of the source media item. |
videoDecision | The type of stream that Plex decided to use. |
protocol | The protocol of the streaming session. |
container | The container of the media item. |
videoCodec | The video codec used for the transcode. |
transcodeHwRequested | The server requested the transcode use hardware transcoding. |
timeStamp | The current date and time, in epoch time, of the transcode. |
maxOffsetAvailable | The maximum time offset. |
minOffsetAvailable | The minimum time offset. |
Examples
curl -X GET http://{ip_address}:32400/transcode/sessions/?X-Plex-Token={plex_token}
import requests plex_url = http://{ip_address}:32400/transcode/sessions/?X-Plex-Token={plex_token} response = requests.get(plex_url) print(response.text)
$response = Invoke-RestMethod 'http://{ip_address}:32400/transcode/sessions/?X-Plex-Token={plex_token}' -Method 'GET' Write-Output $response