master-of-zen / Av1an

Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding
GNU General Public License v3.0
1.51k stars 155 forks source link

[Feature Request][aom] av1an to control the denoising and noise table generation process #364

Closed clidx closed 2 years ago

clidx commented 3 years ago

aomenc's denoising sucks so I had the idea that av1an could optionally take ffmpeg denoising filter parameters. Currently the workflow is split the video into chunks, queue up and instantiate workers: each worker runs probes and then encodes the chunk. The optional new workflow would be split the video into chunks, queue up and instantiate workers: each worker will then run ffmpeg to denoise the chunk according to manual parameters, noise-model generates a grain table with the original and denoised chunk, worker encodes the chunk. Maybe add a toggle for whether the original or denoised chunk is encoded.

Then we can combine av1an's chunked vmaf-q probing/encoding with non-crappy denoising for the best of both worlds.

A simpler solution is for the user to generate a noise table for the entire source video and pass in whatever original or denoised input they want to be encoded and av1an would split the noise table file for the correct chunks, but the table generation seems to be completely single-threaded so would really benefit from being chunked...

I don't know any Rust but I've poked through the source code so may take a stab at a PR in the future but not for a while. Open questions include whether to apply the other video filters at the same time as denoising for the most accurate modelling, but this would also mean they would have to be run on the source file too resulting in large yuv intermediates, Although it wouldn't be so bad since the number of active workers is not infinite.

redzic commented 3 years ago

You can just use -f/--ffmpeg to provide an ffmpeg filter to denoise, or alternatively use a vapoursynth script as input that does the denoising

redzic commented 3 years ago

Nevermind, I understand what you're saying. You want to control aomenc's internal denoising used for film grain synthesis.