import { Livepeer } from "livepeer";
import {
TranscodePayloadSchemasStorageType,
TranscodeProfileEncoder,
TranscodeProfileProfile,
} from "livepeer/models/components";
const livepeer = new Livepeer({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeer.transcode.create({
input: {
url: "https://s3.amazonaws.com/bucket/file.mp4",
},
storage: {
type: TranscodePayloadSchemasStorageType.Web3Storage,
credentials: {
proof: "EaJlcm9vdHOAZ3ZlcnNpb24BmgIBcRIg2uxHpcPYSWNtifMKFkPC7IEDvFDCxCd3ADViv0coV7SnYXNYRO2hA0AnblHEW38s3lSlcwaDjPn",
},
},
outputs: {
hls: {
path: "/samplevideo/hls",
},
mp4: {
path: "/samplevideo/mp4",
},
fmp4: {
path: "/samplevideo/fmp4",
},
},
profiles: [
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
quality: 23,
fps: 30,
fpsDen: 1,
gop: "2",
profile: TranscodeProfileProfile.H264Baseline,
encoder: TranscodeProfileEncoder.H264,
},
],
});
// Handle the result
console.log(result);
}
run();package main
import(
livepeergo "github.com/livepeer/livepeer-go"
"context"
"github.com/livepeer/livepeer-go/models/components"
"log"
)
func main() {
s := livepeergo.New(
livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Transcode.Create(ctx, components.TranscodePayload{
Input: components.CreateInputInput1(
components.Input1{
URL: "https://s3.amazonaws.com/bucket/file.mp4",
},
),
Storage: components.CreateTranscodePayloadStorageStorage1(
components.Storage1{
Type: components.StorageTypeS3,
Endpoint: "https://gateway.storjshare.io",
Bucket: "outputbucket",
Credentials: components.StorageCredentials{
AccessKeyID: "AKIAIOSFODNN7EXAMPLE",
SecretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
},
},
),
Outputs: components.Outputs{
Hls: &components.Hls{
Path: "/samplevideo/hls",
},
Mp4: &components.Mp4{
Path: "/samplevideo/mp4",
},
Fmp4: &components.Fmp4{
Path: "/samplevideo/fmp4",
},
},
Profiles: []components.TranscodeProfile{
components.TranscodeProfile{
Width: livepeergo.Int64(1280),
Name: livepeergo.String("720p"),
Height: livepeergo.Int64(720),
Bitrate: 3000000,
Quality: livepeergo.Int64(23),
Fps: livepeergo.Int64(30),
FpsDen: livepeergo.Int64(1),
Gop: livepeergo.String("2"),
Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(),
Encoder: components.TranscodeProfileEncoderH264.ToPointer(),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Task != nil {
// handle response
}
}from livepeer import Livepeer
from livepeer.models import components
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.transcode.create(request={
"input": {
"url": "https://s3.amazonaws.com/bucket/file.mp4",
},
"storage": {
"type": components.StorageType.S3,
"endpoint": "https://gateway.storjshare.io",
"bucket": "outputbucket",
"credentials": {
"access_key_id": "AKIAIOSFODNN7EXAMPLE",
"secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
},
},
"outputs": {
"hls": {
"path": "/samplevideo/hls",
},
"mp4": {
"path": "/samplevideo/mp4",
},
"fmp4": {
"path": "/samplevideo/fmp4",
},
},
"profiles": [
{
"width": 1280,
"name": "720p",
"height": 720,
"bitrate": 3000000,
"quality": 23,
"fps": 30,
"fps_den": 1,
"gop": "2",
"profile": components.TranscodeProfileProfile.H264_BASELINE,
"encoder": components.TranscodeProfileEncoder.H_264,
},
],
})
if res.task is not None:
# handle response
passcurl --request POST \
--url https://livepeer.studio/api/transcode \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": {
"url": "https://s3.amazonaws.com/bucket/file.mp4"
},
"storage": {
"type": "s3",
"endpoint": "https://gateway.storjshare.io",
"bucket": "outputbucket",
"credentials": {
"accessKeyId": "AKIAIOSFODNN7EXAMPLE",
"secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}
},
"outputs": {},
"profiles": [
{
"bitrate": 3000000,
"width": 1280,
"name": "720p",
"height": 720,
"quality": 23,
"fps": 30,
"fpsDen": 1,
"gop": 2,
"profile": "H264Baseline",
"encoder": "H.264"
}
],
"targetSegmentSizeSecs": 123,
"creatorId": {
"type": "unverified",
"value": "<string>"
},
"c2pa": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: {url: 'https://s3.amazonaws.com/bucket/file.mp4'},
storage: {
type: 's3',
endpoint: 'https://gateway.storjshare.io',
bucket: 'outputbucket',
credentials: {
accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
}
},
outputs: {},
profiles: [
{
bitrate: 3000000,
width: 1280,
name: '720p',
height: 720,
quality: 23,
fps: 30,
fpsDen: 1,
gop: 2,
profile: 'H264Baseline',
encoder: 'H.264'
}
],
targetSegmentSizeSecs: 123,
creatorId: {type: 'unverified', value: '<string>'},
c2pa: true
})
};
fetch('https://livepeer.studio/api/transcode', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://livepeer.studio/api/transcode",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'input' => [
'url' => 'https://s3.amazonaws.com/bucket/file.mp4'
],
'storage' => [
'type' => 's3',
'endpoint' => 'https://gateway.storjshare.io',
'bucket' => 'outputbucket',
'credentials' => [
'accessKeyId' => 'AKIAIOSFODNN7EXAMPLE',
'secretAccessKey' => 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
]
],
'outputs' => [
],
'profiles' => [
[
'bitrate' => 3000000,
'width' => 1280,
'name' => '720p',
'height' => 720,
'quality' => 23,
'fps' => 30,
'fpsDen' => 1,
'gop' => 2,
'profile' => 'H264Baseline',
'encoder' => 'H.264'
]
],
'targetSegmentSizeSecs' => 123,
'creatorId' => [
'type' => 'unverified',
'value' => '<string>'
],
'c2pa' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://livepeer.studio/api/transcode")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": {\n \"url\": \"https://s3.amazonaws.com/bucket/file.mp4\"\n },\n \"storage\": {\n \"type\": \"s3\",\n \"endpoint\": \"https://gateway.storjshare.io\",\n \"bucket\": \"outputbucket\",\n \"credentials\": {\n \"accessKeyId\": \"AKIAIOSFODNN7EXAMPLE\",\n \"secretAccessKey\": \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\"\n }\n },\n \"outputs\": {},\n \"profiles\": [\n {\n \"bitrate\": 3000000,\n \"width\": 1280,\n \"name\": \"720p\",\n \"height\": 720,\n \"quality\": 23,\n \"fps\": 30,\n \"fpsDen\": 1,\n \"gop\": 2,\n \"profile\": \"H264Baseline\",\n \"encoder\": \"H.264\"\n }\n ],\n \"targetSegmentSizeSecs\": 123,\n \"creatorId\": {\n \"type\": \"unverified\",\n \"value\": \"<string>\"\n },\n \"c2pa\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://livepeer.studio/api/transcode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": {\n \"url\": \"https://s3.amazonaws.com/bucket/file.mp4\"\n },\n \"storage\": {\n \"type\": \"s3\",\n \"endpoint\": \"https://gateway.storjshare.io\",\n \"bucket\": \"outputbucket\",\n \"credentials\": {\n \"accessKeyId\": \"AKIAIOSFODNN7EXAMPLE\",\n \"secretAccessKey\": \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\"\n }\n },\n \"outputs\": {},\n \"profiles\": [\n {\n \"bitrate\": 3000000,\n \"width\": 1280,\n \"name\": \"720p\",\n \"height\": 720,\n \"quality\": 23,\n \"fps\": 30,\n \"fpsDen\": 1,\n \"gop\": 2,\n \"profile\": \"H264Baseline\",\n \"encoder\": \"H.264\"\n }\n ],\n \"targetSegmentSizeSecs\": 123,\n \"creatorId\": {\n \"type\": \"unverified\",\n \"value\": \"<string>\"\n },\n \"c2pa\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"type": "upload",
"createdAt": 1587667174725,
"scheduledAt": 1587667174725,
"inputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"outputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"projectId": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"requesterId": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"params": {
"upload": {
"url": "https://cdn.livepeer.com/ABC123/filename.mp4",
"encryption": "<unknown>",
"c2pa": true,
"profiles": [
{
"bitrate": 3000000,
"width": 1280,
"name": "720p",
"height": 720,
"quality": 23,
"fps": 30,
"fpsDen": 1,
"gop": 2,
"profile": "H264Baseline",
"encoder": "H.264"
}
],
"targetSegmentSizeSecs": 6
},
"export": {
"custom": {
"url": "https://s3.amazonaws.com/my-bucket/path/filename.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LLMMB",
"method": "POST",
"headers": {}
}
},
"exportData": {
"content": {
"data": "Hello, World!"
},
"ipfs": {
"pinata": {}
},
"type": "text/plain",
"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7"
},
"transcode-file": {
"input": {
"url": "https://cdn.livepeer.com/ABC123/filename.mp4"
},
"storage": {
"url": "s3+https://accessKeyId:secretAccessKey@s3Endpoint/bucket"
},
"outputs": {
"hls": {
"path": "/samplevideo/hls"
},
"mp4": {
"path": "/samplevideo/mp4"
}
},
"profiles": [
{
"bitrate": 3000000,
"width": 1280,
"name": "720p",
"height": 720,
"quality": 23,
"fps": 30,
"fpsDen": 1,
"gop": 2,
"profile": "H264Baseline",
"encoder": "H.264"
}
],
"targetSegmentSizeSecs": 10,
"creatorId": {
"type": "unverified",
"value": "<string>"
},
"c2pa": false
},
"clip": {
"url": "https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4",
"clipStrategy": {
"startTime": "<unknown>",
"endTime": "<unknown>",
"playbackId": "<unknown>"
},
"catalystPipelineStrategy": "catalyst_ffmpeg",
"sessionId": "d32ae9e6-c459-4931-9898-e86e2f5e7e16",
"inputId": "09F8B46C-61A0-4254-9875-F71F4C605BC7"
}
},
"status": {
"phase": "pending",
"updatedAt": 1587667174725,
"progress": 0.5,
"errorMessage": "Failed to upload file",
"retries": 3
},
"output": {
"upload": {
"assetSpec": {
"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"source": {
"type": "url",
"url": "<string>",
"gatewayUrl": "<string>",
"encryption": "<unknown>"
},
"name": "filename.mp4",
"type": "video",
"playbackId": "eaw4nk06ts2d0mzb",
"userId": "66E2161C-7670-4D05-B71D-DA2D6979556F",
"playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8",
"downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video/download.mp4",
"playbackPolicy": {
"type": "webhook",
"webhookId": "1bde4o2i6xycudoy",
"webhookContext": {
"streamerId": "my-custom-id"
},
"refreshInterval": 600,
"allowedOrigins": [
"<string>"
]
},
"creatorId": {
"type": "unverified",
"value": "user123"
},
"profiles": [
{
"bitrate": 3000000,
"width": 1280,
"name": "720p",
"height": 720,
"quality": 23,
"fps": 30,
"fpsDen": 1,
"gop": 2,
"profile": "H264Baseline",
"encoder": "H.264"
}
],
"storage": {
"ipfs": {
"spec": {},
"nftMetadata": {
"cid": "<string>",
"url": "<string>",
"gatewayUrl": "<string>"
},
"updatedAt": 1587667174725
},
"status": {
"phase": "ready",
"tasks": {
"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"last": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"
},
"progress": 0.5,
"errorMessage": "Failed to update storage"
}
},
"status": {
"updatedAt": 1587667174725,
"progress": 123,
"errorMessage": "<string>"
},
"projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9",
"createdAt": 1587667174725,
"createdByTokenName": "<string>",
"size": 84934509,
"hash": [
{
"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57",
"algorithm": "sha256"
}
],
"videoSpec": {
"format": "mp4",
"duration": 23.8328,
"bitrate": 1000000,
"tracks": [
{
"type": "video",
"codec": "aac",
"startTime": 23.8238,
"duration": 23.8238,
"bitrate": 1000000,
"width": 1920,
"height": 1080,
"pixelFormat": "yuv420p",
"fps": 30,
"channels": 2,
"sampleRate": 44100,
"bitDepth": 16
}
]
}
}
},
"export": {
"ipfs": {
"videoFileCid": "Qmabc123xyz341",
"videoFileUrl": "ipfs://Qmabc123xyz341",
"videoFileGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341",
"nftMetadataCid": "Qmabc123xyz341",
"nftMetadataUrl": "ipfs://Qmabc123xyz341",
"nftMetadataGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341"
}
},
"exportData": {
"ipfs": {
"cid": "Qmabc123xyz341"
}
}
}
}{
"errors": [
[
"id not provided",
"Account not found"
]
]
}Create Transcode Job
Livepeer Studio API endpoint
import { Livepeer } from "livepeer";
import {
TranscodePayloadSchemasStorageType,
TranscodeProfileEncoder,
TranscodeProfileProfile,
} from "livepeer/models/components";
const livepeer = new Livepeer({
apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await livepeer.transcode.create({
input: {
url: "https://s3.amazonaws.com/bucket/file.mp4",
},
storage: {
type: TranscodePayloadSchemasStorageType.Web3Storage,
credentials: {
proof: "EaJlcm9vdHOAZ3ZlcnNpb24BmgIBcRIg2uxHpcPYSWNtifMKFkPC7IEDvFDCxCd3ADViv0coV7SnYXNYRO2hA0AnblHEW38s3lSlcwaDjPn",
},
},
outputs: {
hls: {
path: "/samplevideo/hls",
},
mp4: {
path: "/samplevideo/mp4",
},
fmp4: {
path: "/samplevideo/fmp4",
},
},
profiles: [
{
width: 1280,
name: "720p",
height: 720,
bitrate: 3000000,
quality: 23,
fps: 30,
fpsDen: 1,
gop: "2",
profile: TranscodeProfileProfile.H264Baseline,
encoder: TranscodeProfileEncoder.H264,
},
],
});
// Handle the result
console.log(result);
}
run();package main
import(
livepeergo "github.com/livepeer/livepeer-go"
"context"
"github.com/livepeer/livepeer-go/models/components"
"log"
)
func main() {
s := livepeergo.New(
livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Transcode.Create(ctx, components.TranscodePayload{
Input: components.CreateInputInput1(
components.Input1{
URL: "https://s3.amazonaws.com/bucket/file.mp4",
},
),
Storage: components.CreateTranscodePayloadStorageStorage1(
components.Storage1{
Type: components.StorageTypeS3,
Endpoint: "https://gateway.storjshare.io",
Bucket: "outputbucket",
Credentials: components.StorageCredentials{
AccessKeyID: "AKIAIOSFODNN7EXAMPLE",
SecretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
},
},
),
Outputs: components.Outputs{
Hls: &components.Hls{
Path: "/samplevideo/hls",
},
Mp4: &components.Mp4{
Path: "/samplevideo/mp4",
},
Fmp4: &components.Fmp4{
Path: "/samplevideo/fmp4",
},
},
Profiles: []components.TranscodeProfile{
components.TranscodeProfile{
Width: livepeergo.Int64(1280),
Name: livepeergo.String("720p"),
Height: livepeergo.Int64(720),
Bitrate: 3000000,
Quality: livepeergo.Int64(23),
Fps: livepeergo.Int64(30),
FpsDen: livepeergo.Int64(1),
Gop: livepeergo.String("2"),
Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(),
Encoder: components.TranscodeProfileEncoderH264.ToPointer(),
},
},
})
if err != nil {
log.Fatal(err)
}
if res.Task != nil {
// handle response
}
}from livepeer import Livepeer
from livepeer.models import components
s = Livepeer(
api_key="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.transcode.create(request={
"input": {
"url": "https://s3.amazonaws.com/bucket/file.mp4",
},
"storage": {
"type": components.StorageType.S3,
"endpoint": "https://gateway.storjshare.io",
"bucket": "outputbucket",
"credentials": {
"access_key_id": "AKIAIOSFODNN7EXAMPLE",
"secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
},
},
"outputs": {
"hls": {
"path": "/samplevideo/hls",
},
"mp4": {
"path": "/samplevideo/mp4",
},
"fmp4": {
"path": "/samplevideo/fmp4",
},
},
"profiles": [
{
"width": 1280,
"name": "720p",
"height": 720,
"bitrate": 3000000,
"quality": 23,
"fps": 30,
"fps_den": 1,
"gop": "2",
"profile": components.TranscodeProfileProfile.H264_BASELINE,
"encoder": components.TranscodeProfileEncoder.H_264,
},
],
})
if res.task is not None:
# handle response
passcurl --request POST \
--url https://livepeer.studio/api/transcode \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": {
"url": "https://s3.amazonaws.com/bucket/file.mp4"
},
"storage": {
"type": "s3",
"endpoint": "https://gateway.storjshare.io",
"bucket": "outputbucket",
"credentials": {
"accessKeyId": "AKIAIOSFODNN7EXAMPLE",
"secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}
},
"outputs": {},
"profiles": [
{
"bitrate": 3000000,
"width": 1280,
"name": "720p",
"height": 720,
"quality": 23,
"fps": 30,
"fpsDen": 1,
"gop": 2,
"profile": "H264Baseline",
"encoder": "H.264"
}
],
"targetSegmentSizeSecs": 123,
"creatorId": {
"type": "unverified",
"value": "<string>"
},
"c2pa": true
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: {url: 'https://s3.amazonaws.com/bucket/file.mp4'},
storage: {
type: 's3',
endpoint: 'https://gateway.storjshare.io',
bucket: 'outputbucket',
credentials: {
accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
}
},
outputs: {},
profiles: [
{
bitrate: 3000000,
width: 1280,
name: '720p',
height: 720,
quality: 23,
fps: 30,
fpsDen: 1,
gop: 2,
profile: 'H264Baseline',
encoder: 'H.264'
}
],
targetSegmentSizeSecs: 123,
creatorId: {type: 'unverified', value: '<string>'},
c2pa: true
})
};
fetch('https://livepeer.studio/api/transcode', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://livepeer.studio/api/transcode",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'input' => [
'url' => 'https://s3.amazonaws.com/bucket/file.mp4'
],
'storage' => [
'type' => 's3',
'endpoint' => 'https://gateway.storjshare.io',
'bucket' => 'outputbucket',
'credentials' => [
'accessKeyId' => 'AKIAIOSFODNN7EXAMPLE',
'secretAccessKey' => 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
]
],
'outputs' => [
],
'profiles' => [
[
'bitrate' => 3000000,
'width' => 1280,
'name' => '720p',
'height' => 720,
'quality' => 23,
'fps' => 30,
'fpsDen' => 1,
'gop' => 2,
'profile' => 'H264Baseline',
'encoder' => 'H.264'
]
],
'targetSegmentSizeSecs' => 123,
'creatorId' => [
'type' => 'unverified',
'value' => '<string>'
],
'c2pa' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://livepeer.studio/api/transcode")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": {\n \"url\": \"https://s3.amazonaws.com/bucket/file.mp4\"\n },\n \"storage\": {\n \"type\": \"s3\",\n \"endpoint\": \"https://gateway.storjshare.io\",\n \"bucket\": \"outputbucket\",\n \"credentials\": {\n \"accessKeyId\": \"AKIAIOSFODNN7EXAMPLE\",\n \"secretAccessKey\": \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\"\n }\n },\n \"outputs\": {},\n \"profiles\": [\n {\n \"bitrate\": 3000000,\n \"width\": 1280,\n \"name\": \"720p\",\n \"height\": 720,\n \"quality\": 23,\n \"fps\": 30,\n \"fpsDen\": 1,\n \"gop\": 2,\n \"profile\": \"H264Baseline\",\n \"encoder\": \"H.264\"\n }\n ],\n \"targetSegmentSizeSecs\": 123,\n \"creatorId\": {\n \"type\": \"unverified\",\n \"value\": \"<string>\"\n },\n \"c2pa\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://livepeer.studio/api/transcode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": {\n \"url\": \"https://s3.amazonaws.com/bucket/file.mp4\"\n },\n \"storage\": {\n \"type\": \"s3\",\n \"endpoint\": \"https://gateway.storjshare.io\",\n \"bucket\": \"outputbucket\",\n \"credentials\": {\n \"accessKeyId\": \"AKIAIOSFODNN7EXAMPLE\",\n \"secretAccessKey\": \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\"\n }\n },\n \"outputs\": {},\n \"profiles\": [\n {\n \"bitrate\": 3000000,\n \"width\": 1280,\n \"name\": \"720p\",\n \"height\": 720,\n \"quality\": 23,\n \"fps\": 30,\n \"fpsDen\": 1,\n \"gop\": 2,\n \"profile\": \"H264Baseline\",\n \"encoder\": \"H.264\"\n }\n ],\n \"targetSegmentSizeSecs\": 123,\n \"creatorId\": {\n \"type\": \"unverified\",\n \"value\": \"<string>\"\n },\n \"c2pa\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"type": "upload",
"createdAt": 1587667174725,
"scheduledAt": 1587667174725,
"inputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"outputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"projectId": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"requesterId": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"params": {
"upload": {
"url": "https://cdn.livepeer.com/ABC123/filename.mp4",
"encryption": "<unknown>",
"c2pa": true,
"profiles": [
{
"bitrate": 3000000,
"width": 1280,
"name": "720p",
"height": 720,
"quality": 23,
"fps": 30,
"fpsDen": 1,
"gop": 2,
"profile": "H264Baseline",
"encoder": "H.264"
}
],
"targetSegmentSizeSecs": 6
},
"export": {
"custom": {
"url": "https://s3.amazonaws.com/my-bucket/path/filename.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LLMMB",
"method": "POST",
"headers": {}
}
},
"exportData": {
"content": {
"data": "Hello, World!"
},
"ipfs": {
"pinata": {}
},
"type": "text/plain",
"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7"
},
"transcode-file": {
"input": {
"url": "https://cdn.livepeer.com/ABC123/filename.mp4"
},
"storage": {
"url": "s3+https://accessKeyId:secretAccessKey@s3Endpoint/bucket"
},
"outputs": {
"hls": {
"path": "/samplevideo/hls"
},
"mp4": {
"path": "/samplevideo/mp4"
}
},
"profiles": [
{
"bitrate": 3000000,
"width": 1280,
"name": "720p",
"height": 720,
"quality": 23,
"fps": 30,
"fpsDen": 1,
"gop": 2,
"profile": "H264Baseline",
"encoder": "H.264"
}
],
"targetSegmentSizeSecs": 10,
"creatorId": {
"type": "unverified",
"value": "<string>"
},
"c2pa": false
},
"clip": {
"url": "https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4",
"clipStrategy": {
"startTime": "<unknown>",
"endTime": "<unknown>",
"playbackId": "<unknown>"
},
"catalystPipelineStrategy": "catalyst_ffmpeg",
"sessionId": "d32ae9e6-c459-4931-9898-e86e2f5e7e16",
"inputId": "09F8B46C-61A0-4254-9875-F71F4C605BC7"
}
},
"status": {
"phase": "pending",
"updatedAt": 1587667174725,
"progress": 0.5,
"errorMessage": "Failed to upload file",
"retries": 3
},
"output": {
"upload": {
"assetSpec": {
"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"source": {
"type": "url",
"url": "<string>",
"gatewayUrl": "<string>",
"encryption": "<unknown>"
},
"name": "filename.mp4",
"type": "video",
"playbackId": "eaw4nk06ts2d0mzb",
"userId": "66E2161C-7670-4D05-B71D-DA2D6979556F",
"playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8",
"downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video/download.mp4",
"playbackPolicy": {
"type": "webhook",
"webhookId": "1bde4o2i6xycudoy",
"webhookContext": {
"streamerId": "my-custom-id"
},
"refreshInterval": 600,
"allowedOrigins": [
"<string>"
]
},
"creatorId": {
"type": "unverified",
"value": "user123"
},
"profiles": [
{
"bitrate": 3000000,
"width": 1280,
"name": "720p",
"height": 720,
"quality": 23,
"fps": 30,
"fpsDen": 1,
"gop": 2,
"profile": "H264Baseline",
"encoder": "H.264"
}
],
"storage": {
"ipfs": {
"spec": {},
"nftMetadata": {
"cid": "<string>",
"url": "<string>",
"gatewayUrl": "<string>"
},
"updatedAt": 1587667174725
},
"status": {
"phase": "ready",
"tasks": {
"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"last": "09F8B46C-61A0-4254-9875-F71F4C605BC7",
"failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"
},
"progress": 0.5,
"errorMessage": "Failed to update storage"
}
},
"status": {
"updatedAt": 1587667174725,
"progress": 123,
"errorMessage": "<string>"
},
"projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9",
"createdAt": 1587667174725,
"createdByTokenName": "<string>",
"size": 84934509,
"hash": [
{
"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57",
"algorithm": "sha256"
}
],
"videoSpec": {
"format": "mp4",
"duration": 23.8328,
"bitrate": 1000000,
"tracks": [
{
"type": "video",
"codec": "aac",
"startTime": 23.8238,
"duration": 23.8238,
"bitrate": 1000000,
"width": 1920,
"height": 1080,
"pixelFormat": "yuv420p",
"fps": 30,
"channels": 2,
"sampleRate": 44100,
"bitDepth": 16
}
]
}
}
},
"export": {
"ipfs": {
"videoFileCid": "Qmabc123xyz341",
"videoFileUrl": "ipfs://Qmabc123xyz341",
"videoFileGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341",
"nftMetadataCid": "Qmabc123xyz341",
"nftMetadataUrl": "ipfs://Qmabc123xyz341",
"nftMetadataGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341"
}
},
"exportData": {
"ipfs": {
"cid": "Qmabc123xyz341"
}
}
}
}{
"errors": [
[
"id not provided",
"Account not found"
]
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
URL input video
- Option 1
- Option 2
Show child attributes
Show child attributes
Storage for the output files
- Option 1
- Option 2
Show child attributes
Show child attributes
Output formats
Show child attributes
Show child attributes
Show child attributes
Show child attributes
How many seconds the duration of each output segment should be
Show child attributes
Show child attributes
Decides if the output video should include C2PA signature
Response
Success
Task ID
"09F8B46C-61A0-4254-9875-F71F4C605BC7"
Type of the task
upload, export, export-data, transcode-file, clip "upload"
Timestamp (in milliseconds) at which task was created
1587667174725
Timestamp (in milliseconds) at which the task was scheduled for execution (e.g. after file upload finished).
1587667174725
ID of the input asset
"09F8B46C-61A0-4254-9875-F71F4C605BC7"
ID of the output asset
"09F8B46C-61A0-4254-9875-F71F4C605BC7"
ID of the project
"09F8B46C-61A0-4254-9875-F71F4C605BC7"
ID of the requester hash(IP + SALT + PlaybackId)
"09F8B46C-61A0-4254-9875-F71F4C605BC7"
Parameters of the task
Show child attributes
Show child attributes
Status of the task
Show child attributes
Show child attributes
Output of the task
Show child attributes
Show child attributes
Was this page helpful?