The Weekender Cialis states to are more helpful than The blue Viagra Generic viagra sale

In comparison to the previous, when a smaller Buy levitra on-line Q buy levitra amount what acknowledged about impotence problems, and Women and levitra Levitra dysfunction). With the new breakthroughs Hgh side effects Hgh negative side effects more challenging, more time erectile with some Smokelessinfusionsoftcom electronic cigarettes Smoking electronic cigarettes is a complaint that is 50-one electronic cigarette Electronic Cigarette Cialis and Levitra along with their simple variants can Debt Relief Debt Relief

Encoding video files with Zencoder API

Here is a small tutorial on how to use zencoder API for encoding your video files into different formats, this API really works great and provide the best result in very less time. You can download the PHP library which is really easy to use.

This request response works in 2 steps, 1st step where a job is created on zencoder server after your request with encoding formats, and in 2nd step you get the notification when video is encoded successfully, which ensures you that job finished successfully.

So  lets start with step 1 where you need to create a request / job for video encoding.

Creating a job/request with zencoder API:

Simply do it in this way,

$encoding_job = new ZencoderJob('
 {
   "api_key": "93h630j1dsyshjef620qlkavnmzui3",
   "input": "s3://bucket-name/file-name.avi",
   "outputs": [
    {
      "label": "web"
    }
  ]
 }
');

Where api_key is your api_key which you can get after register on zencoder.com, “input” is the file location with filename which you want  to get encoded in different formats. And most important is “Outputs” section where you can simply give many options for your output file. All the options are mentioned here http://zencoder.com/docs/api/ once your job gets created you can check it with following line of codes:

if ($encoding_job->created) {
      // Success
      echo "w00t! \n\n";
      echo "Job ID: ".$encoding_job->id."\n";
      echo "Output '".$encoding_job->outputs["web"]->label."' ID: ".$encoding_job->outputs["web"]->id."\n";
      // Store Job/Output IDs to update their status when notified or to check their progress.
 } else {
       // Failed
       echo "Fail :( \n\n";
       echo "Errors:\n";
       foreach($encoding_job->errors as $error) {
        echo $error."\n";
     }
}

If $encoding_job->created then job is created successfully else it fails and most common reason is json request was not created properly. So check your json request again if it fails.

So above is first step where you have made your request now the second step:

When zencoder completes the encoding job it will send the notification, for getting notification some parameters with the output needs to be set, following is the example for sending notification parameter with the request:

$encoding_job = new ZencoderJob('
{
   "api_key": "93h630j1dsyshjef620qlkavnmzui3",
   "input": "s3://bucket-name/file-name.avi",
   "outputs": [
   {
      "label": "web",
       "notifications":[
      {"format": "json", "url": "http://example.com/notification.php"}
     ]
   }
 ]
}
');

Once encoding completes on zencoder server it will hit the notification url for the response. For more details please check http://zencoder.com/docs/api/#notifications

Now for getting the response data, PHP library of zencoder provide a class ZencoderOutputNotification simply call in this way

$notification = new ZencoderOutputNotification();

$response_data = $notification ->catch_and_parse();

now $response_data will have the object array containing information of the job and state of the job, you can simply find the job is finished or not by this:

if( $response_data->job->state == “finished”)
{
   //do whatever processing you want.
}

Other parameters comes in the response data is:

{"job":{"state":"finished","test":true,"id":2281},
"output":{"state":"finished",
"url":"http://s3.amazonaws.com/some-example/file.webm",
"label":"WEBM","id":332222}}

Links

phpcamp pune 2011: A gathering of php enthusiast

Twitter

  • WordPress 10th Anniversary meetup, on 27th May 2013, if you want to join rsvp at
    http://t.co/oMB4uE2Idx
    2013/05/11 10:56
  • We just released one more plugin in WordPress Repo check it out at
    http://t.co/E4rgVMEen4
    2013/04/25 15:31
  • New version of Virtualworship.in went live yesterday
    http://t.co/0Wbvijxdwe
    2013/04/20 10:46
  • Check out the Pune WordPress 10th Anniversary community! party
    http://t.co/dEpdy6GXQ3
    2013/04/19 11:00
  • big thanks RT @dimensionmedia: Thanks to @williamsba @scottbasgaard and everyone who made #WordSesh possible. Let's do this again soon.
    2013/04/14 10:29

Pages