MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

media/transcoder/createJobFromAdHoc.js:18–97  ·  view source on GitHub ↗
(projectId, location, inputUri, outputUri)

Source from the content-addressed store, hash-verified

16'use strict';
17
18function main(projectId, location, inputUri, outputUri) {
19 // [START transcoder_create_job_from_ad_hoc]
20 /**
21 * TODO(developer): Uncomment these variables before running the sample.
22 */
23 // projectId = 'my-project-id';
24 // location = 'us-central1';
25 // inputUri = 'gs://my-bucket/my-video-file';
26 // outputUri = 'gs://my-bucket/my-output-folder/';
27
28 // Imports the Transcoder library
29 const {TranscoderServiceClient} =
30 require('@google-cloud/video-transcoder').v1;
31
32 // Instantiates a client
33 const transcoderServiceClient = new TranscoderServiceClient();
34
35 async function createJobFromAdHoc() {
36 // Construct request
37 const request = {
38 parent: transcoderServiceClient.locationPath(projectId, location),
39 job: {
40 inputUri: inputUri,
41 outputUri: outputUri,
42 config: {
43 elementaryStreams: [
44 {
45 key: 'video-stream0',
46 videoStream: {
47 h264: {
48 heightPixels: 360,
49 widthPixels: 640,
50 bitrateBps: 550000,
51 frameRate: 60,
52 },
53 },
54 },
55 {
56 key: 'video-stream1',
57 videoStream: {
58 h264: {
59 heightPixels: 720,
60 widthPixels: 1280,
61 bitrateBps: 2500000,
62 frameRate: 60,
63 },
64 },
65 },
66 {
67 key: 'audio-stream0',
68 audioStream: {
69 codec: 'aac',
70 bitrateBps: 64000,
71 },
72 },
73 ],
74 muxStreams: [
75 {

Callers 1

Calls 1

createJobFromAdHocFunction · 0.85

Tested by

no test coverage detected