Kling
Kling 립싱크용 얼굴 식별
Kling Lip-Sync API (POST /kling/v1/videos/identify-face)를 사용해 비디오에서 얼굴을 감지하고 정확한 립싱크 비디오 생성 워크플로를 구동합니다.
POST
/
kling
/
v1
/
videos
/
identify-face
cURL
curl https://api.cometapi.com/kling/v1/videos/identify-face \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"video_url": "https://your-video-host/source.mp4"
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/kling/v1/videos/identify-face",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"video_url": "https://your-video-host/source.mp4"
},
)
result = response.json()
print(result.get("code"), result.get("data", {}).get("session_id"))const response = await fetch("https://api.cometapi.com/kling/v1/videos/identify-face", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"video_url": "https://your-video-host/source.mp4"
}),
});
const result = await response.json();
console.log(result.code, result.data?.session_id);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/kling/v1/videos/identify-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([
'video_url' => 'https://your-video-host/source.mp4'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.cometapi.com/kling/v1/videos/identify-face"
payload := strings.NewReader("{\n \"video_url\": \"https://your-video-host/source.mp4\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.cometapi.com/kling/v1/videos/identify-face")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"video_url\": \"https://your-video-host/source.mp4\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/kling/v1/videos/identify-face")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"video_url\": \"https://your-video-host/source.mp4\"\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"message": "<string>",
"request_id": "<string>",
"data": {
"session_id": "<string>",
"face_data": [
{
"face_id": "<string>",
"face_image": "<string>",
"start_time": 123,
"end_time": 123
}
]
}
}이 엔드포인트를 사용하면 후속 립싱크 워크플로를 실행하기 전에 원본 비디오에서 얼굴을 식별할 수 있습니다.
이 경로가 반환하는 항목
- 현재 얼굴 감지 결과를 그룹화하는
session_id - 하나 이상의 감지된 얼굴을 포함하는
face_data배열 face_id, 미리보기 이미지, 시간 범위와 같은 얼굴별 메타데이터
사용 시점
- 소스는 정확히 하나만 전송합니다: 완료된 Kling 비디오에는
video_id, 호스팅된 MP4 또는 MOV에는video_url - 화면에 여러 사람이 있는 비디오에 대해 립싱크 요청을 만들기 전에
- 자동 선택에 의존하지 않고 특정 얼굴을 선택해야 할 때
- 더 비용이 큰 작업을 시작하기 전에 얼굴 범위를 미리 확인하고 싶을 때
전체 파라미터 참조는 공식 Kling 문서를 참고하세요.
인증
Bearer token authentication. Use your CometAPI key.
본문
application/json
⌘I
cURL
curl https://api.cometapi.com/kling/v1/videos/identify-face \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"video_url": "https://your-video-host/source.mp4"
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/kling/v1/videos/identify-face",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"video_url": "https://your-video-host/source.mp4"
},
)
result = response.json()
print(result.get("code"), result.get("data", {}).get("session_id"))const response = await fetch("https://api.cometapi.com/kling/v1/videos/identify-face", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"video_url": "https://your-video-host/source.mp4"
}),
});
const result = await response.json();
console.log(result.code, result.data?.session_id);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/kling/v1/videos/identify-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([
'video_url' => 'https://your-video-host/source.mp4'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.cometapi.com/kling/v1/videos/identify-face"
payload := strings.NewReader("{\n \"video_url\": \"https://your-video-host/source.mp4\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.cometapi.com/kling/v1/videos/identify-face")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"video_url\": \"https://your-video-host/source.mp4\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/kling/v1/videos/identify-face")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"video_url\": \"https://your-video-host/source.mp4\"\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"message": "<string>",
"request_id": "<string>",
"data": {
"session_id": "<string>",
"face_data": [
{
"face_id": "<string>",
"face_image": "<string>",
"start_time": 123,
"end_time": 123
}
]
}
}