

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# マルチチャネルの音声文字起こし
<a name="channel-id"></a>

オーディオに 2 つのチャネルがある場合は、チャネル識別を使用して、各チャネルから個別に音声を文字起こしできます。 は現在、3 Amazon Transcribeつ以上のチャネルを持つオーディオをサポートしていません。

トランスクリプトでは、チャネルには `ch_0` と `ch_1` というラベルが割り当てられます。

チャネル識別が有効になっているリクエストには、[標準の文字起こしセクション](how-input.md#how-it-works-output) (`transcripts`と`items`) に加えて、`channel_labels` セクションが含まれます。このセクションには、チャネルごとにグループ化された各発話または句読点と、それに関連するチャネルラベル、タイムスタンプ、信頼スコアが含まれています。

```
"channel_labels": {
    "channels": [
        {
            "channel_label": "ch_0",
            "items": [                                      
                {
                    "channel_label": "ch_0",
                    "start_time": "4.86",
                    "end_time": "5.01",
                    "alternatives": [
                        {
                            "confidence": "1.0",
                            "content": "I've"
                        }
                    ],
                    "type": "pronunciation"
                },
                ...               
            "channel_label": "ch_1",
            "items": [
                {
                    "channel_label": "ch_1",
                    "start_time": "8.5",
                    "end_time": "8.89",
                    "alternatives": [
                        {
                            "confidence": "1.0",
                            "content": "Sorry"
                        }
                    ],
                    "type": "pronunciation"
                },
                ...
            "number_of_channels": 2
        },
```

あるチャネルにいる人が別のチャネルにいる人と同時に話す場合、各人がお互いに話している間、各チャネルのタイムスタンプが重複することに注意してください。

チャネル識別を含むトランスクリプトの完全な例については、「[チャネル識別出力の例 (バッチ)](channel-id-output-batch.md)」を参照してください。

## バッチ文字起こしでのチャネル識別の使用
<a name="channel-id-batch"></a>

バッチ文字起こしでチャネルを識別するには、**AWS マネジメントコンソール**、**AWS CLI** または **AWSSDK** を使用できます。例については以下を参照してください。

### AWS マネジメントコンソール
<a name="channel-id-console-batch"></a>

1. [AWS マネジメントコンソール](https://console.aws.amazon.com/transcribe/) にサインインします。

1. ナビゲーションペインで、[**文字起こしジョブ**] を選択後、[**ジョブの作成**] (右上) を選択します。これにより、「**ジョブの詳細を指定**」ページが開きます。  
![\[Amazon Transcribeコンソールの「ジョブの詳細を指定する」ページ。「ジョブ設定」パネルでは、文字起こしジョブの名前を指定し、モデルタイプを選択し、言語設定を指定できます。\]](http://docs.aws.amazon.com/ja_jp/transcribe/latest/dg/images/console-batch-job-details-1.png)

1. **ジョブの詳細を指定**ページで追加したいフィールドに入力後、「**次へ**」を選択します。これにより、**ジョブの設定 - *オプション***ページへ移動します。

   **音声設定**パネルで、「音声識別タイプ」の見出しの下にある [**チャネル識別**] を選択します。  
![\[Amazon Transcribeコンソールの「ジョブの設定」ページ。「音声設定」パネルでは、チャネル識別を有効にできます。\]](http://docs.aws.amazon.com/ja_jp/transcribe/latest/dg/images/channel-id-batch.png)

1. [**ジョブの作成**] を選択して、文字起こしジョブを実行します。

### AWS CLI
<a name="channel-id-cli"></a>

この例では、[start-transcription-job](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/transcribe/start-transcription-job.html) を使用します。詳細については、「[https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartTranscriptionJob.html)」を参照してください。

```
aws transcribe start-transcription-job \
--region us-west-2 \
--transcription-job-name my-first-transcription-job \
--media MediaFileUri=s3://amzn-s3-demo-bucket/my-input-files/my-media-file.flac \
--output-bucket-name amzn-s3-demo-bucket \
--output-key my-output-files/ \
--language-code en-US \
--settings ChannelIdentification=true
```

別の例として、[start-transcription-job](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/transcribe/start-transcription-job.html) コマンド、およびそのジョブとのチャネル識別を可能にするリクエストボディを使用します。

```
aws transcribe start-transcription-job \
--region us-west-2 \
--cli-input-json file://my-first-transcription-job.json
```

ファイル *my-first-transcription-job.json* には、次のリクエストボディが含まれています。

```
{
    "TranscriptionJobName": "my-first-transcription-job",
    "Media": {
        "MediaFileUri": "s3://amzn-s3-demo-bucket/my-input-files/my-media-file.flac"
  },
    "OutputBucketName": "amzn-s3-demo-bucket",
    "OutputKey": "my-output-files/", 
    "LanguageCode": "en-US",
    "Settings": {
        "ChannelIdentification": true
    }
}
```

### AWS SDK for Python (Boto3)
<a name="channel-id-python-batch"></a>

この例ではAWS SDK for Python (Boto3)、 を使用して [start\$1transcription\$1job](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/transcribe.html#TranscribeService.Client.start_transcription_job) メソッドを使用してチャネルを識別します。詳細については、「[StartTranscriptionJob](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartTranscriptionJob.html)」を参照してください。

```
from __future__ import print_function
import time
import boto3
transcribe = boto3.client('transcribe', 'us-west-2')
job_name = "my-first-transcription-job"
job_uri = "s3://amzn-s3-demo-bucket/my-input-files/my-media-file.flac"
transcribe.start_transcription_job(
    TranscriptionJobName = job_name,
    Media = {
        'MediaFileUri': job_uri
    },
    OutputBucketName = 'amzn-s3-demo-bucket',
    OutputKey = 'my-output-files/', 
    LanguageCode = 'en-US', 
    Settings = {
        'ChannelIdentification':True
    }
)

while True:
    status = transcribe.get_transcription_job(TranscriptionJobName = job_name)
    if status['TranscriptionJob']['TranscriptionJobStatus'] in ['COMPLETED', 'FAILED']:
        break
    print("Not ready yet...")
    time.sleep(5)
print(status)
```

## ストリーミング文字起こしでのチャネル識別の使用
<a name="channel-id-stream"></a>

ストリーミング文字起こしでチャネルを識別するには、**HTTP/2** または **WebSocket** を使用できます。例については以下を参照してください。

### HTTP/2 ストリーム
<a name="channel-id-http2"></a>

この例では、文字起こしの出力でチャネルを分離する HTTP/2 リクエストを作成します。での HTTP/2 ストリーミングの使用の詳細についてはAmazon Transcribe、「」を参照してください[HTTP/2 ストリームの設定](streaming-setting-up.md#streaming-http2)。Amazon Transcribe に固有のパラメータとヘッダーの詳細については、「[StartStreamTranscription](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartStreamTranscription.html)」を参照してください。

```
POST /stream-transcription HTTP/2
host: transcribestreaming.us-west-2.amazonaws.com
X-Amz-Target: com.amazonaws.transcribe.Transcribe.StartStreamTranscription
Content-Type: application/vnd.amazon.eventstream
X-Amz-Content-Sha256: string
X-Amz-Date: 20220208T235959Z
Authorization: AWS4-HMAC-SHA256 Credential=access-key/20220208/us-west-2/transcribe/aws4_request, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target;x-amz-security-token, Signature=string
x-amzn-transcribe-language-code: en-US
x-amzn-transcribe-media-encoding: flac
x-amzn-transcribe-sample-rate: 16000      
x-amzn-channel-identification: TRUE
transfer-encoding: chunked
```

パラメータ定義は [API リファレンス](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_Reference.html)にあります。すべての AWSAPI オペレーションに共通のパラメータは、[「共通パラメータ](https://docs.aws.amazon.com/transcribe/latest/APIReference/CommonParameters.html)」セクションに記載されています。

### WebSocket ストリーム
<a name="channel-id-websocket"></a>

この例では、文字起こし出力のチャネルを分離するための署名付き URL を作成します。読みやすくするために、改行が追加されています。で WebSocket ストリームを使用する方法の詳細についてはAmazon Transcribe、「」を参照してください[WebSocket ストリームの設定](streaming-setting-up.md#streaming-websocket)。パラメータの詳細については、「[https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartStreamTranscription.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_streaming_StartStreamTranscription.html)」を参照してください。

```
GET wss://transcribestreaming.us-west-2.amazonaws.com:8443/stream-transcription-websocket?
&X-Amz-Algorithm=AWS4-HMAC-SHA256
&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20220208%2Fus-west-2%2Ftranscribe%2Faws4_request
&X-Amz-Date=20220208T235959Z
&X-Amz-Expires=300
&X-Amz-Security-Token=security-token
&X-Amz-Signature=string
&X-Amz-SignedHeaders=content-type%3Bhost%3Bx-amz-date
&language-code=en-US
&specialty=PRIMARYCARE
&type=DICTATION
&media-encoding=flac
&sample-rate=16000    
&channel-identification=TRUE
```

パラメータ定義は [API リファレンス](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_Reference.html)にあります。すべての AWSAPI オペレーションに共通のパラメータは、[「共通パラメータ](https://docs.aws.amazon.com/transcribe/latest/APIReference/CommonParameters.html)」セクションに記載されています。

# チャネル識別出力の例 (バッチ)
<a name="channel-id-output-batch"></a>

チャネル識別を有効にしたバッチ文字起こし出力の例を以下に示します。

```
{
    "jobName": "my-first-transcription-job",
    "accountId": "111122223333",
    "results": {
        "transcripts": [
            {
                "transcript": "I've been on hold for an hour. Sorry about that."
            }
        ],
        "channel_labels": {
            "channels": [
                {
                    "channel_label": "ch_0",
                    "items": [                                      
                        {
                            "channel_label": "ch_0",
                            "start_time": "4.86",
                            "end_time": "5.01",
                            "alternatives": [
                                {
                                    "confidence": "1.0",
                                    "content": "I've"
                                }
                            ],
                            "type": "pronunciation"
                        },
                        {
                            "channel_label": "ch_0",
                            "start_time": "5.01",
                            "end_time": "5.16",
                            "alternatives": [
                                {
                                    "confidence": "1.0",
                                    "content": "been"
                                }
                            ],
                            "type": "pronunciation"
                        },
                        {
                            "channel_label": "ch_0",
                            "start_time": "5.16",
                            "end_time": "5.28",
                            "alternatives": [
                                {
                                    "confidence": "1.0",
                                    "content": "on"
                                }
                            ],
                            "type": "pronunciation"
                        },
                        {
                            "channel_label": "ch_0",
                            "start_time": "5.28",
                            "end_time": "5.62",
                            "alternatives": [
                                {
                                    "confidence": "1.0",
                                    "content": "hold"
                                }
                            ],
                            "type": "pronunciation"
                        },
                        {
                            "channel_label": "ch_0",
                            "start_time": "5.62",
                            "end_time": "5.83",
                            "alternatives": [
                                {
                                    "confidence": "1.0",
                                    "content": "for"
                                }
                            ],
                            "type": "pronunciation"
                        },              
                        {
                            "channel_label": "ch_0",
                            "start_time": "6.1",
                            "end_time": "6.25",
                            "alternatives": [
                                {
                                    "confidence": "1.0",
                                    "content": "an"
                                }
                            ],
                            "type": "pronunciation"
                        },
                        {
                            "channel_label": "ch_0",
                            "start_time": "6.25",
                            "end_time": "6.87",
                            "alternatives": [
                                {
                                    "confidence": "1.0",
                                    "content": "hour"
                                }
                            ],
                            "type": "pronunciation"
                        },                      
                        {
                            "channel_label": "ch_0",
                            "language_code": "en-US",
                            "alternatives": [
                                {
                                    "confidence": "0.0",
                                    "content": "."
                                }
                            ],
                            "type": "punctuation"
                        }                      
                    ]
                },
                {                
                "channel_label": "ch_1",
                    "items": [
                        {
                            "channel_label": "ch_1",
                            "start_time": "8.5",
                            "end_time": "8.89",
                            "alternatives": [
                                {
                                    "confidence": "1.0",
                                    "content": "Sorry"
                                }
                            ],
                            "type": "pronunciation"
                        },
                        {
                            "channel_label": "ch_1",
                            "start_time": "8.89",
                            "end_time": "9.06",
                            "alternatives": [
                                {
                                    "confidence": "0.9176",
                                    "content": "about"
                                }
                            ],
                            "type": "pronunciation"
                        },
                        {
                            "channel_label": "ch_1",
                            "start_time": "9.06",
                            "end_time": "9.25",
                            "alternatives": [
                                {
                                    "confidence": "1.0",
                                    "content": "that"
                                }
                            ],
                            "type": "pronunciation"
                        },
                        {
                            "channel_label": "ch_1",
                            "alternatives": [
                                {
                                    "confidence": "0.0",
                                    "content": "."
                                }
                            ],
                            "type": "punctuation"
                        }                     
                    ]
                }
            ],
            "number_of_channels": 2
        },
        "items": [            
            {
                "id": 0,
                "channel_label": "ch_0",
                "start_time": "4.86",
                "end_time": "5.01",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "I've"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "id": 1,
                "channel_label": "ch_0",
                "start_time": "5.01",
                "end_time": "5.16",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "been"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "id": 2,
                "channel_label": "ch_0",
                "start_time": "5.16",
                "end_time": "5.28",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "on"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "id": 3,
                "channel_label": "ch_0",
                "start_time": "5.28",
                "end_time": "5.62",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "hold"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "id": 4,
                "channel_label": "ch_0",
                "start_time": "5.62",
                "end_time": "5.83",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "for"
                    }
                ],
                "type": "pronunciation"
            },            
            {
                "id": 5,
                "channel_label": "ch_0",
                "start_time": "6.1",
                "end_time": "6.25",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "an"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "id": 6,
                "channel_label": "ch_0",
                "start_time": "6.25",
                "end_time": "6.87",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "hour"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "id": 7,
                "channel_label": "ch_0",
                "alternatives": [
                    {
                        "confidence": "0.0",
                        "content": "."
                    }
                ],
                "type": "punctuation"
            },
            {
                "id": 8,
                "channel_label": "ch_1",
                "start_time": "8.5",
                "end_time": "8.89",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "Sorry"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "id": 9,
                "channel_label": "ch_1",
                "start_time": "8.89",
                "end_time": "9.06",
                "alternatives": [
                    {
                        "confidence": "0.9176",
                        "content": "about"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "id": 10,
                "channel_label": "ch_1",
                "start_time": "9.06",
                "end_time": "9.25",
                "alternatives": [
                    {
                        "confidence": "1.0",
                        "content": "that"
                    }
                ],
                "type": "pronunciation"
            },
            {
                "id": 11,
                "channel_label": "ch_1",
                "alternatives": [
                    {
                        "confidence": "0.0",
                        "content": "."
                    }
                ],
                "type": "punctuation"
            }
        ],
        "audio_segments": [
            {
                "id": 0,
                "transcript": "I've been on hold for an hour.",
                "start_time": "4.86",
                "end_time": "6.87",
                "channel_label": "ch_0",
                "items": [
                    0,
                    1,
                    2,
                    3,
                    4,
                    5,
                    6,
                    7
                ]
            },
            {
                "id": 1,
                "transcript": "Sorry about that.",
                "start_time": "8.5",
                "end_time": "9.25",
                "channel_label": "ch_1",
                "items": [
                    8,
                    9,
                    10,
                    11
                ]
            }
        ]
    },
    "status": "COMPLETED"
}
```