F7_recording/docs/encoders.md
F7cloud 0b94d1826e Initial commit: F7cloud Talk Recording Server
- Переименовано Nextcloud на F7cloud
- Добавлены зависимости Firefox ESR и Geckodriver
- Создан скрипт установки с поддержкой параметров HPB
- Добавлена документация и инструкции по установке

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 12:18:51 +00:00

63 lines
4.5 KiB
Markdown

<!--
- SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
# Encoder configuration
The encoders used by the recording server can be customized in its configuration file.
By default [VP8](https://en.wikipedia.org/wiki/VP8) is used as the video codec. VP8 is an open and royalty-free video compression format widely supported. Please check https://trac.ffmpeg.org/wiki/Encode/VP8, https://www.webmproject.org/docs/encoder-parameters and https://ffmpeg.org/ffmpeg-codecs.html#libvpx for details on the configuration options.
Similarly, [Opus](https://en.wikipedia.org/wiki/Opus), another open codec, is used for audio. Please check https://ffmpeg.org/ffmpeg-codecs.html#libopus-1 for details on the configuration options.
Nevertheless, please note that VP8 and Opus are just the default ones and that the encoders can be changed to any other supported by FFmpeg if needed. In that case the default container format, [WebM](https://en.wikipedia.org/wiki/WebM), may need to be changed as well, as it is specifically designed for VP8/VP9/AV1 and Vorbis/Opus.
## Benchmark tool
A benchmark tool is provided to check the resources used by the recorder process as well as the quality of the output file using different configurations.
The benchmark tool does not record an actual call; it plays a video file and records its audio and video (or, optionally, only its audio). This makes it possible to easily compare the quality between different configurations, as they can be generated from the same input. There is no default input file, though; a specific file must be provided.
Note that playing a video file may cause a CPU usage even higher than rendering an actual call, so both the player and the recorder may "compete" for the CPU. When the benchmark ends the number of frames dropped by the player is printed; if it is higher than 0 the benchmark result may not be fully representative, as the CPU usage of the recorder could have been limited by the player, and if it is relatively high compared to the full number of frames in the video the output quality may not be representative either, as the output video may not be smooth due to how the video was played and not due to how it was encoded.
### Usage example
The different options accepted by the benchmark tool can be seen with `nextcloud-talk-recording-benchmark --help` (or, if the helper script is not available, directly with `python3 -m nextcloud.talk.recording.Benchmark --help`).
Each run of the benchmark tool records a single video (or audio) file with the given options. Using a Bash script several runs can be batched to check the result of running different options. For example:
```
#!/usr/bin/bash
# Define the output video options for ffmpeg and the filename suffix to use for each test.
TESTS=(
"-c:v libvpx -deadline:v realtime -b:v 0,rt-b0"
"-c:v libvpx -deadline:v realtime -b:v 0 -cpu-used:v 0,rt-b0-cpu0"
"-c:v libvpx -deadline:v realtime -b:v 0 -cpu-used:v 15,rt-b0-cpu15"
"-c:v libvpx -deadline:v realtime -b:v 0 -crf 4,rt-b0-crf4"
"-c:v libvpx -deadline:v realtime -b:v 0 -crf 10,rt-b0-crf10"
"-c:v libvpx -deadline:v realtime -b:v 0 -crf 32,rt-b0-crf32"
"-c:v libvpx -deadline:v realtime -b:v 0 -crf 32 -cpu-used:v 0,rt-b0-crf32-cpu0"
"-c:v libvpx -deadline:v realtime -b:v 0 -crf 32 -cpu-used:v 15,rt-b0-crf32-cpu15"
"-c:v libvpx -deadline:v realtime -b:v 500k,rt-b500k"
"-c:v libvpx -deadline:v realtime -b:v 500k -crf 4,rt-b500k-crf4"
"-c:v libvpx -deadline:v realtime -b:v 500k -crf 10,rt-b500k-crf10"
"-c:v libvpx -deadline:v realtime -b:v 500k -crf 32,rt-b500k-crf32"
"-c:v libvpx -deadline:v realtime -b:v 750k,rt-b750k"
"-c:v libvpx -deadline:v realtime -b:v 750k -crf 4,rt-b750k-crf4"
"-c:v libvpx -deadline:v realtime -b:v 750k -crf 10,rt-b750k-crf10"
"-c:v libvpx -deadline:v realtime -b:v 750k -crf 32,rt-b750k-crf32"
"-c:v libvpx -deadline:v realtime -b:v 1000k,rt-b1000k"
"-c:v libvpx -deadline:v realtime -b:v 1000k -crf 4,rt-b1000k-crf4"
"-c:v libvpx -deadline:v realtime -b:v 1000k -crf 10,rt-b1000k-crf10"
"-c:v libvpx -deadline:v realtime -b:v 1000k -crf 32,rt-b1000k-crf32"
)
for TEST in "${TESTS[@]}"
do
# Split the input tuple on ","
IFS="," read FFMPEG_OUTPUT_VIDEO FILENAME_SUFFIX <<< "${TEST}"
# Run the test
nextcloud-talk-recording-benchmark --length 300 --ffmpeg-output-video "${FFMPEG_OUTPUT_VIDEO}" /tmp/recording/files/example.mkv /tmp/recording/files/test-"${FILENAME_SUFFIX}".webm
done
```