Buat Tugas - Amazon Elastic Transcoder

Hemat biaya dan dapatkan lebih banyak fitur dengan AWS Elemental MediaConvert

MediaConvert adalah layanan transcoding video berbasis file yang lebih baru yang menyediakan rangkaian lengkap fitur transcoding canggih, dengan tarif sesuai permintaan mulai dari $0,0075/menit. Baca lebih lanjut.

Sudah menggunakan Amazon Elastic Transcoder? Sangat mudah untuk bermigrasi ke MediaConvert. Untuk informasi selengkapnya, lihat ikhtisar ini yang mencakup informasi berharga tentang proses migrasi dan tautan ke sumber daya tambahan.

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Buat Tugas

Deskripsi

Untuk membuat pekerjaan, kirim permintaan POST ke/2012-09-25/jobssumber daya. Pekerjaan dimulai segera setelah Anda membuatnya.

catatan

Anda dapat mengkonfigurasi Elastic Transcoder untuk memberi tahu Anda ketika status pekerjaan berubah, termasuk ketika Elastic Transcoder dimulai dan selesai memproses pekerjaan, dan ketika Elastic Transcoder menemukan peringatan atau kesalahan kondisi. Untuk informasi selengkapnya, lihat Membuat Saluran.

Permintaan

Sintaksis

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" }

Parameter Permintaan

Operasi ini tidak menggunakan parameter permintaan.

Header Permintaan

Operasi ini hanya menggunakan header permintaan yang umum untuk semua operasi. Untuk informasi selengkapnya tentang header permintaan umum, lihat Konten Header HTTP.

Isi Permintaan

String JSON dalam isi permintaan berisi objek input untukCreateJoboperasi. Untuk informasi selengkapnya tentang objek input, lihatPengaturan yang Anda Tentukan Saat Membuat Pekerjaan Transcoder Elastis.

Respons

Sintaksis

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 pixelsxheight 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" } }

Header Respons

Operasi ini hanya menggunakan header respons yang umum untuk sebagian besar respons. Untuk informasi tentang header permintaan umum, lihat Respons HTTP.

Isi Respons

Ketika Anda membuat pekerjaan, Elastic Transcoder mengembalikan nilai-nilai yang Anda tentukan dalam permintaan. Untuk informasi selengkapnya, lihat Pengaturan yang Anda Tentukan Saat Membuat Pekerjaan Transcoder Elastis.

Selain itu, Elastic Transcoder mengembalikan nilai berikut.

(Otomatis) Id

Pengenal bahwa Elastic Transcoder ditugaskan untuk pekerjaan. Anda menggunakan nilai ini untuk mendapatkan pengaturan untuk pekerjaan atau untuk menghapus pekerjaan.

(Otomatis) Output: Id

Penghitung berurutan, dimulai dengan 1, yang mengidentifikasi output di antara output dari pekerjaan saat ini. DiOutputsintaks, nilai ini selalu1.

(Otomatis) Output: Durasi

Durasi file output dalam hitungan detik, dibulatkan.

(Otomatis) Output: Lebar

Lebar file output, dalam piksel.

(Otomatis) Output: Tinggi

Ketinggian file output, dalam piksel.

(Otomatis) Output: Status

Status satu output dalam pekerjaan. Jika Anda menentukan hanya satu output untuk pekerjaan itu,Outputs:Statusselalu sama denganJob:Status. Jika Anda menentukan lebih dari satu output:

  • Job:StatusdanOutputs:Statusuntuk semua output adalahSubmittedsampai Elastic Transcoder mulai memproses output pertama.

  • Ketika Elastic Transcoder mulai memproses output pertama,Outputs:Statusuntuk output itu danJob:Statuskeduanya berubah menjadiProgressing. Untuk setiap output, nilaiOutputs:StatussisaSubmittedsampai Elastic Transcoder mulai memproses output.

  • Job:StatussisaProgressingsampai semua output mencapai status terminal, baikCompleteatauError.

  • Ketika semua output mencapai status terminal,Job:StatusperubahanCompletehanya jikaOutputs:Statusuntuk semua output adalahComplete. JikaOutputs:Statusuntuk satu output atau lebihError, status terminal untukJob:StatusjugaError.

Nilai dariStatusadalah salah satu langkah berikut:Submitted,Progressing,Complete,Canceled, atauError.

(Otomatis) Output: StatusDetail

Informasi yang lebih lanjut menjelaskanOutputs:Status.

(Otomatis) Output: AppliedColorSpaceConversion

Jika Elastic Transcoder menggunakan preset denganColorSpaceConversionModeuntuk transcode file output,AppliedColorSpaceConversionparameter menunjukkan konversi yang digunakan. Jika tidakColorSpaceConversionModedidefinisikan dalam preset, parameter ini tidak akan dimasukkan dalam respon pekerjaan.

Status (Otomatis)

Jika Anda menentukan lebih dari satu output untuk pekerjaan, status seluruh pekerjaan. Ketika Elastic Transcoder mulai memproses pekerjaan, nilaiJob:StatusperubahanProgressingdan tidak berubah sampai Elastic Transcoder telah selesai memproses semua output. Saat pemrosesan selesai,Job:Statusperubahan baik keCompleteatau, jika salah satu output gagal, untukError.

Jika Anda menentukan hanya satu output untuk pekerjaan itu,Job:Statussama denganOutputs:Status.

Nilai dariJob:Statusadalah salah satu langkah berikut:Submitted,Progressing,Complete,Canceled, atauError.

Kesalahan

Untuk informasi tentang pengecualian dan pesan kesalahan Elastic Transcoder, lihatPenanganan Kesalahan di Elastic Transcoder.

catatan

Jika pekerjaan gagal denganAccess Deniedkesalahan, kami menyarankan Anda untuk menjalankanTest RoleAksi API untuk menentukan apa yang menyebabkan kesalahan. Untuk informasi selengkapnya, lihat Peran Uji.

Contoh

Contoh permintaan berikut menciptakan pekerjaan yang memiliki dua output.

Sampel Permintaan

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" }

Contoh Respons

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" } }