[POST] http://api.ankoder.com/download
Support 3 download methods
- HTTP from URL
- HTTP from a S3 Bucket
You need to grant READ access to “aws@ankoder.com” (Even if it is publicly readable) - FTP
Parameters
| Required | Name | Description |
|---|---|---|
| required | url | 3 methods: (note it is case-sensitive) * http://www.hostname.com/filename.wmv * s3://bucket_name/filename * ftp://username:password@hostname.com/filename.wmv |
| custom_profile | ID of the Profile that the downloaded video will be converted to automatically | |
| custom_recipe | ID of the Recipe that the downloaded video will be converted to automatically | |
| upload_url | Destination of the converted file Support S3, FTP, SFTP : s3://bucket_name ftp://username:password@ftpdomain.com/folder sftp://username:password@ftpdomain.com/folder |
|
| thumbnail_upload_url | Destination of the thumbnail Support S3, FTP, SFTP : s3://bucket_name ftp://username:password@ftpdomain.com/folder sftp://username:password@ftpdomain.com/folder |
|
| postback_url | Url where the result should be posted to e.g. http://www.ankoder.net/ankoder_notification |
|
| * | video_format |
output format. Specify format of encoded file. Allowed values: 3g2 3gp asf avi dvd flv mjpeg mov mp3 mp4 mpeg mpeg2video mpegts ogg psp rm svcd vcd vob matroska wmv |
| * | video_codec | Allowed values: flv h263 h264 huffyuv mjpeg mp4 wmv1 wmv2 xvid mpeg4 theora msmpeg4v2 |
| * | audio_codec | Allow values: aac ac3 amr flac mp3 vorbis wmav2 mpeg4aac mp2 |
| width | Video frame width Allowed values: non-zero integer |
|
| height | Video frame height Allowed values: non-zero integer |
|
| video_bitrate | video bitrate Allowed values: integer less than 10000 |
|
| video_fps | video frame rate Allowed values: non-zero integer |
|
| audio_bitrate | Audio bitrate Allowed values: non-zero integer |
|
| audio_sample_rate | Audio sampling frequency Allowed values: any non-zero integer. |
|
| audio_channel | Number of audio channel Allowed values: 1, 2 |
|
| keep_aspect | Fit video within width and height instead of stretching Allowed values: 0, 1 |
|
| add_padding | Add padding to fit the specified size Allowed values: 0, 1 |
|
| suffix | Suffix of output file | |
| trim_begin | Start encoding from (sec) Allowed values: non-negative integer. |
|
| duration | Duration (sec) Allowed values: positive integer. |
|
| bitrate_tolerance | Default value: the same as video_bitrate | |
| thumbnail_width | Thumbnail width Allowed values: non-negative integer. Default value: the width of the video |
|
| thumbnail_height | Thumbnail height Allowed values: non-negative integer. Default value: the height of the video |
|
| thumb_moments | Timestamp (in seconds) to capture thumbnail Allowed values: non-negative number greater than 0.01 |
|
| thumb_amount | Number of additional thumbnails to generate Allowed values: non-negative integer Default value: 0 |
|
| thumb_start | Period (in seconds) start point to generate additional thumbnails Allowed values: non-negative number greater than 0.01 Default value: the start of the video |
|
| thumb_end | Period (in seconds) end point to generate additional thumbnails Allowed values: non-negative number greater than 0.01 Default value: the end of the video |
|
| thumb_way | The way to generate additional thumbnails in the specified period Allowed values: even, rand Default value: none |
|
| watermark_url | The URL of the logo image. The image format can be GIF, JPG or PNG. | |
| watermark_transparent | Whether enable transparent watermark Allowed values: 0, 1 |
|
| watermark_size | The size of the watermark relative to the video Allowed values: no-negative integer less than 100 |
|
| watermark_top | top offset of watermark image Allowed values: non-negative integer |
|
| watermark_left | left offset of watermark image Allowed values: non-negative integer |
|
| segment_duration | Segment videos according to Apple’s HTTP Live Streaming Specifications, Segment duration in seconds Allowed values: integer equal or bigger than 5 |
NOTE: If either custom_profile or custom_recipe is not specified, the items marked with * are mandatory. If custom_profile is specified, additional parameters will override values in the specified profile. If custom_recipe is specified, custom_profile and additional parameters will be ignored.
HTTP/1.1 200 OK indicate that the download job is successfully created.
Success Response Example:
<video>
<id>8206</id>
<progress>0</progress>
<created_at>Tue May 13 10:31:30 +0000 2008</created_at>
</video>
Error Response Example:
<errors>
<error>Source url can't be blank</error>
</errors>
HTTP/1.1 422 Unprocessable Entity indicate that the job is failed to create
Notification Message:
When the download is completed, our system will POST a notification message in JSON format to your “notification url” – which can be set in your user settings.
| result | success or fail |
|---|---|
| error | empty or an error message |
| type | Download |
| video_name | e.g. 89db197da259f1be3d9d9cd1f28f9035bf200c5e.flv |
| video_id | e.g. 1456 |
Success Example
message={
"result":"success",
"error":"",
"video_id":"1456",
"type":"Download",
"video_name":"89db197da259f1be3d9d9cd1f28f9035bf200c5e.flv"}
&signature=NibHgyAxXotBRWjZkCztZ/jDHfc=
Failed Example
message={"result":"fail",
"error":"The downloaded file is not a supported video",
"video_id":"1456","type":"Download",
"video_name":"2247ad5b3f396da556cfb391c384404c68bf1115"}
&signature=FRnPav5RWDbVRtqUhg18uT6NoPc=
Curl Testing Example
curl -X POST --basic -user username:password -d
"url=http://www.mydomain.com/video.wmv" http://api.ankoder.com/download
