建立預設 - Amazon Elastic Transcoder

節省成本並獲得更多功能 AWS Elemental MediaConvert

MediaConvert 是一項較新的檔案型視訊轉碼服務,提供全方位的進階轉碼功能,按需費率從每分鐘 $0.0075 起。閱讀更多

已經使用 Amazon Elastic Transcoder? 遷移到 MediaConvert. 如需詳細資訊,請參閱此概觀,其中包含有關移轉程序的重要資訊以及其他資源的連結。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

建立預設

Description (描述)

欲建立預設,請將 POST 請求傳送到 /2012-09-25/presets 資源。

重要

Elastic Transcoder 會檢查您指定的設定,確保這些設定符合的 Elastic Transcoder 要求且遵循適用標準。若您的設定對無效彈性轉 Elastic Transcoder 器,會回傳 HTTP 400 回應 (ValidationException),並且不創建預設。若設定對有效 Elastic Transcoder 但並未嚴格遵循標準,會建立預設,並在回應中回 Elastic Transcoder 告訊息。如此一來,您即可判定設定是否遵循標準,同時產生的檔案也有更多 Elastic Transcoder。

注意

Elastic Transcoder 包括數個常見輸出格式的系統預設。如需詳細資訊,請參閱「」PresetId主題建立任務

請求

Syntax (語法)

POST /2012-09-25/presets 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 { "Name":"preset name", "Description":"preset description", "Container":"flac|flv|fmp4|gif|mp2|mp3|mp4|mpg|mxf|oga|ogg|ts|wav|webm", "Audio":{ "Codec":"AAC|flac|mp2|mp3|pcm|vorbis", "CodecOptions":{ "Profile":"auto|AAC-LC|HE-AAC|HE-AACv2", "BitDepth":"8|16|24|32", "Signed":"Signed|Unsigned", "BitOrder":"LittleEndian" }, "SampleRate":"auto|22050|32000|44100|48000|96000", "BitRate":"audio bit rate of output file in kilobits/second", "Channels":"auto|0|1|2", "AudioPackingMode":"SingleTrack|OneChannelPerTrack| OneChannelPerTrackWithMosTo8Tracks" }, "Video":{ "Codec":"gif|H.264|mpeg2|vp8|vp9", "CodecOptions":{ "Profile":"baseline|main|high|0|1|2|3", "Level":"1|1b|1.1|1.2|1.3|2|2.1|2.2|3|3.1|3.2|4|4.1", "MaxReferenceFrames":"maximum number of reference frames", "MaxBitRate":"maximum bit rate", "BufferSize":"maximum buffer size", "InterlacedMode":"Progressive|TopFirst|BottomFirst|Auto", "ColorSpaceConversion":"None|Bt709ToBt601|Bt601ToBt709|Auto", "ChromaSubsampling":"yuv420p|yuv422p", "LoopCount":"Infinite|[0,100]" }, "KeyframesMaxDist":"maximum frames between key frames", "FixedGOP":"true|false", "BitRate":"auto|video bit rate of output file in kilobits/second", "FrameRate":"auto|10|15|23.97|24|25|29.97|30|50|60", "MaxFrameRate":"10|15|23.97|24|25|29.97|30|50|60", "MaxWidth":"auto|[128,4096]", "MaxHeight":"auto|[96,3072]", "SizingPolicy":"Fit|Fill|Stretch|Keep|ShrinkToFit|ShrinkToFill", "PaddingPolicy":"Pad|NoPad", "DisplayAspectRatio":"auto|1:1|4:3|3:2|16:9", "Resolution":"auto|width in pixelsxheight in pixels" <not recommended>, "AspectRatio":"auto|1:1|4:3|3:2|16:9" <not recommended>, "Watermarks":[ { "Id":"unique identifier up to 40 characters", "MaxWidth":"[16,Video:MaxWidth]px|[0,100]%", "MaxHeight":"[16,Video:MaxHeight]px|[0,100]%", "SizingPolicy":"Fit|Stretch|ShrinkToFit", "HorizontalAlign":"Left|Right|Center", "HorizontalOffset":"[0,100]%|[0,Video:MaxWidth]px", "VerticalAlign":"Top|Bottom|Center", "VerticalOffset":"[0,100]%|[0,Video:MaxHeight]px", "Opacity":"[0,100]", "Target":"Content|Frame" }, {...} ] }, "Thumbnails":{ "Format":"jpg|png", "Interval":"number of seconds between thumbnails", "MaxWidth":"auto|[32,4096]", "MaxHeight":"auto|[32,3072]", "SizingPolicy":"Fit|Fill|Stretch|Keep|ShrinkToFit|ShrinkToFill", "PaddingPolicy":"Pad|NoPad", "Resolution":"width in pixelsxheight in pixels" <not recommended>, "AspectRatio":"auto|1:1|4:3|3:2|16:9" <not recommended> } }

