use of com.google.cloud.video.transcoder.v1.JobTemplate in project java-docs-samples by GoogleCloudPlatform.
the class GetJobTemplate method getJobTemplate.
// Gets a job template.
public static void getJobTemplate(String projectId, String location, String templateId) throws IOException {
// once, and can be reused for multiple requests.
try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
JobTemplateName jobTemplateName = JobTemplateName.newBuilder().setProject(projectId).setLocation(location).setJobTemplate(templateId).build();
var getJobTemplateRequest = GetJobTemplateRequest.newBuilder().setName(jobTemplateName.toString()).build();
// Send the get job template request and process the response.
JobTemplate jobTemplate = transcoderServiceClient.getJobTemplate(getJobTemplateRequest);
System.out.println("Job template: " + jobTemplate.getName());
}
}
use of com.google.cloud.video.transcoder.v1.JobTemplate in project java-docs-samples by GoogleCloudPlatform.
the class CreateJobTemplate method createJobTemplate.
// Creates a job template.
public static void createJobTemplate(String projectId, String location, String templateId) throws IOException {
// once, and can be reused for multiple requests.
try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
VideoStream videoStream0 = VideoStream.newBuilder().setH264(VideoStream.H264CodecSettings.newBuilder().setBitrateBps(550000).setFrameRate(60).setHeightPixels(360).setWidthPixels(640)).build();
VideoStream videoStream1 = VideoStream.newBuilder().setH264(VideoStream.H264CodecSettings.newBuilder().setBitrateBps(2500000).setFrameRate(60).setHeightPixels(720).setWidthPixels(1280)).build();
AudioStream audioStream0 = AudioStream.newBuilder().setCodec("aac").setBitrateBps(64000).build();
JobConfig config = JobConfig.newBuilder().addElementaryStreams(ElementaryStream.newBuilder().setKey("video_stream0").setVideoStream(videoStream0)).addElementaryStreams(ElementaryStream.newBuilder().setKey("video_stream1").setVideoStream(videoStream1)).addElementaryStreams(ElementaryStream.newBuilder().setKey("audio_stream0").setAudioStream(audioStream0)).addMuxStreams(MuxStream.newBuilder().setKey("sd").setContainer("mp4").addElementaryStreams("video_stream0").addElementaryStreams("audio_stream0").build()).addMuxStreams(MuxStream.newBuilder().setKey("hd").setContainer("mp4").addElementaryStreams("video_stream1").addElementaryStreams("audio_stream0").build()).build();
var createJobTemplateRequest = CreateJobTemplateRequest.newBuilder().setParent(LocationName.of(projectId, location).toString()).setJobTemplateId(templateId).setJobTemplate(JobTemplate.newBuilder().setConfig(config).build()).build();
// Send the job template creation request and process the response.
JobTemplate jobTemplate = transcoderServiceClient.createJobTemplate(createJobTemplateRequest);
System.out.println("Job template: " + jobTemplate.getName());
}
}
use of com.google.cloud.video.transcoder.v1.JobTemplate in project java-docs-samples by GoogleCloudPlatform.
the class ListJobTemplates method listJobTemplates.
// Lists the job templates for a given location.
public static void listJobTemplates(String projectId, String location) throws IOException {
// once, and can be reused for multiple requests.
try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
var listJobTemplatesRequest = ListJobTemplatesRequest.newBuilder().setParent(LocationName.of(projectId, location).toString()).build();
// Send the list job templates request and process the response.
TranscoderServiceClient.ListJobTemplatesPagedResponse response = transcoderServiceClient.listJobTemplates(listJobTemplatesRequest);
System.out.println("Job templates:");
for (JobTemplate jobTemplate : response.iterateAll()) {
System.out.println(jobTemplate.getName());
}
}
}
Aggregations