Zencoder API PHP Thumbnails

1.2k views Asked by At

I am using the Zencoder API PHP Library (https://github.com/zencoder/zencoder-php/blob/master/README.md) and can successfully submit single jobs for conversion. However I am struggling to get the format correct for the thumbnails.

The required JSON for Zencoder is:

"output": [
{
  "thumbnails": {
    "width": 800,
    "height": 600
  }
},
{
  "video_codec": "wmv"
}
]

So when I submit the below through the PHP API I can get the video to work but cant work out the correct format for the thumbnails element:

"outputs" => array(
array(                                                                                                        
"video_codec"=> "wmv"
)
)

I suspect I am missing something simple.

1

There are 1 answers

0
Chris Warren On

Your first example will create two outputs - one for the video and one for the thumbnails. You can do all of this in a single output and save yourself some money.

"outputs": [
  {
    "thumbnails": {
      "width": 800,
      "height": 600
    },
    "video_codec": "wmv"
  }
]

You can do the same thing for your PHP request:

"outputs" => array(
  array(                                                                                                        
    "video_codec"=> "wmv"
    "thumbnails" => array(
      "width" => 800,
      "height" => 600
    )
  )
)

Hope that helps.