Help home
Using the app
Heartisan Studio
Setup & settings
Back to heartisan.app
Client portal

ComfyUI & lip sync

Heartisan Studio

Heartisan Studio draws pictures and lip-syncs dubs with ComfyUI, a node editor for AI models that runs on your own computer. You can leave it working in the background, or open it in a tab of Heartisan Studio and change how it works.

Lip-syncing a dub

A dub gives a recording a spoken track in another language, but the speaker's mouth still moves to the original words. Lip sync redraws the mouth to match the dub, so members watching in Spanish see the pastor speaking Spanish.

  1. Dub the recording first (see Producing a spoken track). Lip sync draws to that dub.
  2. Tick the recordings in the media list and choose Lip sync video… from the selection's menu, or Lip sync in the Processing group of the Media content tab.
  3. Choose the languages and start.
  • The recording is lip-synced 8 seconds at a time. If the camera is on the band, the screen or the congregation, there is no mouth to redraw, so that stretch keeps its picture with the dub playing over it. A face lost for under half a second (a turn of the head) doesn't count. A stretch with nobody speaking is skipped.
  • It is slow: each 8 seconds takes about two and a half minutes on an RTX 3090, so an hour-long recording takes most of a night. Where several computers work together, different recordings and languages are shared between them.
  • If it is stopped, starting it again carries on from where it got to.
  • The lip-synced picture is made at 720p and 360p. A member who has chosen 1080p and that language sees it at 720p.

Members do not need to do anything. Choosing the language in the player shows the lip-synced picture. Choosing another language goes back to the original picture with that language's audio.

Lip sync needs an NVIDIA graphics card with about 20 GB of memory (an RTX 3090 or 4090, for example). It does not run on a Mac. A computer without one can still send the work to one that has, through the processing fleet.

Setting it up

On the computer with the graphics card, go to File → Processing tools and press Add beside Lip sync dubs. This installs ComfyUI if it is not there already, then the LatentSync nodes, which are a few hundred megabytes. The LatentSync model, about 7 GB, is downloaded the first time it runs.

LatentSync 1.6 is published by ByteDance. Its code is Apache 2.0 and its weights are under OpenRAIL++, which allows commercial use with some restrictions on what it may be used for. Read its licence against your own use. Heartisan Studio finds the faces with Google's MediaPipe (Apache 2.0) instead of the face models LatentSync normally uses, which are licensed for non-commercial research only.

Changing parts of a video

In the clip editor, you can send stretches of a video through ComfyUI workflows, and the result replaces that stretch's picture. The sound stays as it was, and the video stays the same length. Different stretches can use different workflows, so you can use ComfyUI's community nodes for upscaling, face restoration, smoother motion, background changes, a different look, and so on.

  1. Select the stretches as you would to cut them: Mark in and Mark out, then Add to selection, or a plan item or slide on the timeline. Select as many as you like.
  2. Choose a workflow in the Workflow box in the ribbon's ComfyUI group.
  3. Press Send selection. Each stretch becomes a part on the ComfyUI row of the timeline, and they all start being made at once.
  • Click a part to see it in the ComfyUI panel beside the video. There you can change its workflow, add more workflows after it (Then…), and type a prompt for workflows that take one.
  • With more than one workflow, each is given what the one before it made. For example, an upscaler then a smoother.
  • Pieces of … seconds sets how much video goes to ComfyUI at a time. Many video models take only a few seconds, and ComfyUI holds every frame of a piece in memory.
  • Drag a part's edges on the timeline to change it. Only parts you change are made again.
  • Watch part plays what was made. It is laid over the recording when the edited copy is built (when you close the editor, or when an imported clip is made). A part not made by then is made first.
  • If there is a processing fleet, each part is sent to it as a job of its own, so several computers can make different parts at the same time. Make here makes one on this computer instead. Without a fleet, this computer makes the parts one after another.

Trying a part in ComfyUI

Press the open button beside one of a part's workflows (or Open in ComfyUI in the ribbon). The ComfyUI tab opens with that workflow on the canvas and the first few seconds of the part already in its video loader. Change it, add community nodes and press ComfyUI's Run as often as you like. When you're happy, press Save to Heartisan Studio (at the bottom of ComfyUI). Name it in the bar that appears and press Keep and use for the part. The part now uses your workflow, and it opens as you left it next time. Back to the clip editor returns you to the part.

Heartisan Studio ships Sharpen, built only from ComfyUI's own nodes, as a starting point: open it, replace the Sharpen node with whatever you want done to the picture, and save it back.

Install community nodes with ComfyUI's own Manager. If a workflow uses nodes that aren't installed, the part says which ones, rather than failing part-way. Each fleet computer that makes parts needs the same nodes installed in its ComfyUI.

Opening ComfyUI in Heartisan Studio

