誰が話しているかわかる文字起こし
インタビュー、ポッドキャスト、パネルディスカッション、会議には、複数の話者が登場します。発言をすべてひとまとまりにした文字起こしでは、誰が何を言ったのか推測するしかありません。話者を示さずに次々と切り替わるキャプションでは、内容を追うのがさらに難しくなります。
🤖 /speech/transcribe で話者のラベル付けに対応しました。台本のように読めるテキストの文字起こし、標準の話者タグ付き字幕、話者ごとに色分けしたソーシャルメディア向けキャプションと、すべての出力に話者が表示されます。
NASA の Houston We Have a Podcast 第441回から、音声だけを使い、1 つの Assembly で作成したクリップです。司会者は黄色、Artemis II の宇宙飛行士はシアンで表示しています。Transloadit Storage から配信しています。
1 つのコマンド
npx -y @transloadit/node speech transcribe --speaker-labels -i interview.mp3 -o interview.txt
上のクリップでは、interview.txt は次のようになります。
Speaker 1: If you could just maybe we'll take a step into those 10 days in orbit and what it was like in Orion, um, and just zooming back, looking at the overall perspective of the flight, now a couple months separated from it, you know, how are you characterizing the entirety of the experience, um, over those 10 days?
Speaker 2: Well, there's a lot that you could, you could dig into there. The, you know, I think one thing that comes to mind is we are busy, uh, really busy and really working together to try to stay on the schedule.
話者の人数がわかっている場合は --max-speakers 2 を追加します。別の出力を選ぶには --format を追加します。
すべての形式で話者を表示
textは、上の例のように、発言の交代ごとに段落を分けます。webvttは、各キューを<v Speaker 1>などの標準の話者スパンで囲みます。プレーヤーや字幕エディターで、話者ごとに名前やスタイルを設定できます。srtには話者タグがないため、話者が交代するたびにキューの先頭にSpeaker 2:を付けます。jsonは、すべての単語に話者ラベルを付け、発言の交代ごとにセグメントを追加します。独自の表示を作る際に利用できます。
1 つの字幕キューが複数の話者にまたがることはありません。話者ラベルは aws と gcp のプロバイダーが提供します。provider を省略すると、Transloadit が話者ラベルに対応するプロバイダーを選択します。
話者ごとの色分け
🤖 /video/subtitle で焼き込むキャプションも、話者ごとに色分けできるようになりました。/speech/transcribe の話者ラベル付き JSON と、speaker_colors のリストを渡します。発話中の単語がその話者の色で強調され、キャプションが次の話者の発言にまたがることはありません。
冒頭の動画は、音声ファイルだけを元に、1 つの Assembly で作成しています。NASA の写真をインポートし、波形を描画して、両方をカバー画像に配置します。そのカバー画像と音声を動画に変換し、キャプションを焼き込みます。
{
"steps": {
"photo": {
"robot": "/http/import",
"url": "https://images-assets.nasa.gov/image/art002e009567/art002e009567~orig.jpg"
},
"waveform": {
"use": ":original",
"robot": "/audio/waveform",
"format": "image",
"width": 1600,
"height": 90,
"background_color": "00000000",
"outer_color": "ffffff73",
"center_color": "ffffff73",
"waveform_style": "bars",
"bar_width": 5,
"bar_gap": 5,
"bar_style": "rounded",
"style": "v1"
},
"cover": {
"use": {
"steps": [
{ "name": "photo", "as": "base" },
{ "name": "waveform", "as": "watermark" }
]
},
"robot": "/image/resize",
"width": 1920,
"height": 1080,
"resize_strategy": "crop",
"watermark_y_offset": 40,
"format": "jpg",
"text": [
{
"text": "HOUSTON WE HAVE A PODCAST · ARTEMIS II",
"font": "Poppins-SemiBold",
"size": 30,
"color": "#ffffff",
"align": "right",
"valign": "top",
"x_offset": 60,
"y_offset": 52
}
],
"watermark_position": "bottom"
},
"video": {
"use": {
"steps": [
{ "name": "cover", "as": "image" },
{ "name": ":original", "as": "audio" }
]
},
"robot": "/video/merge",
"preset": "empty",
"ffmpeg": { "f": "mp4" },
"ffmpeg_stack": "v7"
},
"transcribed": {
"use": ":original",
"robot": "/speech/transcribe",
"speaker_labels": true,
"format": "json"
},
"captioned": {
"use": {
"steps": [
{ "name": "video", "as": "video" },
{ "name": "transcribed", "as": "subtitles" }
]
},
"robot": "/video/subtitle",
"subtitles_type": "burned",
"preset": "empty",
"style": "social",
"ffmpeg_stack": "v7",
"result": true,
"speaker_colors": ["FFD60A", "4CC9F0"]
}
}
}
speaker-captions.json として保存し、任意の音声ファイルに対して実行します。
npx -y @transloadit/node assemblies create --steps speaker-captions.json -i podcast.mp3 -o out/
人物が映っている動画では、最初の 4 つの Step を省略し、ソーシャルメディア向けキャプションの記事と同様に、動画として :original を使用します。
はじめに
手元の録音で上のコマンドを実行するか、新しい Template に Step を貼り付けてください。すべてのパラメーターは、🤖 /speech/transcribe と 🤖 /video/subtitle のページに掲載しています。
音声と写真の提供:NASA。音声は Houston We Have a Podcast 第441回「Reflections After Artemis II」、写真は Artemis II の「Orion POV: Destination and Home」です。NASA が Transloadit を推奨しているわけではありません。
