1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const axios = require('axios');
const fs = require('fs');
const path = require('path');
async function toB64(imgPath) {
const data = fs.readFileSync(path.resolve(imgPath));
return Buffer.from(data).toString('base64');
}
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/p-video-avatar";
const data = {
"image": "toB64('https://segmind-resources.s3.amazonaws.com/input/p-video-avatar-input-portrait.jpg')",
"voice_script": "Hi there! Welcome to Segmind, where a single photo becomes a lifelike, lip-synced talking avatar.",
"voice": "Zephyr (Female)",
"resolution": "720p",
"voice_language": "English (US)",
"video_prompt": "The person is talking to the camera with natural head movement and expressions.",
"voice_prompt": "Speak in a warm, friendly and welcoming tone.",
"negative_prompt": "subtitles, text, watermark, blurry, distorted face, extra fingers",
"strength_negative_prompt": 0.5,
"seed": 42,
"disable_safety_filter": true,
"disable_prompt_upsampling": false
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();First-frame portrait in jpg, jpeg, png or webp. Use a clean, front-facing headshot.
Text the avatar speaks when no audio is supplied. Keep sentences short.
Audio URL to lip-sync; overrides voice_script. Upload clean, music-free voice recordings.
One of 30 built-in TTS voices, used with voice_script. Match speaker gender.
Allowed values:
Output resolution, 720p or 1080p. Use 720p to iterate, 1080p for finals.
Allowed values:
Speech language for voice_script, ten options. Set it to match your script.
Allowed values:
Describes framing, motion and background. Keep simple; a fixed camera aids lip-sync.
Sets tone, pace and emotion, not the words. Try warm, confident, energetic.
Lists what to avoid in the video. Try subtitles, blurry, watermark.
Negative-prompt intensity from 0 to 4. Start near 0.5 and adjust.
min : 0,
max : 4
Random seed for reproducibility. Reuse a seed to repeat a result.
Toggles safety checks on prompts and image. Leave default unless needed.
Skips prompt enhancement when true. Enable for exact, literal prompt wording.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Pruna P Video Avatar is an image-to-video model that turns a single portrait into a lip-synced talking avatar. Give it one photo plus either a text script or an audio clip, and it returns an MP4 of that person speaking, with mouth movements, natural head motion, and expressions matched to the speech. Speech comes from built-in text-to-speech (30 voices, 10 languages) or your own uploaded audio, which takes priority when both are supplied. It works with real photos, illustrated characters, and stylized avatars, and outputs 720p or 1080p video.
P Video Avatar fits spokesperson-style content where you need a face to deliver a message without a studio or voice actor. Common uses include marketing and UGC-style ad variations, multilingual localization (one portrait, the same script in many languages), product walkthroughs and explainers, education, customer support avatars, and game character or NPC dialogue. In testing, a clean front-facing headshot with a plain background produced accurate lip-sync and preserved identity, making it well suited to virtual presenters and social-media avatars generated at scale.
Use a clear, well-lit, front-facing headshot; extreme angles or heavy shadows reduce lip-sync quality. Write scripts to be spoken, not read: short sentences and deliberate punctuation control pacing. Always set voice_language to match your script to avoid broken pronunciation. Keep video_prompt simple and the camera fixed for the tightest sync, and use voice_prompt for delivery. For custom audio, upload a clean, music-free recording. Test a short 5-to-10-second clip before scaling up.
What input do I need? A portrait image (jpg, jpeg, png, or webp) plus either a voice script or an audio file.
What if I provide both audio and a script? The uploaded audio takes priority and drives the lip-sync.
Does it work with illustrated or stylized characters? Yes, photorealistic photos, illustrated game characters, and stylized avatars all work.
How long can the video be? Pruna recommends keeping clips under three minutes; longer clips can show consistency drift.
How do I control the aspect ratio? Output matches the input image, so use a portrait image for vertical clips and a landscape image for 16:9.
Can I reproduce a result? Yes, set the same seed with the same inputs for repeatable output.