API Operations against the Transcoder
Audio transcode endpoint for music playback.
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.errors.Error;
import dev.plexapi.sdk.models.operations.TranscodeMusicRequest;
import dev.plexapi.sdk.models.operations.TranscodeMusicResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Error, Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
TranscodeMusicRequest req = TranscodeMusicRequest.builder()
.build();
TranscodeMusicResponse res = sdk.transcoder().transcodeMusic()
.request(req)
.call();
if (res.successResponse().isPresent()) {
System.out.println(res.successResponse().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
TranscodeMusicRequest |
✔️ |
The request object to use for the request. |
TranscodeMusicResponse
| Error Type |
Status Code |
Content Type |
| models/errors/Error |
401 |
application/json |
| models/errors/SDKError |
4XX, 5XX |
*/* |
Transcode an image, possibly changing format or size
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.TranscodeImageRequest;
import dev.plexapi.sdk.models.operations.TranscodeImageResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
TranscodeImageRequest req = TranscodeImageRequest.builder()
.url("/library/metadata/265/thumb/1715112705")
.background("#ff5522")
.upscale(BoolInt.True)
.minSize(BoolInt.True)
.rotate(BoolInt.True)
.blendColor("#ff5522")
.build();
TranscodeImageResponse res = sdk.transcoder().transcodeImage()
.request(req)
.call();
if (res.twoHundredImageJpegResponseStream().isPresent()) {
// handle response
}
}
}
| Parameter |
Type |
Required |
Description |
request |
TranscodeImageRequest |
✔️ |
The request object to use for the request. |
TranscodeImageResponse
| Error Type |
Status Code |
Content Type |
| models/errors/SDKError |
4XX, 5XX |
*/* |
Get active transcode sessions.
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.errors.Error;
import dev.plexapi.sdk.models.operations.GetTranscodeSessionsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Error, Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetTranscodeSessionsResponse res = sdk.transcoder().getTranscodeSessions()
.call();
if (res.mediaContainerWithMetadata().isPresent()) {
System.out.println(res.mediaContainerWithMetadata().get());
}
}
}
GetTranscodeSessionsResponse
| Error Type |
Status Code |
Content Type |
| models/errors/Error |
401 |
application/json |
| models/errors/SDKError |
4XX, 5XX |
*/* |
Make a decision on media playback based on client profile, and requested settings such as bandwidth and resolution.
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.errors.Error;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.*;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Error, Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
MakeDecisionRequest req = MakeDecisionRequest.builder()
.transcodeType(TranscodeType.MUSIC)
.advancedSubtitles(AdvancedSubtitles.BURN)
.audioBoost(50L)
.audioChannelCount(5L)
.autoAdjustQuality(BoolInt.True)
.autoAdjustSubtitle(BoolInt.True)
.directPlay(BoolInt.True)
.directStream(BoolInt.True)
.directStreamAudio(BoolInt.True)
.disableResolutionRotation(BoolInt.True)
.hasMDE(BoolInt.True)
.location(Location.WAN)
.mediaBufferSize(102400L)
.mediaIndex(0L)
.musicBitrate(5000L)
.offset(90.5)
.partIndex(0L)
.path("/library/metadata/151671")
.peakBitrate(12000L)
.photoResolution("1080x1080")
.protocol(QueryParamProtocol.DASH)
.secondsPerSegment(5L)
.subtitleSize(50L)
.subtitles(Subtitles.BURN)
.videoResolution("1080x1080")
.copyts(BoolInt.True)
.videoBitrate(12000L)
.videoQuality(50L)
.xPlexClientProfileExtra("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("generic")
.build();
MakeDecisionResponse res = sdk.transcoder().makeDecision()
.request(req)
.call();
if (res.mediaContainerWithDecision().isPresent()) {
System.out.println(res.mediaContainerWithDecision().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
MakeDecisionRequest |
✔️ |
The request object to use for the request. |
MakeDecisionResponse
| Error Type |
Status Code |
Content Type |
| models/errors/Error |
401 |
application/json |
| models/errors/SDKError |
4XX, 5XX |
*/* |
Manually trigger a transcoder fallback ex: HEVC to h.264 or hw to sw
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.TriggerFallbackRequest;
import dev.plexapi.sdk.models.operations.TriggerFallbackResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.TranscodeType;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
TriggerFallbackRequest req = TriggerFallbackRequest.builder()
.transcodeType(TranscodeType.AUDIO)
.build();
TriggerFallbackResponse res = sdk.transcoder().triggerFallback()
.request(req)
.call();
// handle response
}
}
| Parameter |
Type |
Required |
Description |
request |
TriggerFallbackRequest |
✔️ |
The request object to use for the request. |
TriggerFallbackResponse
| Error Type |
Status Code |
Content Type |
| models/errors/SDKError |
4XX, 5XX |
*/* |
Only transcode subtitle streams.
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.*;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
TranscodeSubtitlesRequest req = TranscodeSubtitlesRequest.builder()
.transcodeType(TranscodeType.AUDIO)
.advancedSubtitles(AdvancedSubtitles.BURN)
.audioBoost(50L)
.audioChannelCount(5L)
.autoAdjustQuality(BoolInt.True)
.autoAdjustSubtitle(BoolInt.True)
.directPlay(BoolInt.True)
.directStream(BoolInt.True)
.directStreamAudio(BoolInt.True)
.disableResolutionRotation(BoolInt.True)
.hasMDE(BoolInt.True)
.location(QueryParamLocation.WAN)
.mediaBufferSize(102400L)
.mediaIndex(0L)
.musicBitrate(5000L)
.offset(90.5)
.partIndex(0L)
.path("/library/metadata/151671")
.peakBitrate(12000L)
.photoResolution("1080x1080")
.protocol(TranscodeSubtitlesQueryParamProtocol.DASH)
.secondsPerSegment(5L)
.subtitleSize(50L)
.subtitles(QueryParamSubtitles.BURN)
.videoResolution("1080x1080")
.copyts(BoolInt.True)
.videoBitrate(12000L)
.videoQuality(50L)
.xPlexClientProfileExtra("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("generic")
.build();
TranscodeSubtitlesResponse res = sdk.transcoder().transcodeSubtitles()
.request(req)
.call();
if (res.binaryResponse().isPresent()) {
// handle response
}
}
}
TranscodeSubtitlesResponse
| Error Type |
Status Code |
Content Type |
| models/errors/SDKError |
4XX, 5XX |
*/* |
Starts the transcoder and returns the corresponding streaming resource document.
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.*;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
StartTranscodeSessionRequest req = StartTranscodeSessionRequest.builder()
.transcodeType(TranscodeType.MUSIC)
.extension(Extension.MPD)
.advancedSubtitles(AdvancedSubtitles.BURN)
.audioBoost(50L)
.audioChannelCount(5L)
.autoAdjustQuality(BoolInt.True)
.autoAdjustSubtitle(BoolInt.True)
.directPlay(BoolInt.True)
.directStream(BoolInt.True)
.directStreamAudio(BoolInt.True)
.disableResolutionRotation(BoolInt.True)
.hasMDE(BoolInt.True)
.location(StartTranscodeSessionQueryParamLocation.WAN)
.mediaBufferSize(102400L)
.mediaIndex(0L)
.musicBitrate(5000L)
.offset(90.5)
.partIndex(0L)
.path("/library/metadata/151671")
.peakBitrate(12000L)
.photoResolution("1080x1080")
.protocol(StartTranscodeSessionQueryParamProtocol.DASH)
.secondsPerSegment(5L)
.subtitleSize(50L)
.subtitles(StartTranscodeSessionQueryParamSubtitles.BURN)
.videoResolution("1080x1080")
.copyts(BoolInt.True)
.videoBitrate(12000L)
.videoQuality(50L)
.xPlexClientProfileExtra("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("generic")
.build();
StartTranscodeSessionResponse res = sdk.transcoder().startTranscodeSession()
.request(req)
.call();
if (res.twoHundredApplicationVndAppleMpegurlBinaryResponse().isPresent()) {
// handle response
}
}
}
StartTranscodeSessionResponse
| Error Type |
Status Code |
Content Type |
| models/errors/SDKError |
4XX, 5XX |
*/* |
DASH segment delivery for adaptive streaming.
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.errors.Error;
import dev.plexapi.sdk.models.operations.GetDASHSegmentRequest;
import dev.plexapi.sdk.models.operations.GetDASHSegmentResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Error, Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetDASHSegmentRequest req = GetDASHSegmentRequest.builder()
.transcodeType("<value>")
.sessionId("<id>")
.segmentId("<id>")
.build();
GetDASHSegmentResponse res = sdk.transcoder().getDASHSegment()
.request(req)
.call();
if (res.responseStream().isPresent()) {
// handle response
}
}
}
| Parameter |
Type |
Required |
Description |
request |
GetDASHSegmentRequest |
✔️ |
The request object to use for the request. |
GetDASHSegmentResponse
| Error Type |
Status Code |
Content Type |
| models/errors/Error |
401 |
application/json |
| models/errors/SDKError |
4XX, 5XX |
*/* |
HLS TS segment delivery for adaptive streaming.
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.errors.Error;
import dev.plexapi.sdk.models.operations.GetHLSSegmentRequest;
import dev.plexapi.sdk.models.operations.GetHLSSegmentResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Error, Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetHLSSegmentRequest req = GetHLSSegmentRequest.builder()
.transcodeType("<value>")
.sessionId("<id>")
.segmentId("<id>")
.build();
GetHLSSegmentResponse res = sdk.transcoder().getHLSSegment()
.request(req)
.call();
if (res.responseStream().isPresent()) {
// handle response
}
}
}
| Parameter |
Type |
Required |
Description |
request |
GetHLSSegmentRequest |
✔️ |
The request object to use for the request. |
GetHLSSegmentResponse
| Error Type |
Status Code |
Content Type |
| models/errors/Error |
401 |
application/json |
| models/errors/SDKError |
4XX, 5XX |
*/* |