Speech to text: Whisper
Lesson "audio-transcribe", in the group Sound and speech of the lesson list. Steps: 7.
What you will be able to do
You build a graph that writes down what is said in a recording and saves subtitles.
What you need
- Node packs: ComfyUI-Whisper. You install them in ComfyUI yourself, then choose Sync ▸ Sync now. Until then the card says the lesson does not fit and names the pack.
- Nodes: Load Audio, Apply Whisper, Preview as Text, Save SRT.
- The app downloads and installs nothing. The step texts below say which files and folders, and which ComfyUI template names them.
The steps
The words of each step, as the lesson shows them. Node names are in bold.
What Whisper does (reading)
Whisper listens to speech and writes it down, with the time of every phrase and word. From that come plain text and subtitles.
The nodes of this lesson come from the ComfyUI-Whisper pack. A pack runs other people's code on your computer: install it yourself through ComfyUI's manager, and only a pack you trust. The pack downloads the model you choose to models/stt/whisper itself the first time it runs in ComfyUI.
The lesson builds the graph from an empty canvas: "File ▸ New project".
Load the recording
Add a Load Audio node and choose the file in its
audiofield.The clearer the speech, the fewer mistakes. Music under the voice confuses the model.
Add Whisper
Add a Apply Whisper node. Connect the output of Load Audio to its
audioinput and choose the model inmodel.The small models (
tiny,base) are fast and make more mistakes; the large ones (large-v3,turbo) are slower and much more accurate. Names that end in.enknow English only.turbois a good start.In
languagechoose the language of the speech, or leaveauto. Inpromptyou can list names and rare words that occur in the recording.Show the text
Add a Preview as Text node and connect the
textoutput of Apply Whisper to itssourceinput.In ComfyUI the node shows the written text right on the canvas.
Save the subtitles
Add a Save SRT node and connect the
segments_alignmentoutput of Apply Whisper to itsalignmentinput. In itsnamefield write the name of the file.The file goes into output/srt in the SRT format, which every video player and editor reads. The
words_alignmentoutput gives a line for every word, for subtitles that light up word by word.Video and mistakes (reading)
- To write down a video, load it with Load Video of Video Helper Suite: its
audiooutput goes into the same input of Apply Whisper, as in the pack's example. - Names are spelled wrong: write them in
prompt. - Text in another language: set
languageinstead ofauto.
The pack's license allows no commercial use. Read it before you use the pack for work.
- To write down a video, load it with Load Video of Video Helper Suite: its
The graph is ready (reading)
Save the graph with "File ▸ Save workflow for ComfyUI…", open the file in ComfyUI and run it there. This app runs nothing in ComfyUI itself.
What the lesson checks
A reading step is done when you press Got it, next. A doing step ticks itself off when the canvas holds:
- Step 2, Load the recording:
- a Load Audio node.
audioof Load Audio: a value is chosen.
- Step 3, Add Whisper:
- a Apply Whisper node.
AUDIOof Load Audio intoaudioof Apply Whisper.modelof Apply Whisper: a value is chosen.
- Step 4, Show the text:
- a Preview as Text node.
textof Apply Whisper intosourceof Preview as Text.
- Step 5, Save the subtitles:
- a Save SRT node.
segments_alignmentof Apply Whisper intoalignmentof Save SRT.nameof Save SRT: a value is chosen.