View Full Version : Need advice on stabilizing differences between adjacent frames
Chainmax
3rd November 2007, 15:46
I'm currently trying to encode some clips with a codec that is very sensitive to slight differences (very small movements, a pixel changing to a very similar color than it had) between neighboring frames. As an example, here are two consecutive frames in a scene
http://img114.imageshack.us/img114/9450/frame1tn3.png (http://imageshack.us)
http://img218.imageshack.us/img218/2875/frame2bl4.png (http://imageshack.us)
As you can see, both images seem identical but the PNGs have different sizes so there must be some kind of a difference between them. What I need help with is what filter (Dup? DeDup? Anything newer than those?) to include at the end of the filterchain and at what settings to ensure that these two frames are exactly the same. I can provide a short sample clip if needed. Thanks in advance.
Guest
4th November 2007, 00:15
Dup should do good on it. Provide an unprocessed sample.
Chainmax
4th November 2007, 14:25
Here's a sample clip (~21MB):
http://rapidshare.com/files/67367547/Sample.avi.html
sorry about RapidShare, the other service I normally use (BestSharing) wasn't working
Guest
4th November 2007, 15:45
avisource("sample.avi")
converttoyuy2()
dup(threshold=2)
Chainmax
4th November 2007, 23:25
Thanks :).
Fizick
5th November 2007, 09:06
Please test latest Dup v2.2.3:
http://avisynth.org.ru/dup/dup223.zip
Chainmax
5th November 2007, 23:03
I already made an encode with the version on neuron2's site, but in the next encode I will try your version too. Thanks for the heads-up :).
P.S: should I try it as dup(threshold=2) too?
Guest
5th November 2007, 23:19
There's no difference if you don't use the blend mode.
Chainmax
7th November 2007, 22:01
neuron2's recommendation with the older Dup version worked wonderfully, as did Fizick's newer version. There is, however a part where an object is moving away and ends up being only a few pixels big but is still moving. That object ends up becoming completely static with Dup.
I'm pretty sure the only way to deal with this is to filter that scene separately and use some other difference stabilizing method. but just in case I'm posting a sample clip showing part of said scene:
http://www.bestsharing.com/files/I0oIj361711/Sample2.avi.html
The other sample I provided was filtered because that was what I needed to stabilize, but in this case I though a completely unfiltered sample was needed for an accurate assessment of the situation.
Chainmax
15th November 2007, 01:06
Did you get a chance to check out the new sample?
Dark Shikari
15th November 2007, 01:58
TTempSmooth is very good for stabilization when you cannot guarantee that the method Dup uses will work correctly.
anton_foy
15th November 2007, 11:45
Wow its from my favourite game Broken Sword!
Isnt that smacker video codec?
Very blocky and 256 colours or something. Im not much help but maybe use GradFunkMirror or gradfun2db to smooth out some areas too?
Fizick
15th November 2007, 18:18
Dup could be modified (decrease block size form 32x32 to 16x16 or 8x8) to detect small details
Chainmax
16th November 2007, 00:00
TTempSmooth is very good for stabilization when you cannot guarantee that the method Dup uses will work correctly.
That's a great idea, I could use Dup on the risk-free parts and TTempSmooth on the almost static parts. If the Dup modification Fizick talks about can't be done, I'll try this. Thanks for the suggestion :) http://smilies.vidahost.com/otn/wink/thumb.gif.
Wow its from my favourite game Broken Sword!
Isnt that smacker video codec?
Very blocky and 256 colours or something. Im not much help but maybe use GradFunkMirror or gradfun2db to smooth out some areas too?
Yup, crappy 256-color Smacker file indeed. Gradfun2db is being used already. MVDeGrain is also used as I remember reading that it could help with banding too.
Dup could be modified (decrease block size form 32x32 to 16x16 or 8x8) to detect small details
If you can, please do make that modification (maybe even having block size be a user-definable parameter?), it would be great to have that option available.
Fizick
18th November 2007, 11:16
If you can, please do make that modification (maybe even having block size be a user-definable parameter?), it would be great to have that option available.
Yes, I can make it, if Neuron2 have no time. In this case, we firstly must have an agreement (with Neuron2) about new version name and hosting place :)
(Dup or DupMod, Dup2 ?)
Guest
18th November 2007, 13:51
Easiest is if you submit your modified version to me and I'll absorb it into my main line and host it as usual. You can include your earlier blending fix as well. Of course, your work will be credited. Thank you.
Fizick
18th November 2007, 15:07
neuron2,
OK, I sent modded version to your comcast.net e-mail account.
Chainmax
20th November 2007, 22:10
Please give us a heads-up when Fizick's modifications are integrated and the updated filter is available for download.
cestfait
22nd November 2007, 05:38
yes, yes! A new Dup! I can't wait! :D
Fizick
22nd November 2007, 18:19
Check neuron2's homepage ;)
please test, report.
Note: there is small problem with blending of latest (very last) frame of clip (in any version):
it is not detected as duplicate (and not blended or copied).
cestfait
23rd November 2007, 07:14
wonderful. absolutely wonderful! :D
:thanks:
EDIT: Oh, yeah, report...
I found the filter amazingly effective, even with a very noisy source after an mvdegrain2 (with Dup on blksize=8). My thresholds seem to fall around 1.0, but unlike with the earlier version, there are still many 20-frame duplicates. THIS TIME THEY ARE ACCURATE DUPS!! Yes, folks, the filter can now find the real dups. :D
Long strings of dups and blending turned on makes dup filter to all intents and purposes a NICE TEMPORAL DENOISER. It's just a new spin on the old theory of temporal denoising. Can x264 encode these frames anyway with little overhead? Yes, but this filter blends the long chains that, though static, might become blocky (even if they aren't increasing filesize much). With the aid of this filter, there is very little movement where there shouldn't be, and that includes moving noise and especially blocks. Beautiful.
My recommendation to new users would be to choose thresholds based more on fades than on small movements. There is no longer a need to worry so much about small movements.
This redundancy is absolutely merited:
:thanks:
P.S.
If this is my script:
LoadPlugin("dup.dll")
LoadPlugin("dgdecode.dll")
LoadPlugin("mvtools.dll")
Import("mvdegrain2.avs")
DGDecode_Mpeg2Source("test_01.d2v")
mvdegrain2(idx=1)
dup(threshold=1.1,blend=true,show=false,blksize=8)
Crop(8,6,-6,0)
LanczosResize(704,480)
...is there any way of getting dup to make decisions based on the denoised source, but ALSO denoise after the dup filter without using mvdegrain2 twice? I am terrible at scripting. Something to do with "return" maybe?
If not, what quick denoiser might be able to help me between frames where there is movement after a string of dups. These places seem to like to block.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.