AWS 上有一项名为 Elastic Transcoder 的新服务。我知道一些 PHP,但我咬的比我能咀嚼的还要多……
我将如何创建一个简单的 PHP 函数,它将获取我的变量并创建一个 JSON 请求(当然格式正确)并在 AWS 上创建一个作业。以下是 AWS 提供的语法:
注意:我已经创建了一个能够提供所有必填字段的表单。
To create a job, send a POST request to the
/2012-09-25/jobs
resource.
这是语法:
POST /2012-09-25/jobs HTTP/1.1
Content-Type: application/json; charset=UTF-8
Accept: */*
Host: elastictranscoder.Elastic Transcoder endpoint.amazonaws.com:443
x-amz-date: Mon, 14 Jan 2013 17:49:52 GMT
Authorization: AWS4-HMAC-SHA256
Credential=AccessKeyID/request-date/Elastic Transcoder endpoint/ets/aws4_request,
SignedHeaders=host;x-amz-date;x-amz-target,
Signature=calculated-signature
Content-Length: number of characters in the JSON string
{
"Input":{
"Key":"name of the file to transcode",
"FrameRate":"auto"|"10"|"15"|"23.97"|"24"|"25"|"29.97"|"30"|"60",
"Resolution":"auto"|"width in pixelsxheight in pixels",
"AspectRatio":"auto"|"1:1"|"4:3"|"3:2"|"16:9",
"Interlaced":"auto"|"true"|"false",
"Container":"auto"|"3gp"|"asf"|"avi"|"divx"|"flv"|"mkv"|"mov"|"mp4"|
"mpeg"|"mpeg-ps"|"mpeg-ts"|"mxf"|"ogg"|"vob"|"wav"|"webm"
},
"Output":{
"Key":"name of the transcoded file",
"ThumbnailPattern":""|"pattern",
"Rotate":"auto"|"0"|"90"|"180"|"270",
"PresetId":"preset to use for the job"
},
"PipelineId":"pipeline to add the job to"
}
需要提供的上述代码部分在语法的原始发布中以斜体显示: