> For the complete documentation index, see [llms.txt](https://doc.ozforensics.com/oz-knowledge-ru/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.ozforensics.com/oz-knowledge-ru/rukovodstva/rukovodstvo-razrabotchika/sdk/websdk/web-plugin/zapusk-plagina/semka-video-i-opisanie-kollbeka-on_capture_complete.md).

# Съемка видео и описание колбэка on\_capture\_complete

В этом разделе вы узнаете, как снимать видео и отправлять его Oz API через ваш бэкенд.

## 1. Обзор <a href="#h.azejp0s1y9bu" id="h.azejp0s1y9bu"></a>

Режим capture работает следующим образом:

1\. Oz Web SDK снимает видео и передает его вашему web-приложению в виде **последовательности кадров**.

2\. Web-приложение вызывает ваш бэкэнд и передает в него архив с кадрами.

3\. После обработки видео ваш бэкэнд вызывает Oz API для выполнения анализов, после чего получает их результаты.

4\. Ваш бэкэнд передает результаты обратно в web-приложение (опционально).

<figure><img src="https://2041336905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHLoHbtSPFA1Ul7oKM5SC%2Fuploads%2FUZ7ANBZb3apGvZFZ2zDr%2Fcomponents-public-webplugin-capturemode.svg?alt=media&amp;token=3eafd3e4-6bf3-49d4-b17b-86ef7637e4c9" alt=""><figcaption></figcaption></figure>

## 2. Реализация <a href="#h.rhefdg38l526" id="h.rhefdg38l526"></a>

На стороне сервера необходимо сконфигурировать Web SDK для работы в режиме capture: [установить](/oz-knowledge-ru/rukovodstva/rukovodstvo-administratora/web-adapter.md#nastroiki-faila-konfiguracii-oz-liveness-web-adapter) параметру `architecture` в файле app\_config.json значение `capture`.

В вашем web-приложении добавьте callback-функцию для обработки кадров при открытии [плагина](/oz-knowledge-ru/rukovodstva/rukovodstvo-razrabotchika/sdk/websdk/web-plugin.md) Web SDK:

```php
OZLiveness.open({
  ... // другие параметры
  on_capture_complete: function(result) {
         // Код для обработки кадров / отправки его через ваш API, шаг 2 на схеме
  }
})
```

Структура получаемого объекта зависит от того, была ли обнаружена виртуальная камера.

### Виртуальная камера не обнаружена

```php
{
	"action": <action>,
	"best_frame": <bestframe>,
	"best_frame_png": <bestframe_png>,
	"best_frame_bounding_box": {
		"left": <bestframe_bb_left>,
		"top": <bestframe_bb_top>,
		"right": <bestframe_bb_right>,
		"bottom": <bestframe_bb_bottom>
		},
	"best_frame_landmarks": {
		"left_eye": [bestframe_x_left_eye, bestframe_y_left_eye],
		"right_eye": [bestframe_x_right_eye, bestframe_y_right_eye],
		"nose_base": [bestframe_x_nose_base, bestframe_y_nose_base],
		"mouth_bottom": [bestframe_x_mouth_bottom, bestframe_y_mouth_bottom],
		"left_ear": [bestframe_x_left_ear, bestframe_y_left_ear],
		"right_ear": [bestframe_x_right_ear, bestframe_y_right_ear]
		},
	"frame_list": [<frame1>, <frame2>],
	"frame_bounding_box_list": [
		{
		"left": <frame1_bb_left>,
		"top": <frame1_bb_top>,
		"right": <frame1_bb_right>,
		"bottom": <frame1_bb_bottom>
		},
		{
		"left": <frame2_bb_left>,
		"top": <frame2_bb_top>,
		"right": <frame2_bb_right>,
		"bottom": <frame2_bb_bottom>
		},
	],
	"frame_landmarks": [
		{
		"left_eye": [frame1_x_left_eye, frame1_y_left_eye],
		"right_eye": [frame1_x_right_eye, frame1_y_right_eye],
		"nose_base": [frame1_x_nose_base, frame1_y_nose_base],
		"mouth_bottom": [frame1_x_mouth_bottom, frame1_y_mouth_bottom],
		"left_ear": [frame1_x_left_ear, frame1_y_left_ear],
		"right_ear": [frame1_x_right_ear, frame1_y_right_ear]
		},
		{
		"left_eye": [frame2_x_left_eye, frame2_y_left_eye],
		"right_eye": [frame2_x_right_eye, frame2_y_right_eye],
		"nose_base": [frame2_x_nose_base, frame2_y_nose_base],
		"mouth_bottom": [frame2_x_mouth_bottom, frame2_y_mouth_bottom],
		"left_ear": [frame2_x_left_ear, frame2_y_left_ear],
		"right_ear": [frame2_x_right_ear, frame2_y_right_ear]
		}
	],
"from_virtual_camera": null,
"additional_info": <additional_info>
}
```

### Виртуальная камера обнаружена

```php
{
	"action": <action>,
	"best_frame": null,
	"best_frame_png": null,
	"best_frame_bounding_box": null,
	"best_frame_landmarks": null
	"frame_list": null,
	"frame_bounding_box_list": null,
	"frame_landmarks": null,
	"from_virtual_camera": {
	"additional_info": <additional_info>,
		"best_frame": <bestframe>,
		"best_frame_png": <bestframe_png>,
		"best_frame_bounding_box": {
			"left": <bestframe_bb_left>,
			"top": <bestframe_bb_top>,
			"right": <bestframe_bb_right>,
			"bottom": <bestframe_bb_bottom>
			},
		"best_frame_landmarks": {
			"left_eye": [bestframe_x_left_eye, bestframe_y_left_eye],
			"right_eye": [bestframe_x_right_eye, bestframe_y_right_eye],
			"nose_base": [bestframe_x_nose_base, bestframe_y_nose_base],
			"mouth_bottom": [bestframe_x_mouth_bottom, bestframe_y_mouth_bottom],
			"left_ear": [bestframe_x_left_ear, bestframe_y_left_ear],
			"right_ear": [bestframe_x_right_ear, bestframe_y_right_ear]
			},
		"frame_list": [<frame1>, <frame2>],
		"frame_bounding_box_list": [
			{
			"left": <frame1_bb_left>,
			"top": <frame1_bb_top>,
			"right": <frame1_bb_right>,
			"bottom": <frame1_bb_bottom>
			},
			{
			"left": <frame2_bb_left>,
			"top": <frame2_bb_top>,
			"right": <frame2_bb_right>,
			"bottom": <frame2_bb_bottom>
			},
			],
		"frame_landmarks": [
			{
			"left_eye": [frame1_x_left_eye, frame1_y_left_eye],
			"right_eye": [frame1_x_right_eye, frame1_y_right_eye],
			"nose_base": [frame1_x_nose_base, frame1_y_nose_base],
			"mouth_bottom": [frame1_x_mouth_bottom, frame1_y_mouth_bottom],
			"left_ear": [frame1_x_left_ear, frame1_y_left_ear],
			"right_ear": [frame1_x_right_ear, frame1_y_right_ear]
			},
			{
			"left_eye": [frame2_x_left_eye, frame2_y_left_eye],
			"right_eye": [frame2_x_right_eye, frame2_y_right_eye],
			"nose_base": [frame2_x_nose_base, frame2_y_nose_base],
			"mouth_bottom": [frame2_x_mouth_bottom, frame2_y_mouth_bottom],
			"left_ear": [frame2_x_left_ear, frame2_y_left_ear],
			"right_ear": [frame2_x_right_ear, frame2_y_right_ear]
			}
		]
	}
}
```

Список переменных с их значениями приведен ниже.

| Переменная                | Тип                                        | Описание                                                                                                                                    |
| ------------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `best_frame`              | String                                     | Лучший кадр, JPEG в формате data URL                                                                                                        |
| `best_frame_png`          | String                                     | Лучший кадр, PNG в формате data URL                                                                                                         |
| `best_frame_bounding_box` | Array\[Named\_parameter: Int]              | Координаты прямоугольника, в который вписано лицо на лучшем кадре                                                                           |
| `best_frame_landmarks`    | Array\[Named\_parameter: Array\[Int, Int]] | Координаты "ориентиров" лица (левый глаз, правый глаз, нос, рот, левое ухо, правое ухо) на лучшем кадре                                     |
| `frame_list`              | Array\[String]                             | Все кадры в формате data URL                                                                                                                |
| `frame_bounding_box_list` | Array\[Array\[Named\_parameter: Int]]      | Координаты прямоугольников, в которые вписано лицо на кадрах из `frame_list` в соответствующем порядке                                      |
| `frame_landmarks`         | Array\[Named\_parameter: Array\[Int, Int]] | Координаты "ориентиров" лица (левый глаз, правый глаз, нос, рот, левое ухо, правое ухо) на кадрах из `frame_list` в соответствующем порядке |
| `action`                  | String                                     | Код действия                                                                                                                                |
| `additional_info`         | String                                     | Информация о среде клиента                                                                                                                  |

### Обратите внимание:

* Видео, полученное через Oz Web SDK, — это последовательность кадров. Чтобы отправить его Oz API, поместите кадры в ZIP-архив, затем используйте метод `POST {{host}}/api/folders` (пройдите по [ссылке](/oz-knowledge-ru/rukovodstva/rukovodstvo-razrabotchika/api/oz-api/postman.md) для ознакомления с коллекцией Postman).
* Вы можете получить из папки видео в формате **MP4 video**: вызовите метод `/api/folders/{{folder_id}}`, указав идентификатор папки. В JSON-ответе найдите `preview_url` в `source_media`. В `preview_url` содержится ссылка на видео. Из плагина получить MP4-видео нельзя (только в виде последовательности кадров).
* При использовании архитектуры `capture` также необходимо добавить в запрос POST `{{host}}/api/folders` дополнительное поле `additional_info`. Оно нужно для сбора информации о среде клиента. Пример заполнения тела запроса:

```json
"VIDEO_FILE_KEY": VIDEO_FILE_ZIP_BINARY
"payload": "{
        "media:meta_data": {
           "VIDEO_FILE_KEY": {
              "additional_info": <additional_info>
              }
           }
}"
```

* Для передачи в Oz API используйте данные без кодирования в base64.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.ozforensics.com/oz-knowledge-ru/rukovodstva/rukovodstvo-razrabotchika/sdk/websdk/web-plugin/zapusk-plagina/semka-video-i-opisanie-kollbeka-on_capture_complete.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
