Sending batch jobs with RATS

From Rambla Wiki
Jump to: navigation, search

Why batch jobs?

A batch job allows you to encode a single source file into multiple formats, either by uploading your source file to a hotfolder or by sending a single RATS job request.

For example, you could use a batch job if you have a source file which needs to be encoded into both .mp4 and .webm formats and for which a snapshot needs to be taken at every 20% of the video. Depending on your client logic, it may be easier to send a single (batch) job request, instead of sending seperate requests for each of the encodings.

Batch jobs are also very useful when you want your video to be accessible via Adaptive Streaming (= bitrate switching). In addition to transcoding your source file at different bitrates and/or dimensions, RATS will also automatically create and publish the SMIL file(s) that are needed for HTTP adaptive streaming and the XML file that is needed for RTMP Adaptive Streaming (Flash). This way, you only need to retrieve your URL for adaptive streaming from the CDN report to start streaming.

Launching batch jobs

A batch job encodes your source file(s) into a number of different format(s) - including snapshots which can be taken at a given interval. The encoding formats to be used by the batch job are specified in a (default or custom) formatgroup. There are three ways to create batch encoding jobs :

  1. FTP Hotfolder. Upload the source file(s) to your auto-hotfolder. RATS will use your default formatgroup and automatically export the encoded files to the CDN. For more information on hotfolders, see this guide or contact Rambla support.
  2. HTTP Hotfolder. The srcencode and srcencode_m resources are the equivalent of a HTTP hotfolder. The batch job request will be done automatically by RATS when your source file has been uploaded.
  3. API. Launch a RATS job request with the 'formatgroup' param being set (= containing the ID of an existing formatgroup). To generate multiple snapshots, you should also set the 'snapshot_interval' param.

Batch job results

A batch job results in a number of encoded files being published on the Rambla CDN. The CDN report contains all the necessary information about the published files and how to access them.

A CDN report can be retrieved in different ways:

  • RATS can email it to you, or send it as the body of a HTTP POST request (to a given URL) (see the proc resource for more details).
  • You can send a GET request to any of the job resources that are part of the batch. Once all batch jobs have been completed (= the 'batch_status' param of the job is set to '100'), the job resource will also return the CDN report as part of its response.

Instead of a JSON report, RATS can also send you a plain email containing all publication data.

Adaptive Streaming

A formatgroup can be used to automatically create/export the SMIL and XML file(s) needed for adaptive streaming. This requires that at least two formats, which are part of your formatgroup, share the same playlist setting. For more details, see our adaptive streaming and default hotfolder guides, or contact Rambla support.

Note that the SMIM/XML file(s) are only published if these conditions are met:

  • The output profile has 'cdn' as its output method.
  • The format group contains at least 2 format profiles with the same 'playlist' setting.

If you have a formatgroup which is configured for adaptive streaming, the CDN report's 'playlists' object will contain a sub-object for each of the playlists you've configured (key = name of the playlist). Inside this sub-object are the URLs for the different kinds of adaptive streaming.