The EncodedVideo resource lets you get information about an encoded video, get complete specs, generate thumbnails. The encoded video is created when a job is done successfully.
GET /encoded_video.(xml|json)
With the cURL command:
curl -u username:passwd https://heywatch.com/encoded_video.json
[
{
"created_at": "2011-02-10T11:52:24+01:00",
"title": "vid_77838372",
"specs": {
"audio": {
"sample_rate": 22050,
"synched": true,
"stream": 0.1,
"codec": "mp3",
"bitrate": 64,
"channels": 0
},
"size": 341,
"format_name": "Flash video",
"thumb": "http://94.23.63.190/d83ce838ad559086194f106cfc7bee2d/vid_77838372.flv.jpg",
"mime_type": "video/x-flv",
"format_id": "31",
"video": {
"stream": 0.0,
"codec": "flv",
"container": "flv",
"aspect": 1.33,
"bitrate": 536,
"height": 240,
"length": 5,
"fps": 0.0,
"width": 320
}
},
"updated_at": "2011-02-10T11:52:24+01:00",
"id": 7873875,
"filename": "vid_77838372.flv",
"link": "http://heywatch.com/encoded_video/7873875.bin",
"job_id": 4022573
}
]
GET /encoded_video/ID.(xml|json)
With the cURL command:
curl -u username:passwd https://heywatch.com/encoded_video/7873875.json
{
"created_at": "2011-02-10T11:52:24+01:00",
"title": "vid_77838372",
"specs": {
"audio": {
"sample_rate": 22050,
"synched": true,
"stream": 0.1,
"codec": "mp3",
"bitrate": 64,
"channels": 0
},
"size": 341,
"format_name": "Flash video",
"thumb": "http://94.23.63.190/d83ce838ad559086194f106cfc7bee2d/vid_77838372.flv.jpg",
"mime_type": "video/x-flv",
"format_id": "31",
"video": {
"stream": 0.0,
"codec": "flv",
"container": "flv",
"aspect": 1.33,
"bitrate": 536,
"height": 240,
"length": 5,
"fps": 0.0,
"width": 320
}
},
"updated_at": "2011-02-10T11:52:24+01:00",
"id": 7873875,
"filename": "vid_77838372.flv",
"link": "http://heywatch.com/encoded_video/7873875.bin",
"job_id": 4022573
}
DELETE /encoded_video/ID.(json|xml)
curl -i -u username:passwd -X DELETE "http://heywatch.com/encoded_video/7873875.json"
HTTP/1.1 204 No Content
Server: nginx/0.5.32
Date: Thu, 10 Feb 2011 11:04:13 GMT
Connection: close
Status: 204
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.0
X-UA-Compatible: IE=Edge,chrome=1
X-Runtime: 0.025109
Set-Cookie: _session_id=xxxxxxxxxxxxxxxxxxxxxxxxx; path=/; expires=Sat, 12-Feb-2011 11:24:38 GMT
Cache-Control: no-cache
GET /encoded_video/ID.jpg(?start=x&width=x&height=x)
If you don’t specify a parameter, you’ll be redirected to the default thumbnail location (302).
With the cURL command:
curl -i -u username:passwd http://heywatch.com/encoded_video/7873875.jpg
HTTP/1.1 302 Found
Server: nginx/0.5.32
Date: Thu, 10 Feb 2011 10:37:32 GMT
Content-Type: image/jpg; charset=utf-8
Connection: keep-alive
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 2.0.4
Cache-Control: no-cache
Set-Cookie: _session_id=xxxxxxxxxxxxxxxxxxxxxxxxxx; path=/
location: http://94.23.63.190/d83ce838ad559086194f106cfc7bee2d/vid_77838372.flv.jpg
Content-Length: 139
The following cURL command will generate a thumbnail at the 4th second with a size of 320x240.
curl -u username:passwd "http://heywatch.com/encoded_video/7873875.jpg?start=4&width=320&height=240"
# Return binary data
POST /encoded_video/ID/thumbnails.(xml|json)
It’s the way to go if you have more than one thumbnail to generate and if you need more flexibility.
You must make a POST request to http://heywatch.com/encoded_video/ID/thumbnails.xml
With the cURL command:
curl -u username:passwd -X POST \
-d "number=10" \
-d "width=320" \
-d "height=180" \
-d "s3_directive=s3://accesskey:secretkey@bucket/"
-d "ping_url=http://mysite.com/heywatch/ping/thumbnail.php" \
https://heywatch.com/encoded_video/7873875/thumbnails.json
Note:
The response is 200 OK with no response body.
GET /encoded_video/ID.bin
If you want to download the encoded video yourself, use the special extension .bin.
With the cURL command:
curl -i -u username:passwd http://heywatch.com/encoded_video/7873875.bin
HTTP/1.1 302 Found
Server: nginx/0.5.32
Date: Thu, 10 Feb 2011 10:42:25 GMT
Content-Type: application/force-download; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Status: 302
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.0
X-UA-Compatible: IE=Edge,chrome=1
Location: http://94.23.63.190/74a2c5e1f72999b1bcd2035e64b016a8/vid_77838372.flv
X-Runtime: 0.009011
Set-Cookie: _session_id=xxxxxxxxxxxxxxxxxxxxxxx; path=/; expires=Sat, 12-Feb-2011 11:02:50 GMT
Cache-Control: no-cache
Service made by Particles
Follow @particles