Before you start
The video uses a simple two-asset setup. Keep the filenames easy to reference so Codex can plan the flow without extra clarification.
Use a video that contains the person you want to replace. In the demo, the file is named character.mp4.
Use a clear character image as the replacement target. In the demo, the file is named character.jpg.
project/
├── character.mp4 # source video with the original person
└── character.jpg # reference character image for replacement
Workflow overview
The whole task can be summarized as five steps.
Give Codex a focused instruction
Tell Codex exactly which video to process, which image to use as the character reference, and how the files should be uploaded. This avoids a vague creative prompt and turns the task into an executable media workflow.
Perform a video character replacement by replacing the person in character.mp4 with the character from character.jpg. Upload the files using curl commands.

Let Codex inspect the workspace and choose the Medux path
Codex checks the project files, looks for existing upload or replacement scripts, and confirms the Medux API flow. In the demo, Codex finds a direct path: generate fresh upload URLs, upload both local files, submit the character replacement task, and poll it to completion.

Approve the Medux MCP upload and replacement calls
Codex asks for permission before it runs Medux tools. First it creates upload URLs for the video and image. Then it uploads the assets with curl. After both uploads return successfully, Codex submits the replacement job.
# Example upload shape. The real URL is generated by Medux.
curl -X PUT "<MEDUX_PRESIGNED_UPLOAD_URL>" -H "Content-Type: video/mp4" --upload-file "character.mp4"
curl -X PUT "<MEDUX_PRESIGNED_UPLOAD_URL>" -H "Content-Type: image/jpeg" --upload-file "character.jpg"
For the replacement request, Codex passes the uploaded file IDs into the Medux video character replacement tool.
medux_video_character_replacement(
source_video_file_id="<uploaded_video_file_id>",
target_character_image_file_id="<uploaded_image_file_id>",
title="character.mp4 character replacement"
)

Poll the Medux task until the render is ready
Video generation takes longer than a quick image edit, so Codex keeps checking the same task instead of restarting it. The status moves from QUEUED to PROCESSING, then finishes when Medux returns the output URL.
# Status flow shown in the tutorial
QUEUED → PROCESSING → SUCCEEDED

Download and verify the final video
When the task succeeds, Medux returns the final MP4 URL. Codex downloads the result into the workspace and verifies the output. In the demo, the finished file is saved as character_replacement_result.mp4.
# Example result step
curl -L "<MEDUX_RESULT_VIDEO_URL>" -o "character_replacement_result.mp4"
# Optional local check
ffprobe -v error -show_entries format=duration,size -of default=noprint_wrappers=1 "character_replacement_result.mp4"

Why this workflow is useful
Medux handles the AI rendering, while Codex handles the operating work: checking assets, creating upload targets, running the correct MCP tool, tracking the job, and saving the final video. The result is a repeatable video character replacement workflow without a separate upload dashboard or custom API script.
Example result
src / tgt / rst demonstration
Below is the complete character-replacement example: src is the original source video, tgt is the reference character, and rst is the final video generated by Medux.

Explore related workflows
Continue with a nearby Medux workflow or compare how the same task works across Claude MCP and Codex MCP.