> 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/api/oz-api/use-cases/liveness/best-shot.md).

# Поиск лучшего кадра

Алгоритм "лучший кадр" выбирает из видеозаписи наиболее качественный и удачный кадр с лицом. Алгоритм вызывается дополнительно к анализу [liveness](/oz-knowledge-ru/rukovodstva/rukovodstvo-razrabotchika/api/oz-api/use-cases/liveness.md). Начиная с версии 6.0.1, лучший кадр извлекается и возвращается в ответе API по умолчанию, если не указано иное.

{% hint style="info" %}
Внимание: в некоторых случаях конфигурация позволяет использовать "лучший кадр" только для определенных жестов.
{% endhint %}

Порядок действий:

1. [Авторизуйтесь.](https://apidoc.ozforensics.com/#tag/Authorization)
2. [Поместите видеофайл в папку](https://apidoc.ozforensics.com/#tag/Folders/paths/~1api~1folders/post).

{% code title="payload" %}

```javascript
{
  "media:tags": {
    "video1": [
      "video_selfie",
      "video_selfie_scan",
      "orientation_portrait"
    ]
  }
}
```

{% endcode %}

3\. [Запустите анализ](https://apidoc.ozforensics.com/#tag/Analyses/paths/~1api~1folders~1{folder_id}~1analyses/post). Убедитесь, что параметр `"extract_best_shot"` имеет значение `True`, как показано ниже.

{% code title="request body" %}

```javascript
{
  "analyses": [{
    "type": "quality",
    "source_media": ["11111111-1111-1111-1111-1111111111111111"],
    "params" : {
      "extract_best_shot": true
    }
  }]
}
```

{% endcode %}

В `source_media` указывается `media_id` из ответа предыдущего запроса. Это опционально, если требуется проверить одно из двух заранее загруженных в папку видео.

Сохраните `analyse_id` из ответа.

4а. Через некоторое время п[роверьте результат](https://apidoc.ozforensics.com/#tag/Analyses/paths/~1api~1analyses~1{analyse_id}/get). Дождитесь, когда поля `resolution_status` и `resolution` изменят статус на любой, кроме `PROCESSING`, — этот статус и будет результатом.

4б. Еще один вариант: добавьте [вебхук](/oz-knowledge-ru/rukovodstva/rukovodstvo-razrabotchika/api/oz-api/autentifikaciya-i-obrabotka-dannykh/ispolzovanie-vebkhukov-dlya-polucheniya-rezultatov.md), который обратится к вашему сайту по завершении анализа. В запросе вебхука будет содержаться информация о папке и связанных с ней анализах.

Подробно статусы анализов описаны [здесь](/oz-knowledge-ru/rukovodstva/rukovodstvo-razrabotchika/api/oz-api/statuses.md).

5\. Лучший кадр можно получить из ответа `analyses.results_media -> output_images -> original_url` под  записью `analyses.results_media -> output_images -> original_name = "ResultImage.jpg"`


---

# 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/api/oz-api/use-cases/liveness/best-shot.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.
