# uavs3e

Canonical URL: https://encode.wiki/tools/software-encoders/uavs3e/
Content version: ca42e61ede0a24f789d7287a0001244ad22f4abf
Status: current
License: CC BY-SA 4.0
Checksum (SHA-256): 0fec658c38edd55377e49021ef763bd710ef0b56186d4d7d03a982e87e1cb8f7

> **Repository:** [uavs3/uavs3e](https://github.com/uavs3/uavs3e) (No commits since Aug 2023). AVS3 encoder which supports AVS3-P2 baseline profile. Latest release: [v1.1](https://github.com/uavs3/uavs3e/releases/tag/v1.1), Oct 12, 2022. Last commit: Aug 3, 2023. Stars: 162.

[uavs3e](https://github.com/uavs3/uavs3e) is an open-source encoder for [AVS3](/codecs/video/avs3/), the Chinese video standard, supporting the AVS3-P2 baseline profile. It was developed by Peking University Shenzhen Graduate School, Peng Cheng Laboratory and Guangdong Bohua UHD Innovation, and is licensed under the BSD 4-clause license. It is optimized for SSE4/AVX2 and also builds for ARM and LoongArch.

Development has stopped: the last commit on `master` is from August 2023, and the only tags, `v1.3` and `v1.1`, date from 2022. It is slow by default and awkward to build today.

## Build

There are no binaries. On Linux:

```sh
git clone https://github.com/uavs3/uavs3e.git
cd uavs3e
mkdir -p build/linux && cd build/linux
cmake ../.. -DCOMPILE_10BIT=0 -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
  -DCMAKE_C_FLAGS="-Wno-incompatible-pointer-types -D_LARGEFILE64_SOURCE -include unistd.h"
make -j8
```

The extra flags work around three problems with current toolchains: CMake 4 rejects the project's old minimum version, GCC 14+ and recent Clang treat an incompatible-pointer warning in the AVX2 code as an error, and `test/utest.c` (where the encoder's `main` lives) uses `lseek64`/`read`/`write` without including `<unistd.h>`. The result is a `uavs3enc` binary in the build directory. On Windows, run `version.bat` and build `build/x86_windows/uavs3e.sln` in Visual Studio.

> **Caution.**
>
> `-DCOMPILE_10BIT=1` enables 10-bit encoding, but without SIMD, and builds with it [crash on AVX2 Linux](https://github.com/uavs3/uavs3e/issues/53) (reported, unfixed). Stay with the 8-bit build unless you need 10-bit.
## Encode

uavs3enc reads **raw planar YUV only**, from a seekable file: no Y4M, and `-i -` (stdin) does not work. Convert first, and give it the size and frame rate yourself:

```sh
ffmpeg -i input.mkv -pix_fmt yuv420p -f rawvideo input.yuv
uavs3enc -i input.yuv -w 1920 -h 1080 -d 8 --fps_num 24000 --fps_den 1001 -q 30 -o output.avs3
```

Note that `-h` is the height, not help. For rate-controlled encodes and more threads:

```sh
uavs3enc -i input.yuv -w 1920 -h 1080 -d 8 --fps_num 24000 --fps_den 1001 -p 120 \
  --speed_level 2 --rc_type 1 --rc_crf 28 --wpp_threads 8 --frm_threads 8 -o output.avs3
```

With `--rc_type 1` (CRF) the quality comes from `--rc_crf`, and `-q` is ignored.

| Option                             | Meaning                                                                 |
| ---------------------------------- | ----------------------------------------------------------------------- |
| `-q`                               | Fixed QP in CQP mode (the default): 0–63 for 8-bit, −16–63 for 10-bit.  |
| `--rc_type`                        | `0` CQP (default), `1` CRF, `2` ABR, `3` CBR.                           |
| `--rc_crf`                         | CRF value, 0–63.                                                        |
| `--rc_bitrate`, `--rc_max_bitrate` | Target and maximum bitrate in kbit/s for ABR/CBR.                       |
| `--speed_level`                    | `0` to `4`. **`0` is the default and the slowest**; `4` is the fastest. |
| `-p`                               | Intra period in frames; `0` means only the first frame is intra.        |
| `--wpp_threads`, `--frm_threads`   | Wavefront and frame-level threading.                                    |
| `-f`                               | Maximum number of frames to encode.                                     |
| `--config`                         | Read options from a file; command-line options override it.             |

## Decode and play

The output is a raw AVS3 stream. Decode it with [uavs3d](https://github.com/uavs3/uavs3d), or with FFmpeg built with `--enable-libuavs3d`, which is not the default.
