マルチモーダル動画編集
Kling 動画選択を削除
CometAPI 経由で Kling の動画選択削除 API を使用し、マルチ要素動画編集における選択要素を削除して、マルチモーダルな動画ワークフローをサポートします。
POST
/
kling
/
v1
/
videos
/
multi-elements
/
delete-selection
cURL
curl https://api.cometapi.com/kling/v1/videos/multi-elements/delete-selection \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "<session_id>",
"frame_index": 1,
"points": [
{
"x": 0.5,
"y": 0.5
}
]
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/kling/v1/videos/multi-elements/delete-selection",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"session_id": "<session_id>",
"frame_index": 1,
"points": [
{
"x": 0.5,
"y": 0.5
}
]
},
)
result = response.json()
print(result.get("code"), result.get("data"))const response = await fetch("https://api.cometapi.com/kling/v1/videos/multi-elements/delete-selection", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"session_id": "<session_id>",
"frame_index": 1,
"points": [
{
"x": 0.5,
"y": 0.5
}
]
}),
});
const result = await response.json();
console.log(result.code, result.data);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/kling/v1/videos/multi-elements/delete-selection",
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([
'session_id' => '<session_id>',
'frame_index' => 1,
'points' => [
[
'x' => 0.5,
'y' => 0.5
]
]
]),
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/multi-elements/delete-selection"
payload := strings.NewReader("{\n \"session_id\": \"<session_id>\",\n \"frame_index\": 1,\n \"points\": [\n {\n \"x\": 0.5,\n \"y\": 0.5\n }\n ]\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/multi-elements/delete-selection")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"session_id\": \"<session_id>\",\n \"frame_index\": 1,\n \"points\": [\n {\n \"x\": 0.5,\n \"y\": 0.5\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/kling/v1/videos/multi-elements/delete-selection")
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 \"session_id\": \"<session_id>\",\n \"frame_index\": 1,\n \"points\": [\n {\n \"x\": 0.5,\n \"y\": 0.5\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"message": "<string>",
"data": {}
}このユーティリティエンドポイントを使用すると、現在の編集領域を再構築または破棄する前に、マルチモーダルな編集セッションから選択状態を削除できます。
使用するタイミング
- 現在の選択記録をそのまま使い続けるのではなく、削除したい場合
- 新しい対象領域をマークする前に、編集パスをクリーンアップしたい場合
ワークフロー上の役割
- 動画編集用に初期化 で取得した
session_idが必要です - 削除したい選択ポイントに対して、
frame_indexと 0〜1 の割合で表したpointsが必要です - 通常は 動画選択を追加 に続くか、生成せずにセッションを終了します
完全なパラメータリファレンスについては、Kling API documentation を参照してください。
承認
Bearer token authentication. Use your CometAPI key.
ボディ
application/json
⌘I
cURL
curl https://api.cometapi.com/kling/v1/videos/multi-elements/delete-selection \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "<session_id>",
"frame_index": 1,
"points": [
{
"x": 0.5,
"y": 0.5
}
]
}'import os
import requests
response = requests.post(
"https://api.cometapi.com/kling/v1/videos/multi-elements/delete-selection",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"session_id": "<session_id>",
"frame_index": 1,
"points": [
{
"x": 0.5,
"y": 0.5
}
]
},
)
result = response.json()
print(result.get("code"), result.get("data"))const response = await fetch("https://api.cometapi.com/kling/v1/videos/multi-elements/delete-selection", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"session_id": "<session_id>",
"frame_index": 1,
"points": [
{
"x": 0.5,
"y": 0.5
}
]
}),
});
const result = await response.json();
console.log(result.code, result.data);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/kling/v1/videos/multi-elements/delete-selection",
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([
'session_id' => '<session_id>',
'frame_index' => 1,
'points' => [
[
'x' => 0.5,
'y' => 0.5
]
]
]),
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/multi-elements/delete-selection"
payload := strings.NewReader("{\n \"session_id\": \"<session_id>\",\n \"frame_index\": 1,\n \"points\": [\n {\n \"x\": 0.5,\n \"y\": 0.5\n }\n ]\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/multi-elements/delete-selection")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"session_id\": \"<session_id>\",\n \"frame_index\": 1,\n \"points\": [\n {\n \"x\": 0.5,\n \"y\": 0.5\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/kling/v1/videos/multi-elements/delete-selection")
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 \"session_id\": \"<session_id>\",\n \"frame_index\": 1,\n \"points\": [\n {\n \"x\": 0.5,\n \"y\": 0.5\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"message": "<string>",
"data": {}
}