Introduction

Cloud-based video optimization offers a solution that is cost-efficient, scalable and seamlessly integrated into a video processing workflow. Naturally, I would recommend the Beamr Video Cloud service as the easiest way to get started with optimization for your videos. There is no installation or server management required.

Beamr Video Cloud service runs on Amazon Web Services (AWS) infrastructure, and is accessible via a REST API. We provide a simple interface, and handle all the heavy lifting for you.

API Overview

The Beamr Video API uses JSON over HTTP(S) and follows the standard REST design. Beamr Video users send optimization jobs to the service, and when a job is completed the service sends a notification (HTTP callback). The callback includes the URL to the optimized file, as well as statistics regarding the savings and processing costs. Users can query the API for the status of their current and past jobs at any time.

Following is a simple walkthrough of creating an optimization job and downloading the result. For simplicity I chose to use the HTTPie command line utility, however similar commands may be sent using CURL, or any REST capable utility or programming language.

Creating a New Optimization Job

To create a new optimization job, use the following command to send a POST request to the Beamr Video Cloud service.

$ http -a username:password POST https://api.beamrvideo.com/v1/jobs source=”http://example.com/movie.mp4″ quality=high

  • -a is used to pass the user credentials to the service (http digest authentication)
  • The POST verb is used, since we are creating a new job (as opposed to querying existing jobs as seen below)
  • The base-url https://api.beamrvideo.com/v1/ is where all requests are sent, and in this case, is followed by the /jobs suffix, since we are creating a new job
  • Two parameters are passed to the service in the request body:
    • source – a url to the video file which is to be optimized
    • quality – the desired quality setting (we support high and best)

The HTTPie utility is great because it automatically formats the request with the JSON payload required by Beamr Video Cloud Service and automatically sets the Content-Type header to application/json as required.

{
“source”: “http://example.com/movie.mp4”,
“quality”: “high”
}

The following JSON response from the server indicates the job has been scheduled for processing, and provides the job-id, which you will need later when querying the job result.

{
“code”: 201,
id“: “C3uxnY5j7L93rWZpir5HVN“,
“info”: {
“created”: 1443551274733,
“source”: “http://example.com/movie.mp4”,
“status”: “pending”
},
location“: “https://api.beamrvideo.com/v1/jobs/C3uxnY5j7L93rWZpir5HVN“,
“status”: “CREATED”
}

The response also includes a location for the job, which is the URL to the query for getting the job status.

Querying the Job and Retrieving the Optimized Video

The next step after the service has finished processing our job, is to retrieve the resulting optimized file. Users are sent a notification when the job status is updated, however it is also possible to query the status using the API.

Using the HTTPie utility, you can issue the following GET request:

$ http -a username:password GET https://api.beamrvideo.com/v1/jobs/C3uxnY5j7L93rWZpir5HVN

As before, the credentials are passed to the service via the -a parameter. The base-url for the API remains the same, however the requested resource is the new job-id received from the previous response. Note that the complete URL is also returned as the “location” value in the previous response, and it is best-practice to follow this value.

The server response below indicates that the jobs are completed, and provides an http accessible URL from which users can download the optimized video.

{
“code”: 200,
“job”: {
“id”: “C3uxnY5j7L93rWZpir5HVN”,
“info”: {
“created”: 1443551274733,
“optimizedVideo”: “s3://beamrvideo_results/danj-C3uxnY5j7L93rWZpir5HVN/bird_mini.mp4”,
optimizedVideoUrl“: “https://api.beamrvideo.com/v1/jobs/C3uxnY5j7L93rWZpir5HVN/optimized_video“,
“source”: “http://icvt-tech-data.s3.amazonaws.com/dan/bird.mp4”,
status“: “completed
},
“location”: “https://api.beamrvideo.com/v1/jobs/C3uxnY5j7L93rWZpir5HVN”
},
“status”: “OK”
}

Downloading the Result

Using HTTPie, the Beamr Video Cloud Service sends a final GET request, this time to the optimizedVideoUrl from the previous response. The –download flag tells it to save the file to disk (instead of printing the result to a file).

$ http -a username:password –download https://api.beamrvideo.com/v1/jobs/C3uxnY5j7L93rWZpir5HVN/optimized_video

and the result looks something like this (with the file saved to disk):

Downloading to “movie_mini.mp4”

Done.

Summary

Cloud-based video optimization, specifically when using Beamr Video Cloud Service with the REST API is the easiest and most cost efficient way to get started with video optimization. No installation is required, you pay as you go and enjoy fast turnaround and unlimited scale.

Optimization of your first videos is just a few clicks away; complete integration with your workflow is simple and straightforward with any programming or scripting language (Python, Java, C#, Bash, etc.).

To sign up for your evaluation, follow up with us at http://beamr.com/request_trial.


Share