Skip to content
Developer Portal

p-video-2-pro-replace

Replace the person in a video with the person from a picture

P-Video-2-Pro-Replace puts the person from a picture into a source video. The camera, framing, background, other people, timing and motion of the video stay as they are, and the source soundtrack is kept: the new person's lips follow the original audio. Give one picture to replace the main person, or two pictures and an instruction_prompt saying who replaces whom. Videos from 1 to 120 seconds, output at 480p, 768p, 1080p, 2k or 4k, 24 fps.

Rate Limit: 50 requests per minute

Category: Video Editing

Pricing:

ConfigurationPrice
480p$0.05 per second of output video
768p$0.10 per second of output video
1080p$0.12 per second of output video
2k$0.14 per second of output video
4k$0.18 per second of output video

The output is as long as the source video, so a 10 second video costs $0.50 at 480p, $1.00 at 768p or $1.80 at 4k. 1080p, 2k and 4k generate at 768p and upscale it with p-video-upscale (24 fps kept), at the 768p rate plus the p-video-upscale rate for that target, and take longer: a 10 second video took about 2.5 minutes at 1080p and 4 minutes at 4k. The length is counted in whole seconds. The number of pictures, the instruction and the audio settings do not change the price.

Upload local files with POST /v1/files and pass the returned URLs.

Terminal window
curl -X POST 'https://api.pruna.ai/v1/files' \
-H 'apikey: YOUR_API_KEY' \
-F 'content=@source.mp4'

A 10 second video takes about 1.5 to 2 minutes, so start the request and poll its status.

Terminal window
curl -X POST 'https://api.pruna.ai/v1/predictions' \
-H 'Content-Type: application/json' \
-H 'apikey: YOUR_API_KEY' \
-H 'Model: p-video-2-pro-replace' \
-d '{
"input": {
"video": "https://api.pruna.ai/v1/files/source-video-abc123",
"images": ["https://api.pruna.ai/v1/files/new-person-def456"],
"resolution": "768p"
}
}'

Response:

{
"id": "1zww7deyssrme0csqwr90phzzr",
"model": "p-video-2-pro-replace",
"input": { ... },
"get_url": "https://api.pruna.ai/v1/predictions/status/1zww7deyssrme0csqwr90phzzr"
}

Check status and get the result:

Terminal window
curl -X GET 'https://api.pruna.ai/v1/predictions/status/1zww7deyssrme0csqwr90phzzr' \
-H 'apikey: YOUR_API_KEY'

Pass one picture per person and say who is who in instruction_prompt, in your own words:

{
"input": {
"video": "https://api.pruna.ai/v1/files/two-dancers-abc123",
"images": [
"https://api.pruna.ai/v1/files/woman-def456",
"https://api.pruna.ai/v1/files/man-ghi789"
],
"instruction_prompt": "The dancer on the left becomes the woman from image 1, the one on the right the man from image 2."
}
}

Without an instruction, the two pictures are matched to the people in the video from left to right.

ParameterTypeDescription
videostringSource video URL (MP4, MOV or WebM, 1–120 s, up to 8K). Motion, scene and audio come from it. Longer videos are cut to 120 s
imagesarray[string]1 or 2 picture URLs: one person, or two people with one picture each. Extra pictures are ignored
ParameterTypeDefaultDescription
instruction_promptstring""Who replaces whom, or other placement instructions
resolutionstring"768p""480p", "768p", "1080p", "2k" or "4k" (aspect ratio kept). 1080p, 2k and 4k are upscaled from 768p
save_audiobooleantrueKeep the source soundtrack in the output
ignore_audiobooleanfalseGenerate without listening to the source audio (lips then don't follow it). With save_audio, the soundtrack is still added to the output
enable_safety_filterbooleantrueCheck the inputs against the content policy. When false, only sexual content involving minors and self-harm are blocked
seedintegerrandomRandom seed for reproducible results
  • Videos must have an aspect ratio between 1:4 and 4:1. Problems with the uploads (a video that does not decode, shorter than 1 second or above 8K, a picture that does not decode) are returned as errors before generation starts.
  • The output is 24 fps and as long as the source.
  • Expressions and lip movements follow the source video. When the new person looks very similar to the person in the video, the model hides the source face so that the new identity comes through; expressions are then carried by the body pose and the audio.