Skip to content

Instantly share code, notes, and snippets.

@tera-ny
Created October 23, 2021 08:31
Show Gist options
  • Save tera-ny/5509ff1c02ec4dcacaf51af3ac3916f1 to your computer and use it in GitHub Desktop.
Save tera-ny/5509ff1c02ec4dcacaf51af3ac3916f1 to your computer and use it in GitHub Desktop.
google cloud transcoder api job config.
const request = {
parent: client.locationPath(projectID, regionID),
job: {
inputUri,
outputUri,
config: {
pubsubDestination: {
topic: pubsubTopicID,
},
elementaryStreams: [
{
key: "video-stream0",
videoStream: {
h264: {
heightPixels: 360,
widthPixels: 640,
bitrateBps: 600000,
frameRate: 60,
gopDuration: { seconds: 6 },
},
},
},
{
key: "video-stream1",
videoStream: {
h264: {
heightPixels: 720,
widthPixels: 1280,
bitrateBps: 4000000,
frameRate: 60,
gopDuration: { seconds: 6 },
},
},
},
{
key: "video-stream2",
videoStream: {
h264: {
heightPixels: 1080,
widthPixels: 1920,
bitrateBps: 8000000,
frameRate: 60,
gopDuration: { seconds: 6 },
},
},
},
{
key: "audio-stream0",
audioStream: {
codec: "aac",
bitrateBps: 128000,
sampleRateHertz: 48000,
},
},
],
muxStreams: [
{
key: "media-sd",
container: "fmp4",
elementaryStreams: ["video-stream0"],
segmentSettings: {
segmentDuration: { seconds: 6 },
individualSegments: false,
},
},
{
key: "media-hd",
container: "fmp4",
elementaryStreams: ["video-stream1"],
segmentSettings: {
segmentDuration: { seconds: 6 },
individualSegments: false,
},
},
{
key: "media-fullhd",
container: "fmp4",
elementaryStreams: ["video-stream2"],
segmentSettings: {
segmentDuration: { seconds: 6 },
individualSegments: false,
},
},
{
key: "audio-only",
container: "fmp4",
elementaryStreams: ["audio-stream0"],
segmentSettings: {
segmentDuration: { seconds: 6 },
individualSegments: false,
},
},
],
manifests: [
{
fileName: "master.m3u8",
type: "HLS",
muxStreams: ["media-sd", "media-hd", "media-fullhd", "audio-only"],
},
{
fileName: "master.mpd",
type: "DASH",
muxStreams: ["media-sd", "media-hd", "media-fullhd", "audio-only"],
},
] as {
fileName: string
type: "HLS" | "DASH"
muxStreams: string[]
}[],
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment