#2 - Create a new job
Everything you need to know about POST /api/jobs within the Vencode API & SDK (with examples)
post
https://api.vencode.io
/api/jobs
Create a new transcoding job

Without JobBuilder

NodeJS / JavaScript
Python
1
const { Client } = require("@vencode/sdk");
2
3
const client = new Client({
4
// Your Vencode API Key and User ID
5
access: {
6
apiKey: "API_KEY from https://app.vencode.io/access",
7
userId: "USER_ID from https://app.vencode.io/access",
8
},
9
10
// Cloud storage credentials (your own s3, google cloud, or digital ocean details)
11
credentials: {
12
type: "s3" | "gc" | "do",
13
bucket: "*****",
14
clientId: "*****",
15
clientSecret: "****",
16
},
17
});
18
19
await client.encode({
20
input: {
21
path: "https://file-examples-com.github.io/uploads/2018/04/file_example_MOV_1920_2_2MB.mov",
22
},
23
outputs: [
24
{
25
key: "testing/sdk/webm.webm",
26
encode: { format: "webm", res: "1920x1080" },
27
},
28
],
29
thumbnails: [
30
{ key: "testing/sdk/thumb-1.png", at: "00:10", size: "1280x720" },
31
{ key: "testing/sdk/thumb-2.png", at: "00:20", size: "1280x720" },
32
],
33
});
Copied!
1
from vencode_sdk import Client, Options, Access, Credentials
2
from vencode_sdk.options import CreateEncodeJobOptions, Encode, Input, Output
3
4
client = Client(options=Options(
5
access=Access(
6
key="******",
7
id="usr_******"
8
),
9
credentials=Credentials(
10
clientId="***",
11
clientSecret="***",
12
type="s3",
13
bucket="cdn.vencode.io"
14
)
15
))
16
17
outputs = []
18
outputs.append(Output(
19
key="path/to/video.mp4",
20
encode=Encode(
21
format="mp4"
22
),
23
))
24
25
job = client.encode(encode=CreateEncodeJobOptions(
26
input=Input(path="https://url-to-video/video.mp4"),
27
outputs=outputs
28
))
Copied!

Using JobBuilder

NodeJS / JavaScript
1
const { Client, JobBuilder } = require("@vencode/sdk");
2
3
const client = new Client({
4
// Your Vencode API Key and User ID
5
access: {
6
apiKey: "API_KEY from https://app.vencode.io/access",
7
userId: "USER_ID from https://app.vencode.io/access",
8
},
9
10
// Cloud storage credentials (your own s3, google cloud, or digital ocean details)
11
credentials: {
12
type: "s3" | "gc" | "do",
13
bucket: "*****",
14
clientId: "*****",
15
clientSecret: "****",
16
},
17
});
18
19
// Create a builder instance
20
const builder = new JobBuilder(client)
21
22
// Video input URL
23
.withInput("https://file-examples-com.github.io/uploads/2018/04/file_example_MOV_1920_2_2MB.mov")
24
25
// Add an output with the key and encoding options (in this case we are encoding to webm at 1080p)
26
.addOutput({
27
key: "testing/sdk/encoded.webm",
28
encode: { format: "webm", res: "1920x1080" },
29
})
30
31
// Take two thumbnail screenshots, one at 10s and one at 20s - both 720p
32
.takeThumbnails([
33
{ key: "testing/sdk/thumb-1.png", at: "00:10", size: "1280x720" },
34
{ key: "testing/sdk/thumb-2.png", at: "00:20", size: "1280x720" },
35
]);
36
37
// Run the job async
38
const job = await builder.run();
Copied!