請求參數

此操作不使用請求參數。

請求標頭

此操作僅使用所有操作常見的請求標頭。如需常見請求標頭的資訊,請參閱 HTTP 標頭內容

請求主體

請求本文的 JSON 字串包含 CreatePreset 操作的輸入物件。如需輸入物件的詳細資訊,請參閱您在建立 Elastic Transcoder 預設集時指定的設定

回應

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 { "Preset":{ "Id":"Id for the new preset", "Type":"Custom|System", "Name":"preset name", "Description":"preset description", "Container":"flac|flv|fmp4|gif|mp2|mp3|mp4|mpg|mxf|oga|ogg|ts|wav|webm", "Audio":{ "Codec":"AAC|flac|mp2|mp3|pcm|vorbis", "CodecOptions":{ "Profile":"auto|AAC-LC|HE-AAC|HE-AACv2", "BitDepth":"8|16|24|32", "Signed":"Signed|Unsigned", "BitOrder":"LittleEndian" }, "SampleRate":"auto|22050|32000|44100|48000|96000", "BitRate":"audio bit rate of output file in kilobits/second", "Channels":"auto|0|1|2", "AudioPackingMode":"SingleTrack|OneChannelPerTrack| OneChannelPerTrackWithMosTo8Tracks" }, "Video":{ "Codec":"gif|H.264|mpeg2|vp8|vp9", "CodecOptions":{ "Profile":"baseline|main|high|0|1|2|3", "Level":"1|1b|1.1|1.2|1.3|2|2.1|2.2|3|3.1|3.2|4|4.1", "MaxReferenceFrames":maximum number of reference frames, "MaxBitRate":"maximum bit rate", "BufferSize":"maximum buffer size", "InterlacedMode":"Progressive|TopFirst|BottomFirst|Auto", "ColorSpaceConversionMode":"None|Bt709ToBt601|Bt601ToBt709|Auto", "ChromaSubsampling":"yuv420p|yuv422p", "LoopCount":"Infinite|[0,100]" }, "KeyframesMaxDist":maximum frames between key frames, "FixedGOP":"true|false", "BitRate":"auto|video bit rate of output file in kilobits/second", "FrameRate":"auto|10|15|23.97|24|25|29.97|30|50|60", "MaxFrameRate":"10|15|23.97|24|25|29.97|30|50|60", "MaxWidth":"auto|[128,4096]", "MaxHeight":"auto|[96,3072]", "SizingPolicy":"Fit|Fill|Stretch|Keep|ShrinkToFit|ShrinkToFill", "PaddingPolicy":"Pad|NoPad", "DisplayAspectRatio":"auto|1:1|4:3|3:2|16:9", "Resolution":"width in pixelsxheight in pixels" <not recommended>, "AspectRatio":"auto|1:1|4:3|3:2|16:9" <not recommended> "Watermarks":[ { "Id":"unique identifier up to 40 characters", "MaxWidth":"[16,Video:MaxWidth]px|[0,100]%", "MaxHeight":"[16,Video:MaxHeight]px|[0,100]%", "SizingPolicy":"Fit|Stretch|ShrinkToFit", "HorizontalAlign":"Left|Right|Center", "HorizontalOffset":"[0,100]%|[0,Video:MaxWidth]px", "VerticalAlign":"Top|Bottom|Center", "VerticalOffset":"[0,100]%|[0,Video:MaxHeight]px", "Opacity":"[0,100]", "Target":"Content|Frame" } ] }, "Thumbnails":{ "Format":"jpg|png", "Interval":"number of seconds between thumbnails", "MaxWidth":"auto|[32,4096]", "MaxHeight":"auto|[32,3072]", "SizingPolicy":"Fit|Fill|Stretch|Keep|ShrinkToFit|ShrinkToFill", "PaddingPolicy":"Pad|NoPad", "Resolution":"width in pixelsxheight in pixels", "AspectRatio":"auto|1:1|4:3|3:2|16:9" } }, "Warning":"message about codec compatibility" }

