Video Merge Face
curl --request POST \
--url https://api.novita.ai/v3/async/video-merge-face \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"extra": {
"response_video_type": "<string>"
},
"request": {
"video_assets_id": "<string>",
"enable_restore": true,
"face_image_base64": "<string>"
}
}
'import requests
url = "https://api.novita.ai/v3/async/video-merge-face"
payload = {
"extra": { "response_video_type": "<string>" },
"request": {
"video_assets_id": "<string>",
"enable_restore": True,
"face_image_base64": "<string>"
}
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
extra: {response_video_type: '<string>'},
request: {
video_assets_id: '<string>',
enable_restore: true,
face_image_base64: '<string>'
}
})
};
fetch('https://api.novita.ai/v3/async/video-merge-face', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.novita.ai/v3/async/video-merge-face",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'extra' => [
'response_video_type' => '<string>'
],
'request' => [
'video_assets_id' => '<string>',
'enable_restore' => true,
'face_image_base64' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.novita.ai/v3/async/video-merge-face"
payload := strings.NewReader("{\n \"extra\": {\n \"response_video_type\": \"<string>\"\n },\n \"request\": {\n \"video_assets_id\": \"<string>\",\n \"enable_restore\": true,\n \"face_image_base64\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.novita.ai/v3/async/video-merge-face")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"extra\": {\n \"response_video_type\": \"<string>\"\n },\n \"request\": {\n \"video_assets_id\": \"<string>\",\n \"enable_restore\": true,\n \"face_image_base64\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/v3/async/video-merge-face")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"extra\": {\n \"response_video_type\": \"<string>\"\n },\n \"request\": {\n \"video_assets_id\": \"<string>\",\n \"enable_restore\": true,\n \"face_image_base64\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>"
}Face Editor
Video Merge Face
POST
/
v3
/
async
/
video-merge-face
Video Merge Face
curl --request POST \
--url https://api.novita.ai/v3/async/video-merge-face \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"extra": {
"response_video_type": "<string>"
},
"request": {
"video_assets_id": "<string>",
"enable_restore": true,
"face_image_base64": "<string>"
}
}
'import requests
url = "https://api.novita.ai/v3/async/video-merge-face"
payload = {
"extra": { "response_video_type": "<string>" },
"request": {
"video_assets_id": "<string>",
"enable_restore": True,
"face_image_base64": "<string>"
}
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
extra: {response_video_type: '<string>'},
request: {
video_assets_id: '<string>',
enable_restore: true,
face_image_base64: '<string>'
}
})
};
fetch('https://api.novita.ai/v3/async/video-merge-face', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.novita.ai/v3/async/video-merge-face",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'extra' => [
'response_video_type' => '<string>'
],
'request' => [
'video_assets_id' => '<string>',
'enable_restore' => true,
'face_image_base64' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.novita.ai/v3/async/video-merge-face"
payload := strings.NewReader("{\n \"extra\": {\n \"response_video_type\": \"<string>\"\n },\n \"request\": {\n \"video_assets_id\": \"<string>\",\n \"enable_restore\": true,\n \"face_image_base64\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.novita.ai/v3/async/video-merge-face")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"extra\": {\n \"response_video_type\": \"<string>\"\n },\n \"request\": {\n \"video_assets_id\": \"<string>\",\n \"enable_restore\": true,\n \"face_image_base64\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/v3/async/video-merge-face")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"extra\": {\n \"response_video_type\": \"<string>\"\n },\n \"request\": {\n \"video_assets_id\": \"<string>\",\n \"enable_restore\": true,\n \"face_image_base64\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>"
}This API endpoint seamlessly integrates a face image into a target video, allowing you to replace the face in the video with the face from the image.
Pricing: $0.0005 / Video Frame
Request Headers
string
required
Enum:
application/jsonstring
required
Bearer authentication format, for example: Bearer {{API Key}}.
Request Body
object
Optional extra parameters for the request.
Show properties
Show properties
string
The returned video type. Default is mp4.
Enum:
Enum:
mp4, gifobject
required
Hide properties
Hide properties
string
required
Upload your input video to our temporary secure storage following the instructions in the guide Get video assets id, and the video_assets_id is the identifier for your input video. Supported video formats: MP4, with a maximum resolution of 3840 x 2160 and a maximum file size of 100 Mb.
boolean
required
Whether to restore the output face image. If enabled, the output face video will be more detailed, but the API latency will be longer.
string
required
The base64-encoded face image, with a maximum resolution of 2048 x 2048 and a maximum file size of 30 MB.
Response
string
Use the task_id to request the Task Result API to retrieve the generated outputs.
Example
1. Get Video Assets ID
Request:
curl -X PUT -T "{{video file path}}" 'https://assets.novitai.com/video'
Response:
{
"assets_id": "cjIvbm92aXRhLWFpLWFzc2V0L3ZpZGVvL0NLd0N3aHJwS0ZyYVduNWVoejVFV0tleGlzN0toNmRq"
}
Last modified on December 26, 2024
Was this page helpful?
⌘I