API Operations against the Transcoder
- TranscodeMusic - Transcode Music
- TranscodeImage - Transcode an image
- GetTranscodeSessions - Get Transcode Sessions
- MakeDecision - Make a decision on media playback
- TriggerFallback - Manually trigger a transcoder fallback
- TranscodeSubtitles - Transcode subtitles
- StartTranscodeSession - Start A Transcoding Session
- GetDASHSegment - Get DASH Segment
- GetHLSSegment - Get HLS Segment
Audio transcode endpoint for music playback.
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.TranscodeMusic(ctx, operations.TranscodeMusicRequest{}) if err != nil { log.Fatal(err) } if res.SuccessResponse != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.TranscodeMusicRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.TranscodeMusicResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.Error | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | */* |
Transcode an image, possibly changing format or size
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.TranscodeImage(ctx, operations.TranscodeImageRequest{ URL: plexgo.Pointer("/library/metadata/265/thumb/1715112705"), Background: plexgo.Pointer("#ff5522"), Upscale: components.BoolIntTrue.ToPointer(), MinSize: components.BoolIntTrue.ToPointer(), Rotate: components.BoolIntTrue.ToPointer(), BlendColor: plexgo.Pointer("#ff5522"), }) if err != nil { log.Fatal(err) } if res.TwoHundredImageJpegResponseStream != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.TranscodeImageRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.TranscodeImageResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Get active transcode sessions.
package main import( "context" "github.com/LukeHagar/plexgo" "log" ) func main() { ctx := context.Background() s := plexgo.New( plexgo.WithSecurity("<YOUR_API_KEY_HERE>"), ) res, err := s.Transcoder.GetTranscodeSessions(ctx) if err != nil { log.Fatal(err) } if res.MediaContainerWithMetadata != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetTranscodeSessionsResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.Error | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | */* |
Make a decision on media playback based on client profile, and requested settings such as bandwidth and resolution.
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.BoolIntTrue.ToPointer(), AutoAdjustSubtitle: components.BoolIntTrue.ToPointer(), DirectPlay: components.BoolIntTrue.ToPointer(), DirectStream: components.BoolIntTrue.ToPointer(), DirectStreamAudio: components.BoolIntTrue.ToPointer(), DisableResolutionRotation: components.BoolIntTrue.ToPointer(), HasMDE: components.BoolIntTrue.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.QueryParamProtocolDash.ToPointer(), SecondsPerSegment: plexgo.Pointer[int64](5), SubtitleSize: plexgo.Pointer[int64](50), Subtitles: operations.SubtitlesBurn.ToPointer(), VideoResolution: plexgo.Pointer("1080x1080"), Copyts: components.BoolIntTrue.ToPointer(), VideoBitrate: plexgo.Pointer[int64](12000), VideoQuality: plexgo.Pointer[int64](50), 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 } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.MakeDecisionRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.MakeDecisionResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.Error | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | */* |
Manually trigger a transcoder fallback ex: HEVC to h.264 or hw to sw
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.TriggerFallback(ctx, operations.TriggerFallbackRequest{ TranscodeType: components.TranscodeTypeAudio, }) if err != nil { log.Fatal(err) } if res != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.TriggerFallbackRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.TriggerFallbackResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Only transcode subtitle streams.
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.TranscodeSubtitles(ctx, operations.TranscodeSubtitlesRequest{ TranscodeType: components.TranscodeTypeAudio, AdvancedSubtitles: components.AdvancedSubtitlesBurn.ToPointer(), AudioBoost: plexgo.Pointer[int64](50), AudioChannelCount: plexgo.Pointer[int64](5), AutoAdjustQuality: components.BoolIntTrue.ToPointer(), AutoAdjustSubtitle: components.BoolIntTrue.ToPointer(), DirectPlay: components.BoolIntTrue.ToPointer(), DirectStream: components.BoolIntTrue.ToPointer(), DirectStreamAudio: components.BoolIntTrue.ToPointer(), DisableResolutionRotation: components.BoolIntTrue.ToPointer(), HasMDE: components.BoolIntTrue.ToPointer(), Location: operations.QueryParamLocationWan.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.TranscodeSubtitlesQueryParamProtocolDash.ToPointer(), SecondsPerSegment: plexgo.Pointer[int64](5), SubtitleSize: plexgo.Pointer[int64](50), Subtitles: operations.QueryParamSubtitlesBurn.ToPointer(), VideoResolution: plexgo.Pointer("1080x1080"), Copyts: components.BoolIntTrue.ToPointer(), VideoBitrate: plexgo.Pointer[int64](12000), VideoQuality: plexgo.Pointer[int64](50), 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.BinaryResponse != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.TranscodeSubtitlesRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.TranscodeSubtitlesResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
Starts the transcoder and returns the corresponding streaming resource document.
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.StartTranscodeSession(ctx, operations.StartTranscodeSessionRequest{ TranscodeType: components.TranscodeTypeMusic, AdvancedSubtitles: components.AdvancedSubtitlesBurn.ToPointer(), Extension: operations.ExtensionMpd, AudioBoost: plexgo.Pointer[int64](50), AudioChannelCount: plexgo.Pointer[int64](5), AutoAdjustQuality: components.BoolIntTrue.ToPointer(), AutoAdjustSubtitle: components.BoolIntTrue.ToPointer(), DirectPlay: components.BoolIntTrue.ToPointer(), DirectStream: components.BoolIntTrue.ToPointer(), DirectStreamAudio: components.BoolIntTrue.ToPointer(), DisableResolutionRotation: components.BoolIntTrue.ToPointer(), HasMDE: components.BoolIntTrue.ToPointer(), Location: operations.StartTranscodeSessionQueryParamLocationWan.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.StartTranscodeSessionQueryParamProtocolDash.ToPointer(), SecondsPerSegment: plexgo.Pointer[int64](5), SubtitleSize: plexgo.Pointer[int64](50), Subtitles: operations.StartTranscodeSessionQueryParamSubtitlesBurn.ToPointer(), VideoResolution: plexgo.Pointer("1080x1080"), Copyts: components.BoolIntTrue.ToPointer(), VideoBitrate: plexgo.Pointer[int64](12000), VideoQuality: plexgo.Pointer[int64](50), 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.TwoHundredApplicationVndAppleMpegurlBinaryResponse != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.StartTranscodeSessionRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.StartTranscodeSessionResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.SDKError | 4XX, 5XX | */* |
DASH segment delivery for adaptive streaming.
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.GetDASHSegment(ctx, operations.GetDASHSegmentRequest{ TranscodeType: "<value>", SessionID: "<id>", SegmentID: "<id>", }) if err != nil { log.Fatal(err) } if res.ResponseStream != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetDASHSegmentRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetDASHSegmentResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.Error | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | */* |
HLS TS segment delivery for adaptive streaming.
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.GetHLSSegment(ctx, operations.GetHLSSegmentRequest{ TranscodeType: "<value>", SessionID: "<id>", SegmentID: "<id>", }) if err != nil { log.Fatal(err) } if res.ResponseStream != nil { // handle response } }
| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetHLSSegmentRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetHLSSegmentResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| sdkerrors.Error | 401 | application/json |
| sdkerrors.SDKError | 4XX, 5XX | */* |