回應標頭

此操作僅使用大部分回應常見的回應標頭。如需常見回應標頭的資訊,請參閱 HTTP 回應

回應內文

建立任務時,Elastic Transcoder 會回傳您在請求內指定的值。如需詳細資訊,請參閱 請求主體

此外,Elastic Transcoder 會回傳下列值。

(自動) Id

新預設的識別碼。您可使用此值來取得預設的設定,或將之刪除。

(自動) Type

預設是否為 Elastic Transcoder 提供的默認預設(System)或您定義的預設(Custom

Warning (自動) Warning

當預設的設置不符合轉碼器但這些設置可能會產生可接受的輸出,Elastic Transcoder 會創建預設並且包含一個警告,説明如何預設設置不符合。

錯誤

如需 Elastic Transcoder 例外和錯誤訊息的詳細資訊,請參處理 Elastic Transcoder 中的錯誤

範例

以下範例請求建立名為 DefaultPreset 的預設。

請求範例

POST /2012-09-25/presets 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 { "Name":"DefaultPreset", "Description":"Use for published videos", "Container":"mp4", "Audio":{ "Codec":"AAC", "CodecOptions":{ "Profile":"AAC-LC" }, "SampleRate":"44100", "BitRate":"96", "Channels":"2" }, "Video":{ "Codec":"H.264", "CodecOptions":{ "Profile":"main", "Level":"2.2", "MaxReferenceFrames":"3", "MaxBitRate":"", "BufferSize":"", "InterlacedMode":"Progressive", "ColorSpaceConversionMode":"None" }, "KeyframesMaxDist":"240", "FixedGOP":"false", "BitRate":"1600", "FrameRate":"auto", "MaxFrameRate":"30", "MaxWidth":"auto", "MaxHeight":"auto", "SizingPolicy":"Fit", "PaddingPolicy":"Pad", "DisplayAspectRatio":"auto", "Watermarks":[ { "Id":"company logo", "MaxWidth":"20%", "MaxHeight":"20%", "SizingPolicy":"ShrinkToFit", "HorizontalAlign":"Right", "HorizontalOffset":"10px", "VerticalAlign":"Bottom", "VerticalOffset":"10px", "Opacity":"55.5", "Target":"Content" } ] }, "Thumbnails":{ "Format":"png", "Interval":"120", "MaxWidth":"auto", "MaxHeight":"auto", "SizingPolicy":"Fit", "PaddingPolicy":"Pad" } }

回應範例

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 { "Preset":{ "Id":"5555555555555-abcde5", "Type":"Custom", "Name":"DefaultPreset", "Description":"Use for published videos", "Container":"mp4", "Audio":{ "Codec":"AAC", "CodecOptions":{ "Profile":"AAC-LC" }, "SampleRate":"44100", "BitRate":"96", "Channels":"2" }, "Video":{ "Codec":"H.264", "CodecOptions":{ "Profile":"main", "Level":"2.2", "MaxReferenceFrames":"3", "MaxBitRate":"", "BufferSize":"", "InterlacedMode":"Progressive", "ColorSpaceConversionMode":"None|Bt709ToBt601|Bt601ToBt709|Auto" }, "KeyframesMaxDist":"240", "FixedGOP":"false", "BitRate":"1600", "FrameRate":"auto", "MaxFrameRate":"30", "MaxWidth":"auto", "MaxHeight":"auto", "SizingPolicy":"Fit", "PaddingPolicy":"Pad", "DisplayAspectRatio":"auto", "Watermarks":[ { "Id":"company logo", "MaxWidth":"20%", "MaxHeight":"20%", "SizingPolicy":"ShrinkToFit", "HorizontalAlign":"Right", "HorizontalOffset":"10px", "VerticalAlign":"Bottom", "VerticalOffset":"10px", "Opacity":"55.5", "Target":"Content" } ] }, "Thumbnails":{ "Format":"png", "Interval":"120", "MaxWidth":"auto", "MaxHeight":"auto", "SizingPolicy":"Fit", "PaddingPolicy":"Pad" } }, "Warning":"" }