Log in

View Full Version : Is there a vdub/avisynth filter to match colors in two different videos?


cesm23
5th October 2010, 16:40
For example, i have a tv show captured from tv in one place and the same tv show captured in other place (and it's several episodes not just one), altough in one of them the colors are a lot better and in the other they are more "greyish". Is there any alternative to using tweak and douzens of tryes to get the colors in the two videos to mach ? Not even a filter that is able to compare the videos frame a frame to try to match the colors ?

I already tried changing manually the settings for the existing filters to change colors, but as you all know it takes AGES to be able to match the colors, and most of the times is wasted time since when some of them matches, the others don't... and now imagine doing this in douzens of episodes... And my goal is to get pieces from one of the captures to add to the other, because one has a lot better resolution and quality encoding than the other, but having the colors changing between some scenes is really annoying...

cobo
5th October 2010, 19:40
You could use Avisynth's internal filter Merge to combine the chroma of one clip with the luma of the other.
clip1=avisource("C:\clip_to _change _colors_of.avi")

clip2=avisource("C:\clip_to _match _colors_to.avi")

chroma=clip2
luma=clip1
MergeChroma(luma,chroma, 1.0)

There's ColourLike (http://forum.doom9.org/showthread.php?t=96308) (filter here (http://avisynth.org/warpenterprises/#colourlike)).
clip1=avisource("C:\clip_to _change _colors_of.avi")

clip2=avisource("C:\clip_to _match _colors_to.avi")

#WriteHistogram(clip1, "original.txt", 1)
#WriteHistogram(clip2, "color_match.txt", 1)

ColourLike(clip1, "original.txt", "color_match.txt")

You could also try HistogramAdjust (http://avisynth.org/vcmohan/HistogramAdjust/HistogramAdjust.html).
clip1=avisource("C:\clip_to _change _colors_of.avi")

clip2=avisource("C:\clip_to _match _colors_to.avi")

HistogramAdjust(clip1,type="match",mclip=clip2)

I've been experimenting with Avisynth's Internal Functions to try and achieve something similar. Here's what I've come up with so far:
clip1=avisource("C:\clip_to _change _colors_of.avi")

clip2=avisource("C:\clip_to _match _colors_to.avi")

ScriptClip(clip1, "ColorYUV(off_y=(YPlaneMedian(clip2)-YPlaneMedian(clip1)), off_u=(UPlaneMedian(clip2)-UPlaneMedian(clip1)), off_v=(VPlaneMedian(clip2)-VPlaneMedian(clip1)))")
clip1=avisource("C:\clip_to _change _colors_of.avi")

clip2=avisource("C:\clip_to _match _colors_to.avi")

ScriptClip(clip1, "ColorYUV(off_y=(AverageLuma(clip2)-AverageLuma(clip1)), off_u=(AverageChromaU(clip2)-AverageChromaU(clip1)), off_v=(AverageChromaV(clip2)-AverageChromaV(clip1)))")

None of them gives me completely satisfactory results, but you may find one of them close enough.

cesm23
5th October 2010, 21:14
WOW the only one that worked perfectly was ColourLike this one done a excelent job, far better than any of the others thanks a lot for that, there is only one small problem... i guess it's impossible to translate it's results to "tweak" values right ? Because the problem is that in one of the place there is scenes of the tvshow missing, and i would like to copy/paste them from the other tvshow but with the same type of colors that the original one would do... i guess that's impossible right ? Since i tried the same test with a different part and the color change is not the same in all scenes unfortunately.

cobo
5th October 2010, 22:00
I don't know any automatic way to make different scenes match in color, saturation, contrast and brightness. I would have to resort to doing it manually using trial and error, but my understanding of avisynth scripting is not very advanced, maybe someone whose is can suggest something.

communist
6th October 2010, 05:55
http://forum.doom9.org/showthread.php?t=96308
Filter can be found here: http://avisynth.org/warpenterprises/#colourlike

Can't help you with usage since I've never used it ;)

cesm23
6th October 2010, 07:44
cobo already told that very same link, i told i already tried it and it was a the better one so far... but still thanks :)

ganymede
10th October 2010, 23:31
Just for the record...
I managed to balance colors of 2 videos of the same person filmed at the same time, with 2 different cameras, in slightly different lighting conditions (a different position relatively to the source of light) and with a slightly different framing.
In this situation, ColourLike gave interesting results, although slightly exagerate, by adjusting the Y and V chanels. It was then possible to mitigate those results with Merge(), eg. :
Merge( ColourLike( vid_source, hist_source, hist_ref, true, false, true ) , vid_source, 0.5 )
The final result is not perfect, but better than the original.
That's definitely an interesting feature for video editors...

cesm23
10th October 2010, 23:46
I see, that's interesting, altough for the footage i used it's clearly not suited for what i need :)

Anyway i think i am almost about to drop this whole thing, because not all the scenes i want to make the same color exist in the other tv recording (one of the tv displays a cut version of the same program while the other is the uncut version) so i need something that would work in other scenes and not only those that that histogram is made with colorlike, so colorlike isn't a option either.

Finally i was able to test the other methods, but almost all of them gave worse results than colorlike, there is one that gaved a excelent color match in ALL scenes, it's cobo's first method (MergeChroma) this one worked great, except that in some scenes there is a "colored" shadow in some edges and i was unable to get rid of this without making the color match less with the one i wanted so unfortunately this one isn't a solution either. I guess i have to forget about this, it's too complicated, and i need to do this for more than 300 episodes... :D