Search in sources :

Example 1 with JobTemplate

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());
    }
}
Also used : TranscoderServiceClient(com.google.cloud.video.transcoder.v1.TranscoderServiceClient) JobTemplateName(com.google.cloud.video.transcoder.v1.JobTemplateName) JobTemplate(com.google.cloud.video.transcoder.v1.JobTemplate)

Example 2 with JobTemplate

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());
    }
}
Also used : TranscoderServiceClient(com.google.cloud.video.transcoder.v1.TranscoderServiceClient) AudioStream(com.google.cloud.video.transcoder.v1.AudioStream) VideoStream(com.google.cloud.video.transcoder.v1.VideoStream) JobTemplate(com.google.cloud.video.transcoder.v1.JobTemplate) JobConfig(com.google.cloud.video.transcoder.v1.JobConfig)

Example 3 with JobTemplate

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());
        }
    }
}
Also used : TranscoderServiceClient(com.google.cloud.video.transcoder.v1.TranscoderServiceClient) JobTemplate(com.google.cloud.video.transcoder.v1.JobTemplate)

Aggregations

JobTemplate (com.google.cloud.video.transcoder.v1.JobTemplate)3 TranscoderServiceClient (com.google.cloud.video.transcoder.v1.TranscoderServiceClient)3 AudioStream (com.google.cloud.video.transcoder.v1.AudioStream)1 JobConfig (com.google.cloud.video.transcoder.v1.JobConfig)1 JobTemplateName (com.google.cloud.video.transcoder.v1.JobTemplateName)1 VideoStream (com.google.cloud.video.transcoder.v1.VideoStream)1