Skip to main content
GET
/
{transcodeType}
/
:
/
transcode
/
universal
/
decision
PlexGO
package main

import(
	"context"
	"github.com/LukeHagar/plexgo/models/components"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := plexgo.New(
        plexgo.WithAccepts(components.AcceptsApplicationXML),
        plexgo.WithClientIdentifier("abc123"),
        plexgo.WithProduct("Plex for Roku"),
        plexgo.WithVersion("2.4.1"),
        plexgo.WithPlatform("Roku"),
        plexgo.WithPlatformVersion("4.3 build 1057"),
        plexgo.WithDevice("Roku 3"),
        plexgo.WithModel("4200X"),
        plexgo.WithDeviceVendor("Roku"),
        plexgo.WithDeviceName("Living Room TV"),
        plexgo.WithMarketplace("googlePlay"),
        plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
    )

    res, err := s.Transcoder.MakeDecision(ctx, operations.MakeDecisionRequest{
        TranscodeType: components.TranscodeTypeMusic,
        AdvancedSubtitles: components.AdvancedSubtitlesBurn.ToPointer(),
        AudioBoost: plexgo.Pointer[int64](50),
        AudioChannelCount: plexgo.Pointer[int64](5),
        AutoAdjustQuality: components.BoolIntOne.ToPointer(),
        AutoAdjustSubtitle: components.BoolIntOne.ToPointer(),
        DirectPlay: components.BoolIntOne.ToPointer(),
        DirectStream: components.BoolIntOne.ToPointer(),
        DirectStreamAudio: components.BoolIntOne.ToPointer(),
        DisableResolutionRotation: components.BoolIntOne.ToPointer(),
        HasMDE: components.BoolIntOne.ToPointer(),
        Location: operations.LocationWan.ToPointer(),
        MediaBufferSize: plexgo.Pointer[int64](102400),
        MediaIndex: plexgo.Pointer[int64](0),
        MusicBitrate: plexgo.Pointer[int64](5000),
        Offset: plexgo.Pointer[float64](90.5),
        PartIndex: plexgo.Pointer[int64](0),
        Path: plexgo.Pointer("/library/metadata/151671"),
        PeakBitrate: plexgo.Pointer[int64](12000),
        PhotoResolution: plexgo.Pointer("1080x1080"),
        Protocol: operations.ProtocolDash.ToPointer(),
        SecondsPerSegment: plexgo.Pointer[int64](5),
        SubtitleSize: plexgo.Pointer[int64](50),
        VideoBitrate: plexgo.Pointer[int64](12000),
        VideoQuality: plexgo.Pointer[int64](50),
        VideoResolution: plexgo.Pointer("1080x1080"),
        XPlexClientProfileExtra: plexgo.Pointer("add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264%2Chevc&audioCodec=aac&protocol=dash)"),
        XPlexClientProfileName: plexgo.Pointer("generic"),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.MediaContainerWithDecision != nil {
        // handle response
    }
}
{
  "MediaContainer": {
    "identifier": "<string>",
    "offset": 123,
    "size": 123,
    "totalSize": 123,
    "availableBandwidth": 123,
    "directPlayDecisionCode": 123,
    "directPlayDecisionText": "<string>",
    "generalDecisionCode": 123,
    "generalDecisionText": "<string>",
    "mdeDecisionCode": 123,
    "mdeDecisionText": "<string>",
    "Metadata": [
      {
        "title": "<any>",
        "type": "<any>",
        "absoluteIndex": 123,
        "addedAt": 123,
        "art": "<any>",
        "audienceRating": 5,
        "audienceRatingImage": "<any>",
        "Autotag": [
          {
            "confidence": 123,
            "context": "<string>",
            "filter": "<any>",
            "id": 123,
            "ratingKey": "<string>",
            "role": "<any>",
            "tag": "<any>",
            "tagKey": "<any>",
            "tagType": 123,
            "thumb": "<any>"
          }
        ],
        "banner": "<any>",
        "chapterSource": "<any>",
        "composite": "<any>",
        "contentRating": "<any>",
        "Country": [
          {
            "confidence": 123,
            "context": "<string>",
            "filter": "<any>",
            "id": 123,
            "ratingKey": "<string>",
            "role": "<any>",
            "tag": "<any>",
            "tagKey": "<any>",
            "tagType": 123,
            "thumb": "<any>"
          }
        ],
        "Director": [
          {
            "confidence": 123,
            "context": "<string>",
            "filter": "<any>",
            "id": 123,
            "ratingKey": "<string>",
            "role": "<any>",
            "tag": "<any>",
            "tagKey": "<any>",
            "tagType": 123,
            "thumb": "<any>"
          }
        ],
        "duration": 123,
        "Filter": [
          {
            "title": "<string>",
            "type": "<string>",
            "art": "<string>",
            "content": true,
            "filter": "<string>",
            "hasPrefs": true,
            "hasStoreServices": true,
            "hubKey": "<string>",
            "identifier": "<string>",
            "key": "<string>",
            "lastAccessedAt": 123,
            "Pivot": [
              "<any>"
            ],
            "share": 123,
            "thumb": "<string>",
            "titleBar": "<string>",
            "filterType": "<string>"
          }
        ],
        "Genre": [
          {
            "confidence": 123,
            "context": "<string>",
            "filter": "<any>",
            "id": 123,
            "ratingKey": "<string>",
            "role": "<any>",
            "tag": "<any>",
            "tagKey": "<any>",
            "tagType": 123,
            "thumb": "<any>"
          }
        ],
        "grandparentArt": "<string>",
        "grandparentHero": "<string>",
        "grandparentKey": "<string>",
        "grandparentRatingKey": "<string>",
        "grandparentTheme": "<string>",
        "grandparentThumb": "<string>",
        "grandparentTitle": "<string>",
        "Guid": [
          {
            "confidence": 123,
            "context": "<string>",
            "filter": "<any>",
            "id": 123,
            "ratingKey": "<string>",
            "role": "<any>",
            "tag": "<any>",
            "tagKey": "<any>",
            "tagType": 123,
            "thumb": "<any>"
          }
        ],
        "hero": "<any>",
        "Image": [
          {
            "type": "background",
            "alt": "<string>",
            "url": "<string>"
          }
        ],
        "index": 123,
        "key": "<any>",
        "lastViewedAt": 123,
        "leafCount": 123,
        "Media": [
          {
            "aspectRatio": 2.35,
            "audioChannels": 2,
            "audioCodec": "<any>",
            "audioProfile": "<any>",
            "bitrate": 5612,
            "container": "<any>",
            "duration": 150192,
            "has64bitOffsets": false,
            "hasVoiceActivity": true,
            "height": 544,
            "id": 1,
            "optimizedForStreaming": false,
            "Part": [
              {}
            ],
            "videoCodec": "<any>",
            "videoFrameRate": "<any>",
            "videoProfile": "<any>",
            "videoResolution": "<any>",
            "width": 1280,
            "abr": true,
            "resourceSession": "<string>",
            "selected": true
          }
        ],
        "originallyAvailableAt": "<any>",
        "originalTitle": "<any>",
        "parentHero": "<string>",
        "parentIndex": 123,
        "parentKey": "<string>",
        "parentRatingKey": "<string>",
        "parentThumb": "<string>",
        "parentTitle": "<string>",
        "primaryExtraKey": "<any>",
        "prompt": "<string>",
        "rating": 5,
        "Rating": [
          {
            "confidence": 123,
            "context": "<string>",
            "filter": "<any>",
            "id": 123,
            "ratingKey": "<string>",
            "role": "<any>",
            "tag": "<any>",
            "tagKey": "<any>",
            "tagType": 123,
            "thumb": "<any>"
          }
        ],
        "ratingCount": 123,
        "ratingImage": "<any>",
        "ratingKey": "<any>",
        "Role": [
          {
            "confidence": 123,
            "context": "<string>",
            "filter": "<any>",
            "id": 123,
            "ratingKey": "<string>",
            "role": "<any>",
            "tag": "<any>",
            "tagKey": "<any>",
            "tagType": 123,
            "thumb": "<any>"
          }
        ],
        "search": true,
        "secondary": true,
        "skipChildren": true,
        "skipParent": true,
        "Sort": [
          {
            "title": "<string>",
            "type": "<string>",
            "art": "<string>",
            "content": true,
            "filter": "<string>",
            "hasPrefs": true,
            "hasStoreServices": true,
            "hubKey": "<string>",
            "identifier": "<string>",
            "key": "<string>",
            "lastAccessedAt": 123,
            "Pivot": [
              "<any>"
            ],
            "share": 123,
            "thumb": "<string>",
            "titleBar": "<string>",
            "default": "asc",
            "defaultDirection": "asc",
            "descKey": "<string>",
            "firstCharacterKey": "<string>"
          }
        ],
        "studio": "<any>",
        "subtype": "<any>",
        "summary": "<any>",
        "tagline": "<any>",
        "theme": "<any>",
        "thumb": "<any>",
        "titleSort": "<any>",
        "updatedAt": 123,
        "userRating": 5,
        "viewCount": 123,
        "viewedLeafCount": 123,
        "viewOffset": 123,
        "Writer": [
          {
            "confidence": 123,
            "context": "<string>",
            "filter": "<any>",
            "id": 123,
            "ratingKey": "<string>",
            "role": "<any>",
            "tag": "<any>",
            "tagKey": "<any>",
            "tagType": 123,
            "thumb": "<any>"
          }
        ],
        "year": 123
      }
    ],
    "transcodeDecisionCode": 123,
    "transcodeDecisionText": "<string>"
  }
}

Authorizations

X-Plex-Token
string
header
required

Headers

accepts
enum<string>
default:application/xml
Available options:
application/json,
application/xml
X-Plex-Client-Identifier
string
required
X-Plex-Product
string
Example:
X-Plex-Version
string
Example:
X-Plex-Platform
string
X-Plex-Platform-Version
string
X-Plex-Device
string
X-Plex-Model
string
X-Plex-Device-Vendor
string
Example:
X-Plex-Device-Name
string
Example:
X-Plex-Marketplace
string
Example:
X-Plex-Client-Profile-Extra
string
X-Plex-Client-Profile-Name
string
X-Plex-Session-Identifier
string

Path Parameters

transcodeType
enum<string>
required
Available options:
video,
music,
audio,
subtitles

Query Parameters

transcodeSessionId
string
advancedSubtitles
enum<string>
Available options:
burn,
text,
unknown
audioBoost
integer
Required range: x >= 1
audioChannelCount
integer
Required range: 1 <= x <= 8
autoAdjustQuality
enum<integer>
Available options:
0,
1
autoAdjustSubtitle
enum<integer>
Available options:
0,
1
directPlay
enum<integer>
Available options:
0,
1
directStream
enum<integer>
Available options:
0,
1
directStreamAudio
enum<integer>
Available options:
0,
1
disableResolutionRotation
enum<integer>
Available options:
0,
1
hasMDE
enum<integer>
Available options:
0,
1
location
enum<string>
Available options:
lan,
wan,
cellular
mediaBufferSize
integer
mediaIndex
integer
musicBitrate
integer
Required range: x >= 0
offset
number
partIndex
integer
path
string
peakBitrate
integer
Required range: x >= 0
photoResolution
string
protocol
enum<string>
Available options:
http,
hls,
dash
secondsPerSegment
integer
subtitleSize
integer
Required range: x >= 1
subtitles
enum<string>
Available options:
auto,
burn,
none,
sidecar,
embedded,
segmented,
unknown
videoBitrate
integer
Required range: x >= 0
videoQuality
integer
Required range: 0 <= x <= 99
videoResolution
string

Response

200 - application/json
MediaContainer
object