Configure Wavelet and Block Size in FFmpeg Snow

This article provides a quick guide on how to configure the discrete wavelet transform (DWT) type and the motion estimation block size when encoding video with the experimental Snow codec in FFmpeg. By customizing these two key parameters, you can fine-tune the encoder for either high-efficiency lossy compression or mathematically lossless archival.

Configuring the Wavelet Type

The Snow encoder utilizes wavelet transform instead of the traditional Discrete Cosine Transform (DCT) found in codecs like H.264. You can select the wavelet transform type using the -pred option. Snow supports two primary wavelet types:

Example command for 9/7 lossy compression:

ffmpeg -i input.mp4 -c:v snow -pred 1 output.mkv

Configuring the Block Size

Snow relies on Overlapping Block Motion Compensation (OBMC) for motion estimation. You can control the size of the blocks used for this process with the -block option. Adjusting the block size allows you to balance encoding speed, file size, and motion accuracy:

Example command for 8x8 block size:

ffmpeg -i input.mp4 -c:v snow -block 1 output.mkv

Combining Settings for Optimal Encoding

To achieve the best results, you should configure both settings in a single command line alongside a quality-scale factor (-qscale or -q:v) to control the output bitrate.

For High-Quality Lossy Video (using 9/7 wavelet and 8x8 blocks):

ffmpeg -i input.mp4 -c:v snow -pred 1 -block 1 -q:v 3 output.mkv

For Lossless Video (using 5/3 wavelet and 8x8 blocks):

ffmpeg -i input.mp4 -c:v snow -pred 0 -block 1 -q:v 0 output.mkv