Press ComfyUI in the On this computer group of the Home tab. ComfyUI opens in a tab of its own, and you can start it there if it is not running. It is the same ComfyUI that draws your pictures and lip-syncs your dubs, so anything you try there is tried on what the jobs will use.

  • The tab keeps your place: moving to another tab and back doesn't reload it. Reload does, and anything not saved in ComfyUI is lost.
  • Open in browser opens the same ComfyUI in your web browser, in a window of its own.
  • Stop closes the ComfyUI that Heartisan Studio started and frees the graphics card. Pictures and lip sync start it again when they need it.
  • ComfyUI only opens inside the tab when Heartisan Studio started it. If it was started some other way, the tab says so and offers Restart ComfyUI. A ComfyUI on another computer opens in your browser instead.

If ComfyUI runs on another computer, put its address under File → Processing tools → Advanced → Pictures: model and address. The tab, pictures and lip sync then all use that computer.

Using a workflow of your own

You can change how pictures are drawn or how lip sync is done (for example, use a different lip-sync model) by building a workflow in ComfyUI and giving it to Heartisan Studio.

In the ComfyUI tab, Save to Heartisan Studio does all of this in one step, for any workflow: it is kept as your own and offered wherever it fits. The steps below are for a ComfyUI opened in your browser or on another computer.

  1. Build or change the workflow in ComfyUI. To start from the one Heartisan Studio uses, go to Processing tools → Advanced → Lip sync: workflow, press Show the shipped workflow and drag the file onto ComfyUI's canvas.
  2. Give the nodes Heartisan Studio fills in the titles below. Right-click a node and choose Title.
  3. In ComfyUI choose Workflow → Export (API). Use the API export: ComfyUI's ordinary save will not be accepted.
  4. In Processing tools → Advanced → Pictures: model and address, press Add a workflow… and choose the file. It is chosen straight away for what it does.

The titles Heartisan Studio looks for

Studio video
Lip sync and video parts: the node that loads the video. Heartisan Studio puts each piece of the recording here. A workflow with this title and no Studio audio is offered for parts of a video.
Studio audio
Lip sync: the node that loads the audio. Heartisan Studio puts the matching stretch of the dub here. In a video part's workflow it gets the part's own sound. In a sound workflow it gets the selected part of the recording, if the workflow changes sound.
Studio result
Lip sync, video parts and carrying a picture on: the node that saves the finished video. If no node has this title, the first video saved is used. A sound workflow's result is the first sound it saves.
Studio prompt
Pictures: the text box for what to draw. Video parts, sound and carrying a picture on: the words typed for it, if any were typed. A workflow that saves a video and has only this title is a clip from words, used for b-roll in the editor's B-roll panel.
Studio negative
Pictures and video parts: the text box for what to avoid (optional).
Studio size
Pictures: the node with the width and height (optional).
Studio length
Sound: the node that takes how many seconds to make (optional).
Studio lyrics
Sound: the node that takes the words to sing (optional). ComfyUI's own music templates need no titles at all: their lyrics, style and length are found by the nodes they are made of.
Studio text
Animated titles: the node that holds the title's first line. A workflow that saves a video and has this title is listed as an animated title and offered in the editor's Title panel; its plain ground is made transparent over the video.
Studio subtitle
Animated titles: the node that holds the second line (the role, the verse). Optional.
Studio image
Carrying a picture on: the node that loads the picture. Heartisan Studio puts the frame at the playhead here; the workflow must save a video.

A workflow that saves sound is recognised as a sound workflow, and one with a Studio image node that saves a video as a carry-on workflow; both are used from the editor's Sound (ComfyUI) and Carry on panels. See Sound from ComfyUI and Carry a video's picture on.

Every seed in a picture workflow is changed each time, so each picture is different. A video part's seeds are left as they are, so it comes out as it did when you tried it in ComfyUI. Neither a lip-sync workflow nor a video part's needs to add sound: Heartisan Studio keeps the sound itself. A video part's result is fitted back to the part's size, frame rate and length.

A workflow of your own is only used on the computer you added it to. If you use a different lip-sync model, its licence is between you and its publisher, and any nodes it needs have to be installed in ComfyUI on every computer that runs it.

If lip sync doesn't work

"ComfyUI does not have these nodes"
The workflow uses nodes that aren't installed. For the shipped workflow, press Add (or Repair the nodes) under Processing tools. For your own, install them in ComfyUI.
"No piece could be lip-synced"
Every piece failed, and nothing was added. Open the ComfyUI tab, drag the shipped workflow in and run it on a short clip to see ComfyUI's own error. The usual causes are a card without enough memory, or a recording where the speaker's face is too small or never in shot.
Some stretches are not lip-synced
That is expected wherever no face is in shot. The rest of the recording still is.
The language isn't offered
Lip sync offers the languages switched on for spoken audio on the dashboard, and a recording needs its dub first.