Since there's been a non-zero interest in evaluating my encoder, here's a short guide on how to build and invoke the encoder.

Building nihav-encoder

Since distributing binaries in modern Internet is considered dangerous, here are build instructions instead:

  1. get Rust version 1.69 or later
  2. clone NihAV git repository from git://git.nihav.org/nihav.git
  3. clone nihav-encoder git repository from git://git.nihav.org/nihav-encoder.git into already existing nihav directory (or edit paths to it in Cargo.toml)
  4. build it simply with cargo build --release (though I heard that RUSTFLAGS='-C target-cpu=native' cargo build improves performance significantly in this case)

Input limitations

NihAV is a research framework and thus it has support mostly for exotic formats and lacks on common ones. If you want to encode VP6 you need to feed nihav-encoder the format it understands, namely:

Additionally please remember that VP6 requires picture dimensions to be multiple of 16.

Using nihav-encoder to encode into AVI

General command line looks like nihav-encoder --input input.y4m --output output.avi --ostream0 encoder=vp6,... You can additionally specify -an to drop audio streams if you do not want them to be present in output file.

Supported encoder options:

E.g. if you want to encode VP 6.1 with Huffman coding and bitrate around 50kbps you should invoke nihav-encoder --input input.y4m --output output.avi --ostream0 encoder=vp6,version=vp61,huffman,bitrate=50000

You can also add --verbose option to see the encoding progress.

Using nihav-encoder to encode into EA format

This command line should produce compatible file but it has not been tested if the result works in the original games:

nihav-encoder --input input.avi --output output.vp6 --output-format ea --ostream0 timebase=32767/983019,encoder=vp6,version=vp61,quant=60

In theory it can also encode files with a separate alpha mask stream, for that you should provide encoder with an input file that has two video streams and invoke it like this:

nihav-encoder --input input.avi --output output.vp6 --output-format ea --ostream0 timebase=32767/983019,encoder=vp6,version=vp61,quant=60 --ostream1 timebase=32767/983019,encoder=vp6,version=vp61,quant=60

Putting two streams can be done e.g. with avconv (or ffmpeg) like:

avconv -i input1 -i input2 -an -c:v copy -map 0 -map 1 output.avi

(or you can use -c:v rawvideo -pix_fmt yuv420p to make sure output file contains raw video streams).

Alternatively you can invoke encoder with two input files directly:

nihav-encoder --input1 video.avi --input2 alphamask.avi --output output.vp6 --output-format ea --ostream0 timebase=32767/983019,encoder=vp6,version=vp61,quant=60 --ostream1 timebase=32767/983019,encoder=vp6,version=vp61,quant=60

Back to the main page