

终止支持通知：2025 年 11 月 13 日， AWS 我们将停止对亚马逊 Elastic Transcoder 的支持。2025 年 11 月 13 日之后，您将无法再访问 Elastic Transcoder 控制台或 Elastic Transcoder 资源。

有关过渡到的更多信息 AWS Elemental MediaConvert，请访问此[博客文章](https://aws.amazon.com/blogs/media/how-to-migrate-workflows-from-amazon-elastic-transcoder-to-aws-elemental-mediaconvert/)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 读取任务
<a name="get-job"></a>

**Topics**
+ [描述](#get-job-description)
+ [请求](#get-job-requests)
+ [响应](#get-job-responses)
+ [错误](#get-job-response-errors)
+ [示例](#get-job-examples)

## 描述
<a name="get-job-description"></a>

要获取有关任务的详细信息，请向 `/2012-09-25/jobs/jobId` 资源发送 GET 请求。

## 请求
<a name="get-job-requests"></a>

### 语法
<a name="get-job-request-syntax"></a>

```
GET /2012-09-25/jobs/jobId HTTP/1.1
Content-Type: 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
```

### 请求参数
<a name="get-job-request-parameters"></a>

此操作接受以下请求参数。

** jobId**  
要获取其详细信息的任务的标识符。

### 请求标头
<a name="get-job-request-headers"></a>

此操作仅使用所有操作通用的请求标头。有关通用请求标头的信息，请参阅 [HTTP 标头内容](making-http-requests.md#http-request-header)。

### 请求正文
<a name="get-job-request-body"></a>

此操作没有请求正文。

## 响应
<a name="get-job-responses"></a>

### 语法
<a name="get-job-response-syntax"></a>

```
Status: 200 OK
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 assigned 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",
         "DetectedProperties":{
            "Width":"video width in pixels",
            "Height":"video height in pixels",
            "FrameRate":"video frame rate in fps",
            "FileSize":"file size in bytes",
            "DurationMillis":"file duration in milliseconds"
         },
         "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",
         "DurationMillis":"duration in milliseconds",
         "Height":"height in pixels",
         "Width":"width in pixels",
         "FrameRate":"frame rate in fps",
         "FileSize":"file size in bytes",
         "Status":"Submitted|In Progress|Complete|Error",
         "StatusDetail":"detail associated with 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":
         {
            "Key":"Value",
            "Second user metadata key":"Second user metadata value"
         },
      "PipelineId":"PipelineId for the job",
      "Status":"Submitted|Progressing|Complete|Canceled|Error",
      "Timing":{
         "SubmitTimeMillis":"job submitted time in epoch milliseconds",
         "StartTimeMillis":"job start time in epoch milliseconds",
         "FinishTimeMillis":"job finish time in epoch milliseconds"
      }
   }
}
```

### 响应标头
<a name="get-job-response-headers"></a>

此操作仅使用大多数响应通用的响应标头。有关通用响应标头的信息，请参阅 [HTTP 响应](making-http-requests.md#http-response-header)。

### 响应正文
<a name="get-job-response-body"></a>

对于满足搜索条件的每个任务，响应正文中均包含在创建任务时指定的值。有关任务值的更多信息，请参阅 [您在创建 Elastic Transcoder 任务时指定的设置](job-settings.md)。

此外，Elastic Transcoder 将返回以下值。

**（自动）Id**  
Elastic Transcoder 为任务分配的标识符。您使用该值获取任务的设置或删除任务。

**（自动）输入：DetectedProperties**  
检测到的输入文件的属性。Elastic Transcoder 从输入文件识别这些值。

**（自动）Inputs:Width**  
检测到的输入文件宽度（以像素为单位）。

**（自动）Inputs:Height**  
检测到的输入文件高度（以像素为单位）。

**（自动）输入：FrameRate**  
检测到的输入文件帧率（以每秒帧数为单位）。

**（自动）输入：FileSize**  
检测到的输入文件大小（以字节为单位）。

**（自动）输入：DurationMillis**  
检测到的输入文件持续时间（以毫秒为单位）。

**（自动）Outputs:Id**  
以 1 开头的顺序计数器，用于在当前任务的输出中标识输出。在 `Output` 语法中，此值始终为 `1`。

**（自动）Outputs:Duration**  
输出文件的持续时间（以秒为单位），向上取整。

**（自动）输出：DurationMillis**  
输出文件的持续时间（以毫秒为单位）。

**（自动）Outputs:Width**  
输出文件的宽度（以像素为单位）。

**（自动）Outputs:Height**  
输出文件的高度（以像素为单位）。

**（自动）输出：FrameRate**  
输出文件的帧率（以每秒帧数为单位）。

**（自动）输出：FileSize**  
输出文件的文件大小（以字节为单位）。

**（自动）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`。
+ 当所有输出都达到终端状态时，仅当所有输出的 `Outputs:Status` 都是 `Complete` 时，`Job:Status` 才会更改为 `Complete`。如果一个或多个输出的 `Outputs:Status` 是 `Error`，则 `Job:Status` 的终端状态也是 `Error`。
`Status` 的值为以下值之一：`Submitted`、`Progressing`、`Complete`、`Canceled` 或 `Error`。

**（自动）输出：StatusDetail**  
进一步解释 `Outputs:Status` 的信息。

**（自动）输出：AppliedColorSpaceConversion**  
如果 Elastic Transcoder 使用带有 `ColorSpaceConversionMode` 的预设对输出文件进行转码，则 `AppliedColorSpaceConversion` 参数会显示所使用的转换。如果在预设中未定义 `ColorSpaceConversionMode`，则此参数将不会包含在任务响应中。

**（自动）Status**  
如果您为任务指定了多个输出，则为整个任务的状态。当 Elastic Transcoder 开始处理任务时，`Job:Status` 的值会更改为 `Progressing`，并且在 Elastic Transcoder 完成对所有输出的处理之前不会发生变化。处理完成后，`Job:Status` 更改为 `Complete`，如果有任何输出失败，则更改为 `Error`。  
如果您只为该任务指定了一个输出，则 `Job:Status` 与 `Outputs:Status` 相同。  
`Job:Status` 的值为以下值之一：`Submitted`、`Progressing`、`Complete`、`Canceled` 或 `Error`。

**（自动）Timing**  
有关任务时间的详细信息。

**（自动）定时：SubmitTimeMillis**  
任务提交给 Elastic Transcoder 的时间（以纪元毫秒为单位）。

**（自动）定时：StartTimeMillis**  
任务开始转码的时间（以纪元毫秒为单位）。

**（自动）定时：FinishTimeMillis**  
任务完成转码的时间（以纪元毫秒为单位）。  
要了解有关纪元时间的更多信息，请访问 Wikipedia 上的[纪元计算](https://en.wikipedia.org/wiki/Epoch_%28reference_date%29#Computing)页面。

## 错误
<a name="get-job-response-errors"></a>

有关 Elastic Transcoder 异常和错误消息的信息，请参阅 [处理 Elastic Transcoder 中的错误](error-handling.md)。

## 示例
<a name="get-job-examples"></a>

### 示例请求
<a name="get-job-examples-sample-request-1"></a>

以下示例请求获取任务 ID 为 3333333333333-abcde3 的任务。

```
GET /2012-09-25/jobs/3333333333333-abcde3 HTTP/1.1
Content-Type: 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
```

### 示例响应
<a name="get-job-examples-sample-response-1"></a>

```
Status: 200 OK
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":"cooking/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"
               }
            ],
         }
         "DetectedProperties":{
            "Width":"1280",
            "Height":"720",
            "FrameRate":"30.00",
            "FileSize":"5872000",
            "DurationMillis":"1003000"
         }
      }],
      "OutputKeyPrefix":"",
      "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",
            "DurationMillis":"1003000",
            "Width":"1280",
            "Height":"720",
            "FrameRate":"30.00",
            "FileSize":"5872000",
            "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",
            "DurationMillis":"1003000",
            "Width":"1136",
            "Height":"640",
            "FrameRate":"30.00",
            "FileSize":"4718600",
            "Status":"Progressing",
            "StatusDetail":"",
            "AppliedColorSpaceConversion":"None"
         },
         {
            "Id":"3",
            "Key":"iphone/lasagna-512k",
            "ThumbnailPattern":"iphone/th512k/lasagna-{count}",
            "Rotate":"0",
            "PresetId":"1351620000000-456789",
            "SegmentDuration":"5",
            "Duration":"1003",
            "DurationMillis":"1003000",
            "Width":"1136",
            "Height":"640",
            "FrameRate":"30.00",
            "FileSize":"3508900",
            "Status":"Complete",
            "StatusDetail":""
         }
      ],
      "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",
      "Timing":{
         "SubmitTime":"1427212800000",
         "StartTime":"1427212856000",
         "FinishTime":"1427212875000"
      }
   }
}
```