Encoding Jobs

Methods: POST

https://[encoder_id].pushrcdn.com/api/v2/jobs
New encoding job example
cURL
curl -d "source=https://example.com/video/example.mp4" \
     -d "format=HLS" \
     -d "resolutions=480,720,1080" \
     -d "bitrates=800,2500,4000" \
     -d "thumbnail=video" \
     -d "poster=true" \
     -d "watermark=https://example.com/logo.png,UL,auto" \
     -d "trailer=true" \
     -d "path=/video/@filename/@resolution/" \
     -d "hls_aes=true" \
     -H "Content-Type: application/json" \ 
     -H "APIKEY: 2d49e8f645d90818783c4e6c46f32ca0677dc555" \ 
     -X POST "http://[encoder_id].pushrcdn.com/jobs"
Headers
Field Type Description
APIKEY string Account API key


Parameters

All parameters are required or the encoding job will not be processed.

Field Type Options Description
source string URL, filename URL to the video or it's filename (if uploaded to the encoder).
format string HLS, mp4 The format in which the video should be encoded.Only one accepted.
resolutions integer 360, 480, 576, 720, 1080 List of resolutions that should be encoded.
bitrates integer 300-10000 Bitrates in Kbps. Order matches the resolutions order above.
thumbnail string video, image, none 5x1 second random scenes stiched together, or a still image.
poster string true, false Creates an image from a random frame of the video.
trailer string true, false Creates a 1 minute version of the video, starting at 00:00.


Watermarking

Watermarking allows you to overlay and image that will be burnt in the encoded renditions of the video.

  • URL - The URL to a PNG or JPG image to be used for the overlay

  • Position - UL (upper left), UR (upper right), BL (bottom left), BR (bottom right), CENTER

  • Width - Integer, the width of the watermark in pixels. When left to auto it defaults to 75px

  • Alpha - Integer, the opacity of the watermark. 0 = transperant, 100 = no transperancy. Auto defaults to 75.
Field Type Options Description
watermark string URL, position, width, opacity URL to a JPG or PNG image, position on screen and width in pixels


Path

You can manipulate the path in your CDN storage in which you'd like the encoded renditions to be uploaded by the encoder. @filename and @resolution variables contain the name of the video (without the file type suffix) and the resolution ending in"p" (for example : 480p).

In the job example at the top of this page, we are encoding a video named example.mp4 in HLS format with 480p, 720p and 1080p renditions.The path=/video/@filename/@resolution/ would then translate to the following structure to be created in your CDN storage:

/video/example/480p/ (with 480p playlist and all 480p video fragments in the same directory)

/video/example/720p/ (with 480p playlist and all 720p video fragments in the same directory)

/video/example/1080p/ (with 480p playlist and all 1080p video fragments in the same directory)

/video/example/playlist.m3u8 (the master playlist pointing to the different resolutions playlists)

The link to playing the video would then be http://your_cdn_url/video/example/playlist.m3u8

Field Type Options Description
path string directory, @filename, @resolution Path where the video renditions will be saved

You can leave the Path parameter empty. The default directory structure explained above will then be used automatically for all encoded videos. If you are encoding to mp4 instead of HLS, the renditions will be all placed in the /video/example/ directory and will contain the resolution in their file names: example-480p.mp4, example-720p.mp4 and example-1080p.mp4


HLS AES

The hls_aes parameter currently does nothing. Please read below.

When set to true, this parameter instructs the encoder to generate a unique AES-128 ecncryption key which is then used to encrypt all fragments of the HLS renditions. The key should be protected by PUSHR CDN's secure token feature so that it can be obtained only by authorized users. At present HLS encryption disables the path parameter and requires the default path to be used. The secure token functionality is also being altered and the token generation code has to be altered to acommodate the changes. Please open a ticket from your dashboard and we will provide further details and the production-ready token generation code to be used.

Response

HTTP Code JSON Description
200 {"status":"success"} Encoding job accepted and will begin processing shortly
520 {"status":"error"} URL unreachable or specified filename not uploaded to transcoder yet
401 {"status":"error"} Wrong API key or no API key provided

When HTTP 520 error code is returned the encoder will retry every 15 minutes for a total of 4 retries (1 hour). If the URL becomes reachable or the file is uploaded to the encoder before the last check has passed, the video will be processed normally.