How to create an AI lip sync video with Codex MCP and Medux

Use Codex and Medux through MCP to synchronize a source avatar video with a new audio track. This guide covers input preparation, the approval gate, task monitoring, and a concrete output check.

Watch the complete workflow: AI avatar lip-sync generation with Codex, MCP, and Medux. Watch on YouTube ↗

Codex-specific workflow

Run AI Lip Sync Video as a Codex MCP task

Use the active workspace as the source of truth. Ask Codex to identify the source avatar video and driving audio, with each role clearly assigned, select the Medux lip-sync tool, and keep the Medux task ID and returned output with the rest of the project. Naming the input roles and the expected result prevents an agent from guessing which file should be used where.

Codex prompt pattern

In this workspace, use the Medux lip-sync tool through Medux MCP to create an AI lip sync video.
First inspect and identify the source avatar video and driving audio, with each role clearly assigned.
Show me the exact tool arguments before execution.
After the task completes, return the lip-synced MP4 and verify that mouth movement follows the driving speech and the full video and audio play correctly.

Approval gate

Before approving the call, compare the selected tool, file or asset IDs, ordering, timing, and output settings with the request. If a local filename was mapped to an uploaded Medux file ID, keep that mapping visible so it can be audited later.

Result verification

Let Codex monitor an asynchronous task until it reaches a terminal state, then save or report the lip-synced MP4. The final check is explicit: confirm that mouth movement follows the driving speech and the full video and audio play correctly.

Before you start

Keep the setup small. The operation video uses a short avatar clip and a WAV audio file, then asks Codex to operate Medux through the MCP connection.

1. A source avatar videoUse a clear front-facing or slightly angled video. The face should be visible, stable, and not heavily blocked by hands, captions, or UI overlays.
2. A speech audio fileUse a clean WAV or MP3 file. The audio drives the mouth timing, so avoid long silence, heavy background music, or overlapping voices.
3. Codex with MCP accessConnect Codex to the Medux MCP server using the configuration from your Medux account or internal setup guide.
4. A clear output nameSave the result with a simple name such as lip_synced_avatar.mp4 so it is easy to preview and reuse.
# Example project layout
project/
  avatar.mp4
  reference_voice.wav
  tts.txt
  config/
  output/

The Medux MCP flow

The operation is straightforward: Codex reads your goal, checks the files, chooses the Medux tools, uploads media, creates the generation task, polls the task status, and saves the final video locally.

Codex reads the request
MCP connects to Medux
Files are uploaded
Medux renders
MP4 is returned

Step-by-step tutorial

01

Open the project in Codex

Start inside the folder that contains your avatar video and audio file. In the operation video, Codex first checks the workspace so it knows exactly which files can be used for the Medux task.

Codex project screen with the lip-sync request
Codex receives the lip-sync request and prepares to inspect the local assets.
02

Connect Medux as an MCP tool

Make sure the Medux MCP server is enabled before asking Codex to run the workflow. Once MCP is connected, Codex can call Medux directly instead of making you switch dashboards or write a separate upload script.

Tip: Keep your API key outside the prompt. Store it in your local MCP configuration or environment variables.
# Example only: use the exact MCP config from your Medux account
export MEDUX_API_KEY="your_medux_api_key"

# Then start Codex in the folder that contains your media files
codex
03

Ask Codex to run the lip-sync job

Use one direct instruction. The best prompt names the input files, explains the goal, and tells Codex what to return. This keeps the tool call clean and reduces back-and-forth.

Use Medux through MCP to create a lip-synced avatar video.

Inputs:
- avatar.mp4
- reference_voice.wav

Please upload both files to Medux, create the required avatar source, generate a lip-and-tongue synced video from the audio, poll the task until it is complete, and download the final MP4 as output/lip_synced_avatar.mp4.
Codex checking files for the Medux lip-sync workflow
Codex reviews the workspace and prepares the assets for the Medux request.
04

Let Codex upload the media and create the source avatar

Codex uses the Medux MCP tools to create upload slots, send the video and audio, and prepare the avatar source. In practice, this is the part that replaces manual dashboard uploads.

Codex using Medux MCP tools to upload media
The video shows Codex moving through the upload and preparation phase.
05

Run the audio-driven talking-head task

After the avatar source is ready, Codex launches the generation task. Medux uses the video as the visual identity and the audio as the timing reference, then renders a synced output.

Codex creating the Medux lip-sync generation task
Codex starts the Medux generation task and keeps the workflow inside one interface.
06

Poll the task until Medux returns the result

Do not refresh manually. Codex can keep checking the Medux task status and continue only when the render is finished. This is especially useful for longer videos or higher-quality outputs.

Codex polling the Medux task status
Codex tracks the task status until Medux finishes rendering.
07

Download and preview the final MP4

When the task is complete, Codex downloads the output and saves it locally. Open the result and check three things: the mouth follows the audio, the face remains stable, and the final video plays from start to finish.

# Quick local check
ffprobe output/lip_synced_avatar.mp4

# Preview the generated video
open output/lip_synced_avatar.mp4
Preview of the final lip-synced avatar video
The final output is saved locally and can be previewed immediately.

Quality checklist

Use this checklist before publishing the result or adding it to a larger content workflow.

Face visibilityThe face should remain visible throughout the clip. Avoid shots where the mouth is covered or too small.
Audio claritySpeech should be clean and centered. Remove long silence before sending the audio to Medux.
Timing reviewWatch the first few seconds and a later section. Make sure the mouth still follows the voice after the midpoint.
Final exportUse a practical MP4 filename, then keep both the source files and the output in the same project folder for repeatability.

Publish-ready summary

Medux gives Codex a media workflow layer through MCP. For lip and tongue sync, Codex only needs the source video, the speech audio, and a clear instruction. Medux handles the rendering, while Codex handles the tool calls, task tracking, and final download.

No separate dashboard hopping
No manual API upload script
One prompt to final synced video

Example result

Final lip-sync result

Below is the final lip-synced avatar video generated by Medux after Codex completes the MCP workflow.

rst
Generated result. Final lip-sync video generated by Medux.

Quick answer

How do I run AI Lip Sync Video with Codex MCP?

Codex can use the Medux lip-sync tool through Medux MCP to synchronize a source avatar video with a new audio track. The workflow identifies the exact inputs, reviews the tool arguments, monitors processing, and verifies the returned result.

What does this Medux tutorial cover?

Codex can use the Medux lip-sync tool through Medux MCP to synchronize a source avatar video with a new audio track. The workflow identifies the exact inputs, reviews the tool arguments, monitors processing, and verifies the returned result.

Related topics: AI Lip Sync Video · AI Lip Sync Video with Codex MCP · Medux MCP tutorial