Video Conversion ( API

The API allows you to automate a high volume workflow by integrating a fast and scalable media processing platform into your, CMS, MAM, or application. Our XML or JSON API is the most mature, well documented and feature rich cloud encoding API on the market. Our API Builder will help generate properly format, and test your JSON or XML requests before writing a single line of code.

Here is how is works:

Your application sends either the AddMedia or AddMediaBenchmark API request to which includes:

  • The source location of your video.
  • Job notification location (http or email)
  • One or multiple custom or preset desired encoding recipes.
  • One or multiple┬ádelivery points for your video. responds immediately with a media ID so your application can track the progress of the job.

With the fastest SLA backed queue times in the industry, processes all of your jobs in parallel on dedicated multi core servers. Chose from three processing speed level, Baseline (4 core), Turbo (8 core), Twin Turbo (16 core). Our platform scales and assigns compute in realtime based on your needs so if you sent us 1 jobs with 1 output, it would process just as fast as if you sent us 250 jobs each with 10 outputs.

You can read all other details here:

Reference OF API:

So Here I am writing a complete PHP example to use services::

define(MY_ID, '479dfdsf39');
function sendRequest($xml)
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, "");
	curl_setopt($ch, CURLOPT_POSTFIELDS, "xml=" . urlencode($xml));
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	return curl_exec($ch);

// Begin processing User's POST

	 /* examples of POST
		/* basic configuration */
		$req = new SimpleXMLElement('&lt;?xml version="1.0"?-->');
		$req->addChild('userid', MY_ID);
                $req->addChild('userkey', MY_KEY);
		$req->addChild('action', 'AddMedia');
		$req->addChild('source', 'sftp://user:pass@host/var/www/html/test/video/wp-content/uploads/2013/12/pp.mp4');
                $req->addChild('Notify', ''); //set email for notifying
                /* conversion format configuration */
		$formatNode = $req->addChild('format');

               /* giving destination for converted video */
                $formatNode->addChild('destination', 'sftp://user:pass@host/var/www/html/test/video/wp-content/uploads/2013/12/pp2.flv'); //destination can be your ftp server or amazon bucket or rackspace server (for more details of destination you can check reference site)
                // generating thumb 
                $formatNode->addChild('time','2'); //capture thumb in 2nd second of video
               // $formatNode->addChild('height','100');
                $formatNode->addChild('destination', 'sftp://user:pass@host/var/www/html/test/video/wp-content/uploads/2013/12/ppthumb.jpg');
		// Sending API request (for uploading video)
		$res = sendRequest($req->asXML()); //video will be uploaded in servers and after conversion will put video in given destination
		// Creating new object from response XML
	           $response = new SimpleXMLElement($res);
                 //getting all media list from processing server

                $req2 = new SimpleXMLElement('<!--?xml version="1.0"?-->');
		$req2->addChild('userid', MY_ID);
		$req2->addChild('userkey', MY_KEY);
                $req2->addChild('action', 'GetMediaList'); //get all the media submitted for user
                $req2->addChild('action', 'getstatus'); //for getting complete info of a media
                $req2->addChild('extended', 'yes'); //for getting additional info
                $res2 = sendRequest($req2->asXML());
                $response = new SimpleXMLElement($res2);
                print_r($response); //will print all media that were sent to

                //getting media info of single media that was uploaded

                $req2 = new SimpleXMLElement('<!--?xml version="1.0"?-->');
		$req2->addChild('userid', MY_ID);
		$req2->addChild('userkey', MY_KEY);
                $req2->addChild('action', 'getstatus');
                $req2->addChild('mediaid', '40982345');  //(we can get this id by $req2->addChild('action', 'GetMediaList'))
                $req2->addChild('extended', 'yes'); //getting info in deep (gives processing status also)
                $res2 = sendRequest($req2->asXML());                
                $response = new SimpleXMLElement($res2);
		 //getting media info of a media that was ends here
                 // handling response
			$error = $response->errors[0]->error[0] . '';
		elseif ($response->message[0]) 
		// If message received, set OK message
			$message = $response->message[0] . '';
		} //try closed
		catch(Exception $e)
		// If wrong XML response received
			$error = $e->getMessage();
                // Displaying error if any
		if (!empty($error)) 
			echo '<div class="error">' . htmlspecialchars($error) . '</div>';
		// Displaying message
		if (!empty($message)) 
			echo '<div class="message">' . htmlspecialchars($message) . '</div>';

Calling the fuction can be done by form(Just an example)

<form action="" enctype="multipart/form-data" method="post">
<input name="source" type="file" /> 
<input name="submitBtn" type="submit" />