denoise filter
滤波
ffmpeg has six denoisers built-in that I was able to find, which I’ve listed below along with their transcoding speeds on a 1080p source video using a four-core laptop computer. I wrote scripts that used a variety of settings with each denoiser to make sure I was seeing the best each one had to offer.
atadenoise (20 fps) - by averaging pixels across frames, it reduces contrast of noise areas to make them less obvious as opposed to using a specialized algorithm to smooth the noise away; this reduces overall image contrast; filter also darkens the overall output
原理:Apply an Adaptive Temporal Averaging Denoiser to the video input. 时域平均
参数:
在yuv三个通道分别设置a,b两个阈值,阈值A设计为对输入信号的突然变化做出反应,阈值B设计为对输入信号的连续变化做出反应。nlmeans (0.6 fps) - darkens the output, but sometimes has redeeming qualities (more on this later)
hqdn3d (21 fps) - color neutral which is good, but the output looks smeary to me where it loses a lot of fine detail in hair strands and wood grain
频域
fft变换
(1)fftdnoiz
原理:Denoise frames using 3D FFT (frequency domain filtering).
参数:
重要参数:sigma和overlap,sigma设置噪声强度,overlap设置块之间的重叠度,很大的sigma和很小的overlap会带来块失真。
dct变换
(1) dctdnoiz (1.6 fps) - creates beautiful detail on a still image, but randomizes the noise across frames so much that it actually makes the noise look worse during playback, plus it darkens the output
原理:Denoise frames using 2D DCT (frequency domain filtering).
参数:
主要参数是sigma,设定一个3*sigma的hard threshold,所有低于此阈值的dct系数都被丢掉wavelet小波
(1)owdenoise (0.3 fps) - color neutral wavelet denoiser with stunningly good results on high-res sources
原理:Apply Overcomplete Wavelet.过完备小波
参数:
(2)vaguedenoiser (7.6 fps) - another color neutral wavelet denoiser whose output looks identical to owdenoise, but its processing speed is 25x faster; tried every combination of threshold and nsteps, and found the default settings of 2/6 to consistently produce the closest-to-real-life results
原理:Apply a wavelet based denoiser. It transforms each frame from the video input into the wavelet domain, using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to the obtained coefficients. It does an inverse wavelet transform after. Due to wavelet properties, it should give a nice smoothed result, and reduced noise, without blurring picture features.
小波变换->对小波系数滤波->小波反变换
参数:
主要参数是threshold, 需要已知噪声强度,来设置一个阈值, 默认值是2;
I tested the denoisers on videos I took with my own mirrorless camera, meaning I remember what the scene looked like in real life. In one video, there happened to be a guy in a black business dress shirt made of silk or satin or something with a sheen to it, but the sheen wasn’t coming through due to the noise of the original footage. The wavelet-based denoisers were the only ones to remove and smooth the noise such that the fabric regained the smooth sheen you would expect from silk. To my eye, it bumped up the realism of the video an entire notch to see fabric actually look like fabric. The rest of the frame also dropped to zero dancing noise. It turned the video into a still photograph when nothing was moving. I didn’t realize until this experiment that even a tiny amount of dancing noise can seriously detract from the realism of a video, and that a sense of immersion can be restored by getting rid of it. Obviously, vaguedenoiser is my new weapon of choice.
我在用自己的无反光镜相机拍摄的视频上测试了降噪器,这意味着我记得现实生活中的场景。 在一个视频中,碰巧有一个穿着丝绸或绸缎或带有光泽的黑色商务正装衬衫的人,但由于原始镜头的杂音,光泽没有通过。 基于小波的降噪器是唯一可以消除和平滑噪声的降噪器,从而使织物恢复了丝绸所希望的平滑光泽。 在我看来,它使视频的真实感提高了一个整体,从而使织物看起来实际上像织物。 帧的其余部分也降至零跳舞噪音。 当没有任何动静时,它将视频变成静止图像。 直到进行这项实验,我才意识到,即使是很小的舞蹈噪音也会严重损害视频的真实感,并且摆脱它可以恢复沉浸感。 显然,vaguedenoiser是我选择的新武器。
So, about nlmeans… I found a radical difference between the ffmpeg version and the HandBrake version. I think HandBrake wins on every metric. nlmeans in ffmpeg actually makes video look worse (blockier) if the resolution is 1080p or above, or if the video comes from an excellent camera that has little noise to begin with. nlmeans in ffmpeg also can’t be used as a finishing step because it darkens the output, which destroys any color grading that happened before it. But I found two places where nlmeans in ffmpeg outshined the other ffmpeg denoisers: low-resolution video, and very-high-noise video. nlmeans does great at restoring a VHS capture, which I sense from the author’s web site was one of the original design goals. Secondly, in my tests, nlmeans did better than the other ffmpeg denoisers on high-resolution high-noise videos, which in my case meant a smartphone video in low light using digital zoom. Given these two specialized cases where nlmeans performed well, I could see a workflow where I used nlmeans to create denoised intermediates, then color graded the intermediates to fix the darkened output. Running nlmeans on a noisy source then adding it to the timeline and running vaguedenoiser on the total project did not cause any harm in my tests. But for best results, I think HandBrake is still the way to go where nlmeans is involved.
因此,关于nlmeans……我发现ffmpeg版本和HandBrake版本之间存在根本差异。我认为HandBrake在每个指标上均获胜。如果分辨率为1080p或更高,或者视频来自一台噪音很小的优秀相机,则ffmpeg中的nlmeans实际上会使视频看起来更糟(更阻塞)。 ffmpeg中的nlmeans也不能用作精加工步骤,因为它会使输出变暗,这会破坏之前发生的任何颜色分级。但是我发现在ffmpeg中,nlmeans在其他地方比其他ffmpeg去噪器要好得多:低分辨率视频和超高噪声视频。 nlmeans在恢复VHS捕获方面做得很出色,我从作者的网站上感觉到这是最初的设计目标之一。其次,在我的测试中,nlmeans在高分辨率高噪声视频上的表现优于其他ffmpeg去噪器,在我的情况下,这意味着使用数字变焦的智能手机视频在弱光下。考虑到这两种特殊情况,nlmeans表现良好,我可以看到一个工作流程,其中我使用nlmeans创建去噪的中间体,然后对中间体进行颜色分级以固定变暗的输出。在嘈杂的源上运行nlmeans,然后将其添加到时间轴,在整个项目中运行vaguedenoiser,这不会对我的测试造成任何损害。但是为了获得最佳结果,我认为HandBrake仍然是解决涉及nlmeans的方法。
For my purposes, I think I will stick to vaguedenoiser because it’s beautiful on 1080p and 4K, and it is easily added to my existing ffmpeg filter chain when I do my finishing steps. I don’t have to create an intermediate to pass off to HandBrake this way. However, if I came across a particularly noisy source video, I would probably run it through HandBrake before adding it to my Shotcut project to get the same benefits Andrew noticed.
Good luck to everyone, whatever you use.