Ahorre costes y obtenga más funciones con AWS Elemental MediaConvert
MediaConvert es un nuevo servicio de transcodificación de vídeo basado en archivos que ofrece un conjunto completo de funciones de transcodificación avanzadas, con tarifas a pedido a partir de 0,0075$ por minuto. Lea más.
¿Ya utiliza Amazon Elastic Transcoder? Es fácil migrar a él. MediaConvert Para obtener más información, consulte esta descripción general
Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.
Crear tarea
Descripción
Para crear una tarea, envíe una solicitud POST al recurso /2012-09-25/jobs
. Las tareas comienzan tan pronto como las crea.
nota
Puede configurar Elastic Transcoder para recibir una notificación cuando el estado de una tarea cambie, incluido cuándo Elastic Transcoder empieza y termina de procesar una tarea, y cuándo Elastic Transcoder encuentra una condición de error o una advertencia. Para obtener más información, consulte Crear canalización.
Solicitudes
Sintaxis
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
" }
Parámetros de solicitud
Esta operación no usa parámetros de solicitud.
Encabezados de solicitud
Esta operación solo usa encabezados de solicitud que sean comunes para todas las operaciones. Para obtener información acerca de los encabezados de solicitudes comunes, consulte Contenido de los encabezados HTTP.
Cuerpo de la solicitud
La cadena JSON del cuerpo de solicitud contiene los objetos de entrada de la operación CreateJob
. Para obtener más información acerca de los objetos de entrada, consulte Configuración que se especifica para crear una tarea de Elastic Transcoder.
Respuestas
Sintaxis
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" } }
Encabezados de respuesta
Esta operación solo usa encabezados de respuesta que sean comunes a la mayoría de las respuestas. Para obtener información acerca de los encabezados de respuestas comunes, consulte Respuestas HTTP.
Cuerpo de respuesta
Cuando se crea una tarea, Elastic Transcoder devuelve los valores especificados en la solicitud. Para obtener más información, consulte Configuración que se especifica para crear una tarea de Elastic Transcoder.
Además, Elastic Transcoder devuelve los siguientes valores.
- (Automatic) Id
-
El identificador que Elastic Transcoder asignó a la tarea. Use este valor para obtener la configuración de la tarea o para eliminarla.
- (Automatic) Outputs:Id
-
Un contador secuencial, que cuenta a partir de 1 e identifica una salida entre las salidas de la tarea actual. En la sintaxis de
Output
, este valor siempre es1
. - (Automatic) Outputs:Duration
-
La duración del archivo de salida en segundos, redondeada por exceso.
- (Automatic) Outputs:Width
-
El ancho del archivo de salida, en píxeles.
- (Automatic) Outputs:Height
-
El alto del archivo de salida, en píxeles.
- (Automatic) Outputs:Status
-
El estado de una salida en una tarea. Si ha especificado una sola salida para la tarea,
Outputs:Status
siempre es el mismo queJob:Status
. Si ha especificado varias salidas:Job:Status
yOutputs:Status
para todas las salidas sonSubmitted
hasta que Elastic Transcoder comience a procesar la primera salida.Cuando Elastic Transcoder comience a procesar la primera salida,
Outputs:Status
para esa salida yJob:Status
cambiarán a la vez aProgressing
. Para cada salida, el valor deOutputs:Status
permanece enSubmitted
hasta que Elastic Transcoder comience a procesar la salida.Job:Status
permanece enProgressing
hasta que todas las salidas alcancen un estado final, ya seaComplete
oError
.Cuando todas las salidas alcanzan un estado final,
Job:Status
cambia aComplete
solo siOutputs:Status
es para todas las salidasComplete
. SiOutputs:Status
de una o más salidas esError
, el estado final deJob:Status
también esError
.
El valor de
Status
es uno de los siguientes:Submitted
,Progressing
,Complete
,Canceled
oError
. - (Automatic) Outputs:StatusDetail
-
Información que explica con más detalle el
Outputs:Status
. - (Automático) Outputs:AppliedColorSpaceConversion
-
Si Elastic Transcoder ha utilizado un elemento preestablecido con un
ColorSpaceConversionMode
para transcodificar el archivo de salida, el parámetroAppliedColorSpaceConversion
mostrará la conversión utilizada. Si no se ha definidoColorSpaceConversionMode
en el elemento preestablecido, este parámetro no se incluirá en la respuesta de la tarea. - (Automatic) Status
-
Si ha especificado más de una salida para la tarea, el estado de toda la tarea. Cuando Elastic Transcoder comienza a procesar una tarea, el valor de
Job:Status
cambia aProgressing
y no vuelve a cambiar hasta que Elastic Transcoder termina de procesar todos los resultados. Cuando finaliza el procesamiento,Job:Status
cambia aComplete
o, si alguna de las salidas ha generado un error, aError
.Si ha especificado solo una salida para la tarea,
Job:Status
es el mismo queOutputs:Status
.El valor de
Job:Status
es uno de los siguientes:Submitted
,Progressing
,Complete
,Canceled
oError
.
Errores
Para obtener información acerca de los mensajes de error y las excepciones en Elastic Transcoder, consulte Gestión de errores en Elastic Transcoder.
nota
Si una tarea da un error Access Denied
, recomendamos que ejecute la acción de la API Test Role
para determinar qué está causando el error. Para obtener más información, consulte Función de prueba.
Ejemplos
La siguiente solicitud de ejemplo crea una tarea que tiene dos salidas.
Solicitud de muestra
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" }
Respuesta de ejemplo
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" } }