節省成本並獲得更多功能 AWS Elemental MediaConvert
MediaConvert 是一項較新的檔案型視訊轉碼服務,提供全方位的進階轉碼功能,按需費率從每分鐘 $0.0075 起。閱讀更多
已經使用 Amazon Elastic Transcoder? 遷移到 MediaConvert. 如需詳細資訊,請參閱此概觀
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
建立任務
Description (描述)
欲建立任務,請將 POST 請求傳送到 /2012-09-25/jobs
資源。任務在您建立後就會立刻開始。
注意
您可將 Elastic Transcoder 配置為在任務狀態變更時通知您,包括 Elastic Transcoder Conversion 的開始與結束處理任務時,以及 Elastic Transcoder 遭遇警告或錯誤情況時。如需詳細資訊,請參閱 建立管道。
請求
Syntax (語法)
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: 20130114T174952Z Authorization: AWS4-HMAC-SHA256 Credential=AccessKeyID
/request-date
/Elastic Transcoder endpoint
/elastictranscoder/aws4_request, SignedHeaders=host;x-amz-date;x-amz-target, Signature=calculated-signature
Content-Length:number of characters in the JSON string
{ "Inputs":[{ "Key":"name of the file to transcode
", "Encryption":{ "Mode":"aes-cbc-pkcs7|aes-ctr|aes-gcm", "Key":"encrypted and base64-encoded decryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" }, "TimeSpan":{ "StartTime":"starting place of the clip, in HH:mm:ss.SSS or sssss.SSS
", "Duration":"duration of the clip, in HH:mm:ss.SSS or sssss.SSS
" }, "FrameRate":"auto|10|15|23.97|24|25|29.97|30|50|60", "Resolution":"auto", "AspectRatio":"auto|1:1|4:3|3:2|16:9", "Interlaced":"auto|true|false", "Container":"auto|aac|asf|avi|divx|flv|m4a|mkv|mov|mp2|mp3| mp4|mpeg|mpeg-ps|mpeg-ts|mxf|ogg|vob|wav|webm", "InputCaptions":{ "MergePolicy":"MergeOverride|MergeRetain|Override", "CaptionSources":[ { "Key":"name of the input caption file
", "Encryption":{ "Mode":"aes-cbc-pkcs7|aes-ctr|aes-gcm", "Key":"encrypted and base64-encoded encryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" }, "Language":"language of the input caption file
", "TimeOffset":"starting place of the captions, in either [-+]SS.sss or [-+]HH:mm:SS.ss
", "Label":"label for the caption
" }, {...} ] } }, {...} ] "OutputKeyPrefix":"prefix for file names in Amazon S3 bucket
", "Outputs":[{ "Key":"name of the transcoded file
", "Encryption":{ "Mode":"s3||aes-cbc-pkcs7|aes-ctr| aes-gcm", "Key":"encrypted and base64-encoded encryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" }, "ThumbnailPattern":""|"pattern
", "Rotate":"auto|0|90|180|270", "PresetId":"preset to use for the job
", "SegmentDuration":"[1,60]", "Watermarks":[ { "InputKey":"name of the .png or .jpg file
", "Encryption":{ "Mode":"s3||aes-cbc-pkcs7| aes-ctr|aes-gcm", "Key":"encrypted and base64-encoded encryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" }, "PresetWatermarkId":"value of Video:Watermarks:Id in preset
" }, {...} ], "AlbumArt":[ { "AlbumArtMerge":"Replace|Prepend|Append|Fallback", "AlbumArtArtwork":"can be empty, but not null
":[ { "AlbumArtInputKey":"name of the file to use as album art
", "Encryption":{ "Mode":"s3||aes-cbc-pkcs7| aes-ctr|aes-gcm", "Key":"encrypted and base64-encoded encryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" }, "AlbumArtMaxWidth":"maximum width of output album art in pixels
", "AlbumArtMaxHeight":"maximum height of output album art in pixels
", "AlbumArtSizingPolicy":"Fit|Fill|Stretch|Keep| ShrinkToFit|ShrinkToFill", "AlbumArtPaddingPolicy":"Pad|NoPad", "AlbumArtFormat":"jpg|png" }, {...} ] }, {...} ], "Captions":{ "CaptionFormats":[ { "Format":"cea-708|dfxp|mov-text|scc|srt|webvtt", "Pattern":"myCaption/file-language
", "Encryption":{ "Mode":"s3||aes-cbc-pkcs7| aes-ctr|aes-gcm", "Key":"encrypted and base64-encoded encryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" } }, {...} ] } }, {...}], "Playlists":[{ "Format":"HLSv3|HLSv4|MPEG-DASH|Smooth", "Name":"name
", "OutputKeys":[ "Outputs:Key to include in this playlist
", ... ], "HlsContentProtection":{ "Method":"aes-128", "Key":"encrypted and base64-encoded protection key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
", "LicenseAcquisitionUrl":"license acquisition url
", "KeyStoragePolicy":"NoStore|WithVariantPlaylists" }, "PlayReadyDrm":{ "Format":"microsoft|discretix-3.0", "Key":"encrypted and base64-encoded DRM key
", "KeyId":"id of the DRM key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
", "LicenseAcquisitionUrl":"license acquisition url
" } }, {...}], "UserMetadata": { "Key":"Value", "Second user metadata key
":"Second user metadata value
" }, "PipelineId":"pipeline to use for transcoding
" }
請求參數
此操作不使用請求參數。
請求標頭
此操作僅使用所有操作常見的請求標頭。如需常見請求標頭的資訊,請參閱 HTTP 標頭內容。
請求主體
請求本文的 JSON 字串包含 CreateJob
操作的輸入物件。如需輸入物件的詳細資訊,請參閱您在建立 Elastic Transcoder Job 時指定的設定。
回應
Syntax (語法)
Status: 201 Created x-amzn-RequestId: c321ec43-378e-11e2-8e4c-4d5b971203e9 Content-Type: application/json Content-Length:
number of characters in the response
Date: Mon, 14 Jan 2013 06:01:47 GMT { "Job":{ "Id":"Id that Elastic Transcoder assigns to the job
", "Inputs":[{ "Key":"name of the file to transcode
", "Encryption":{ "Mode":"aes-cbc-pkcs7|aes-ctr|aes-gcm", "Key":"encrypted and base64-encoded decryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" }, "TimeSpan":{ "StartTime":"starting place of the clip, in HH:mm:ss.SSS or sssss.SSS
", "Duration":"duration of the clip, in HH:mm:ss.SSS or sssss.SSS
" }, "FrameRate":"auto|10|15|23.97|24|25|29.97|30|50|60", "Resolution":"auto|width in pixels
xheight in pixels
", "AspectRatio":"auto|1:1|4:3|3:2|16:9", "Interlaced":"auto|true|false", "Container":"auto|aac|asf|avi|divx|flv|m4a|mkv|mov|mp2|mp3| mp4|mpeg|mpeg-ps|mpeg-ts|mxf|ogg|vob|wav|webm", "InputCaptions":{ "MergePolicy":"MergeOverride|MergeRetain|Override", "CaptionSources":[ { "Key":"name of the input caption file
", "Language":"language of the input caption file
", "TimeOffset":"starting place of the captions, in either [-+]SS.sss or [-+]HH:mm:SS.ss
", "Label":"label for the caption
" "Encryption":{ "Mode":"aes-cbc-pkcs7|aes-ctr|aes-gcm", "Key":"encrypted and base64-encoded decryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" }, }, {...} ] } }, {...}], "OutputKeyPrefix":"prefix for file names in Amazon S3 bucket
", "Outputs":[{ "Id":"sequential counter
", "Key":"name of the transcoded file
", "Encryption":{ "Mode":"s3||aes-cbc-pkcs7|aes-ctr| aes-gcm", "Key":"encrypted and base64-encoded encryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" }, "ThumbnailPattern":""|"pattern
", "Rotate":"auto|0|90|180|270", "PresetId":"preset to use for the job
", "SegmentDuration":"[1,60]", "Watermarks":[ { "InputKey":"name of the .png or .jpg file
", "Encryption":{ "Mode":"s3||aes-cbc-pkcs7| aes-ctr|aes-gcm", "Key":"encrypted and base64-encoded encryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" }, "PresetWatermarkId":"value of Video:Watermarks:Id in preset
" }, {...} ], "AlbumArt":[ { "AlbumArtMerge":"Replace|Prepend|Append|Fallback", "AlbumArtArtwork":"can be empty, but not null
":[ { "AlbumArtInputKey":"name of the file to use as album art
", "Encryption":{ "Mode":"s3||aes-cbc-pkcs7| aes-ctr|aes-gcm", "Key":"encrypted and base64-encoded encryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" }, "AlbumArtMaxWidth":"maximum width of output album art in pixels
", "AlbumArtMaxHeight":"maximum height of output album art in pixels
", "AlbumArtSizingPolicy":"Fit|Fill|Stretch|Keep| ShrinkToFit|ShrinkToFill", "AlbumArtPaddingPolicy":"Pad|NoPad", "AlbumArtFormat":"jpg|png" }, {...} ] }, {...} ], "Duration":"duration in seconds
", "Width":"width in pixels
", "Height":"height in pixels
", "Status":"Submitted|Progressing|Complete|Canceled|Error", "StatusDetail":"additional information about job status
", "Captions":{ "CaptionFormats":[ { "Format":"cea-708|dfxp|mov-text|scc|srt|webvtt", "Pattern":"myCaption/file-language
", "Encryption":{ "Mode":"s3||aes-cbc-pkcs7| aes-ctr|aes-gcm", "Key":"encrypted and base64-encoded encryption key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
" } }, {...} ] }, "AppliedColorSpaceConversion":"None|Bt601ToBt709| Bt709ToBt601" }, {...} ], "Playlists":[ { "Format":"HLSv3|HLSv4|MPEG-DASH|Smooth", "Name":"name
", "OutputKeys":[ "Outputs:Key to include in this playlist
", ... ], "HlsContentProtection":{ "Method":"aes-128", "Key":"encrypted and base64-encoded protection key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
", "LicenseAcquisitionUrl":"license acquisition url
", "KeyStoragePolicy":"NoStore|WithVariantPlaylists" }, "PlayReadyDrm":{ "Format":"microsoft|discretix-3.0", "Key":"encrypted and base64-encoded DRM key
", "KeyId":"id of the DRM key
", "KeyMd5":"base64-encoded key digest
", "InitializationVector":"base64-encoded initialization vector
", "LicenseAcquisitionUrl":"license acquisition url
" } }, {...} ], "UserMetadata":{ "key1":"First user metadata value
", "key2":"Second user metadata value
" }, "PipelineId":"pipeline to add the job to
", "Status":"Submitted|Progressing|Complete|Canceled|Error" } }
回應標頭
此操作僅使用大部分回應常見的回應標頭。如需常見回應標頭的資訊,請參閱 HTTP 回應。
回應內文
創建任務時,Elastic Transcoder 會回傳您在請求內指定的值。如需詳細資訊,請參閱 您在建立 Elastic Transcoder Job 時指定的設定。
此外,Elastic Transcoder 會回傳下列值。
- (自動) Id
-
Elastic Transcoder 分配給作業的標識符。您可使用此值來取得任務的設定,或刪除任務。
- (自動) Outputs: Id
-
一個序列計數器,從 1 開始,用於標識當前作業輸出之間的輸出。在 中
Output
語法,這個值都是1
。 - (自動) Outputs: Duration
-
輸出文件的持續時間(以秒為單位),向上舍入。
- (自動) Outputs: Width
-
輸出文件的寬度,以像素為單位。
- (自動) Outputs: Height
-
輸出文件的高度,以像素為單位。
- (自動) Outputs: Status
-
作業中一個輸出的狀態。如果只為該作業指定了一個輸出,
Outputs:Status
的內容永遠與相同Job:Status
。如果指定了多個輸出:Job:Status
和Outputs:Status
對於所有輸出都是Submitted
直到 Elastic Transcoder 開始處理第一個輸出。當 Elastic Transcoder 開始處理第一個輸出時,
Outputs:Status
對於該輸出,Job:Status
兩者皆是變更為Progressing
。對於每個輸出,Outputs:Status
遺跡Submitted
直到 Elastic Transcoder 開始處理輸出。Job:Status
遺跡Progressing
直到所有輸出達到終端狀態,Complete
或者Error
。當所有輸出都達到終端狀態時,
Job:Status
對的變更Complete
僅在Outputs:Status
對於所有輸出都是Complete
。如果Outputs:Status
對於一或多個輸出是Error
,終端狀態Job:Status
也是Error
。
的值
Status
是下列其中一項:Submitted
、Progressing
、Complete
、Canceled
, 或Error
。 - (自動) Outputs: Status
-
進一步解釋的信息
Outputs:Status
。 - (自動) Outputs: AppliedColorSpaceConversion
-
如果 Elastic Transcoder 使用了具有
ColorSpaceConversionMode
對輸出文件進行轉碼,AppliedColorSpaceConversion
參數顯示了所使用的轉換。如果沒有ColorSpaceConversionMode
在預設中定義,則此參數將不會包含在作業響應中。 - Status (自動) Status
-
如果為作業指定了多個輸出,則表示整個作業的狀態。當 Elastic Transcoder 開始處理作業時,
Job:Status
對的變更Progressing
並且在 Elastic Transcoder 完成處理所有輸出之前不會更改。處理完成後,Job:Status
更改為Complete
或者,如果任何輸出失敗,Error
。如果只為該作業指定了一個輸出,
Job:Status
與相同Outputs:Status
。的值
Job:Status
是下列其中一項:Submitted
、Progressing
、Complete
、Canceled
, 或Error
。
錯誤
有關 Elastic Transcoder 異常和錯誤消息的信息,請參處理 Elastic Transcoder 中的錯誤。
注意
若任務失敗且出現 Access Denied
錯誤,建議您執行 Test Role
API 動作來判斷錯誤成因。如需詳細資訊,請參閱 測試角色。
範例
下列範例請求會建立具有兩個輸出的任務。
請求範例
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: 20130114T174952Z Authorization: AWS4-HMAC-SHA256 Credential=AccessKeyID
/request-date
/Elastic Transcoder endpoint
/elastictranscoder/aws4_request, SignedHeaders=host;x-amz-date;x-amz-target, Signature=calculated-signature
Content-Length:number of characters in the JSON string
{ "Inputs":[{ "Key":"recipes/lasagna.mp4", "FrameRate":"auto", "Resolution":"auto", "AspectRatio":"auto", "Interlaced":"auto", "Container":"mp4", "InputCaptions":{ "MergePolicy":"MergeOverride", "CaptionSources":[ { "Key":"scc/lasagna-kindlefirehd.scc", "Language":"en", "Label":"English" }, { "Key":"srt/lasagna-kindlefirehd.srt", "Language":"fr", "TimeOffset":"1:00:00", "Label":"French" } ] } }] "OutputKeyPrefix":"recipes/", "Outputs":[ { "Key":"mp4/lasagna-kindlefirehd.mp4", "ThumbnailPattern":"mp4/thumbnails/lasagna-{count}", "Rotate":"0", "PresetId":"1351620000000-100080", "Watermarks":[ { "InputKey":"logo/128x64.png", "PresetWatermarkId":"company logo 128x64" } ], "Captions":{ "CaptionFormats":[ { "Format":"scc", "Pattern":"scc/lasagna-{language}" }, { "Format":"srt", "Pattern":"srt/lasagna-{language}", } ] } }, { "Key":"iphone/lasagna-1024k", "ThumbnailPattern":"iphone/th1024k/lasagna-{count}", "Rotate":"0", "PresetId":"1351620000000-987654", "SegmentDuration":"5" }, { "Key":"iphone/lasagna-512k", "ThumbnailPattern":"iphone/th512k/lasagna-{count}", "Rotate":"0", "PresetId":"1351620000000-456789", "SegmentDuration":"5" }, ], "Playlists": [ { "Format": "HLSv3", "Name": "playlist-iPhone-lasagna.m3u8", "OutputKeys": [ "iphone/lasagna-1024k", "iphone/lasagna-512k" ] } ], "UserMetadata": { "Food type":"Italian", "Cook book":"recipe notebook" }, "PipelineId":"1111111111111-abcde1" }
回應範例
Status: 201 Created x-amzn-RequestId: c321ec43-378e-11e2-8e4c-4d5b971203e9 Content-Type: application/json Content-Length:
number of characters in the response
Date: Mon, 14 Jan 2013 06:01:47 GMT { "Job":{ "Id":"3333333333333-abcde3", "Inputs":[{ "Key":"recipes/lasagna.mp4", "FrameRate":"auto", "Resolution":"auto", "AspectRatio":"auto", "Interlaced":"auto", "Container":"mp4", "InputCaptions":{ "MergePolicy":"MergeOverride", "CaptionSources":[ { "Key":"scc/lasagna-kindlefirehd.scc", "Language":"en", "Label":"English" }, { "Key":"srt/lasagna-kindlefirehd.srt", "Language":"fr", "TimeOffset":"1:00:00", "Label":"French" } ] } }], "Outputs":[ { "Id":"1", "Key":"mp4/lasagna-kindlefirehd.mp4", "ThumbnailPattern":"mp4/thumbnails/lasagna-{count}", "Rotate":"0", "PresetId":"1351620000000-100080", "Watermarks":[ { "InputKey":"logo/128x64.png", "PresetWatermarkId":"company logo 128x64", } ], "Duration":"1003", "Width":"1280", "Height":"720", "Status":"Progressing", "StatusDetail":"", "Captions":{ "CaptionFormats":[ { "Format":"scc", "Pattern":"scc/lasagna-{language}", }, { "Format":"srt", "Pattern":"srt/lasagna-{language}", }, { "Format":"mov-text" } ] } }, { "Id":"2", "Key":"iphone/lasagna-1024k", "ThumbnailPattern":"iphone/th1024k/lasagna-{count}", "Rotate":"0", "PresetId":"1351620000000-987654", "SegmentDuration":"5", "Duration":"1003", "Width":"1136", "Height":"640", "Status":"Progressing", "StatusDetail":"" }, { "Id":"3", "Key":"iphone/lasagna-512k", "ThumbnailPattern":"iphone/th512k/lasagna-{count}", "Rotate":"0", "PresetId":"1351620000000-456789", "SegmentDuration":"5", "Duration":"1003", "Width":"1136", "Height":"640", "Status":"Complete", "StatusDetail":"", "AppliedColorSpaceConversion":"None" } ], "Playlists":[ { "Format":"HLSv3", "Name":"playlist-iPhone-lasagna.m3u8", "OutputKeys": [ "iphone/lasagna-1024k", "iphone/lasagna-512k" ] } ], "UserMetadata": { "Food type":"Italian", "Cook book":"recipe notebook" }, "PipelineId":"1111111111111-abcde1", "Status":"Progressing" } }