Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th August 2015, 03:12   #1  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
How to replicate in Avisynth: multiple movies at once using "Lighter Color blending"

Hi again,

I found another project on youtube that just blew me away and would love to know how to replicate it in avisynth.

It's real messy to watch, but it just tickles my inner nerd.
Watching with ChromaDepth 3D glasses is a real brain twister.

The link:
I selected the comment where the uploader responded to someone asking him how he did it.
The question and his response should be top of the list of comments.

Star Wars Wars: All 6 Films At Once (720p HD)
https://www.youtube.com/watch?v=HTHT...yeoymu5pjsxc0k

The (Imgur) Gallery:
https://imgur.com/a/8gS2O?gallery


The Response:
" Thanks for the question! Pretty good guess +Curtis Dominguez.

It's actually pretty simple.

It is accomplished using the Lighter Color blending mode (also known as Max or Lighter depending on your composting software).

It mathematically selects the brightest pixel of all layers of video.

This is why a brighter landscape, like Hoth, will totally dominate the frame, and lightsabers and blasters will always show up.

I added my own level of contrast to each layer equally to make increase the falloff into darkness of each video (increasing overlay potential), and keeping it from just looking all grey/muddy.

I'm working on a how to video but not quite finished.
"


So it seems he used a NLE like Adobe Premiere or other.
But I want to do this via Avisynth.

I would love to do this to a nice boxset one of these decades.
Maybe the theatrical Alien Quadrilogy.
Maybe Pirates of the Caribbean trilogy.

The Plea:
Help me, Obi-Wan Doom9'ers. You're my only hope.

EDIT: The solutions:
Quote:
Originally Posted by feisty2 View Post
Code:
Function maxY (clip1, clip2)
{
Dif = mt_makediff (mt_logic (clip1.converttoy8 (), clip2.converttoy8 (), "max"), clip1.converttoy8 ())
Mask = mt_lut (Dif, "x 128 == 0 255 ?").Blur (1)
Y = mt_merge (clip1.converttoy8 (), clip2.converttoy8 (), Mask)
U = mt_merge (clip1.utoy8 (), clip2.utoy8 (), Mask)
V = mt_merge (clip1.vtoy8 (), clip2.vtoy8 (), Mask)
YtoUV (U, V, Y)
}
this one blends stuff softly (blurred mask instead of binary mask), should work better and make the weird thing a little bit less weird...
Quote:
Originally Posted by Gavino View Post
The last four lines can be replaced by:
Code:
mt_merge (clip1, clip2, Mask, luma=true, U=3, V=3)
Code:
Function maxY (clip1, clip2)
{
Dif = mt_makediff (mt_logic (clip1.converttoy8 (), clip2.converttoy8 (), "max"), clip1.converttoy8 ())
Mask = mt_lut (Dif, "x 128 == 0 255 ?").Blur (1)
mt_merge (clip1, clip2, Mask, luma=true, U=3, V=3)
}
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)

Last edited by Sparktank; 20th July 2016 at 02:49.
Sparktank is offline   Reply With Quote
Old 13th August 2015, 04:59   #2  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
"It mathematically selects the brightest pixel of all layers of video."
clip1
clip2
clip3
...
clipn

max = mt_logic (clip1, clip2, "max").mt_logic (clip3, "max")...mt_logic (clipn, "max")
return max
feisty2 is offline   Reply With Quote
Old 13th August 2015, 05:23   #3  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Interesting!

Buffy season 2 (didn't do detelecine/deinterlace).

Code:
SetMemoryMax(512)
LoadPlugin("C:\AVS\dgdecnv2049\DGDecodeNV.dll")
clip1 = DGSource("E:\MakeMKV\BUFFY_SEASON2_DISC3\09- What's My Line - Part 1.dgi").AssumeFPS(29.97)
clip2 = DGSource("E:\MakeMKV\BUFFY_SEASON2_DISC3\10- What's My Line - Part 2.dgi").AssumeFPS(29.97)
clip3 = DGSource("E:\MakeMKV\BUFFY_SEASON2_DISC3\11- Ted.dgi")

max = mt_logic (clip1,clip2, "max").mt_logic (clip3, "max")
return max
Frame(ish) 13446


Except clip1 is the only one with colors.

Clip 1: http://i.imgur.com/AMKm41Y.png
Clip 2: http://i.imgur.com/06bJkdZ.png
Clip 3: http://i.imgur.com/nLyX4JZ.png
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 13th August 2015, 05:41   #4  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
chroma stuff should get guided by luma

Function maxY (clip1, clip2)
{
Y = mt_logic (clip1.converttoy8 (), clip2.converttoy8 (), "max")
Dif = mt_makediff (Y, clip1.converttoy8 ())
Mask = mt_lut (Dif, "x 128 == 0 255 ?")
U = mt_merge (clip1.utoy8 (), clip2.utoy8 (), Mask)
V = mt_merge (clip1.vtoy8 (), clip2.vtoy8 (), Mask)
YtoUV (U, V, Y)
}

clip1=clip1.ConvertToYV24 ()
clip2=clip2.ConvertToYV24 ()
clip3=clip3.ConvertToYV24 ()
...
clipn=clipn.ConvertToYV24 ()

max = maxY (clip1, clip2).maxY (clip3)...maxY (clipn)
return max
feisty2 is offline   Reply With Quote
Old 13th August 2015, 05:57   #5  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
and here we go!

Code:
clip1=clip1.converttoyv24 ()
clip2=clip2.converttoyv24 ()

Function maxY (clip1, clip2)
{
Y = mt_logic (clip1.converttoy8 (), clip2.converttoy8 (), "max")
Dif = mt_makediff (Y, clip1.converttoy8 ())
Mask = mt_lut (Dif, "x 128 == 0 255 ?")
U = mt_merge (clip1.utoy8 (), clip2.utoy8 (), Mask)
V = mt_merge (clip1.vtoy8 (), clip2.vtoy8 (), Mask)
YtoUV (U, V, Y)
}

maxY (clip1,clip2)



dunno if it's the kinda stuff u want tho
feisty2 is offline   Reply With Quote
Old 13th August 2015, 06:03   #6  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
EDIT: using post #4 (i do things slowly)

i LOVE this!

13446


03175


57603


Thanks a lot!

One caveat is to expect clips 1&2 to take precedence over proceeding clips in the event that clips 1&2 end sooner than any other clips?

Some creepy stuff to do to:


Code:
fill_clip = blankclip(3,720,480,"YV12",fps=29.97).killaudio()
clip1 = DGSource("E:\MakeMKV\BUFFY_SEASON2_DISC3\09- What's My Line - Part 1.dgi").AssumeFPS(29.97)
clip2 = fill_clip+clip1
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)

Last edited by Sparktank; 13th August 2015 at 06:11.
Sparktank is offline   Reply With Quote
Old 13th August 2015, 06:10   #7  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Using post #5:


maxY (clip1,clip2)



maxY (clip1,clip2).maxY (clip3)
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 13th August 2015, 06:18   #8  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by Sparktank View Post
One caveat is to expect clips 1&2 to take precedence over proceeding clips in the event that clips 1&2 end sooner than any other clips?
dunno about that, I just converted "It mathematically selects the brightest pixel of all layers of video." to a piece of avisynth script
feisty2 is offline   Reply With Quote
Old 13th August 2015, 06:21   #9  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Thanks a bunch! This is perfect!

In the event that clips are shorter than others, I'll just add a blank clip to the end so they all match same runtime.

The results will be much better with HD sources (or properly handled SD sources).

This will provide endless hours of fun.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 13th August 2015, 06:47   #10  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Code:
Function maxY (clip1, clip2)
{
Dif = mt_makediff (mt_logic (clip1.converttoy8 (), clip2.converttoy8 (), "max"), clip1.converttoy8 ())
Mask = mt_lut (Dif, "x 128 == 0 255 ?").Blur (1)
Y = mt_merge (clip1.converttoy8 (), clip2.converttoy8 (), Mask)
U = mt_merge (clip1.utoy8 (), clip2.utoy8 (), Mask)
V = mt_merge (clip1.vtoy8 (), clip2.vtoy8 (), Mask)
YtoUV (U, V, Y)
}
this one blends stuff softly (blurred mask instead of binary mask), should work better and make the weird thing a little bit less weird...
feisty2 is offline   Reply With Quote
Old 13th August 2015, 07:10   #11  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
soft blend (post #10):

Used an HD source for clarity.

Frame #164560


Code:
SetMemoryMax(512)
LoadPlugin("C:\AVS\dgdecnv2049\DGDecodeNV.dll")

fill_clip = blankclip(3,1280, 534,"YV24",fps=23.976).killaudio()
clip1 = DGSource("F:\MakeMKV\V For Vendetta.dgi", crop_t=140, crop_b=148, crop_l=0, crop_r=0).AssumeFPS(23.976)
clip1 = clip1.ConvertToYV24(matrix="Rec709").Spline36Resize(1280, 534)
clip2 = fill_clip+clip1

Function maxY (clip1, clip2)
{
Dif = mt_makediff (mt_logic (clip1.converttoy8 (), clip2.converttoy8 (), "max"), clip1.converttoy8 ())
Mask = mt_lut (Dif, "x 128 == 0 255 ?").Blur (1)
Y = mt_merge (clip1.converttoy8 (), clip2.converttoy8 (), Mask)
U = mt_merge (clip1.utoy8 (), clip2.utoy8 (), Mask)
V = mt_merge (clip1.vtoy8 (), clip2.vtoy8 (), Mask)
YtoUV (U, V, Y)
}

max = maxY (clip1, clip2)
return max
Forwarding a bit in Avspmod, I can see this is something to do for isolated shots (like in some movies when someone is sick or drugged).
Would make a really fun addition to 'fan made trailers'.

That shot where the camera tilts up to V, it's perfect for this weird effect!
Trim it down, weird it out, add it main project.

Thanks again for this!
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 13th August 2015, 07:22   #12  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Here's very short sample of that shot/scene.
Resized to 500xHeight (for browser/gif), lossless then uploaded to gycat.
(interesting they support UtVideo codec for conversion)

Original clip:
HTML5 video: http://gfycat.com/PoshUnacceptableDogwoodtwigborer
GIF: http://zippy.gfycat.com/PoshUnaccept...dtwigborer.gif


Edited clip (with "ripple effect" / delay_3frames):
HTML5 video: http://gfycat.com/EmptyUncommonBustard
GIF: http://zippy.gfycat.com/EmptyUncommonBustard.gif
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)

Last edited by Sparktank; 13th August 2015 at 07:47.
Sparktank is offline   Reply With Quote
Old 13th August 2015, 14:57   #13  |  Link
kuchikirukia
Registered User
 
Join Date: Oct 2014
Posts: 476
Quote:
Originally Posted by Sparktank View Post
Star Wars Wars: All 6 Films At Once
But there are only 3 Star Wars films.
kuchikirukia is offline   Reply With Quote
Old 13th August 2015, 15:41   #14  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by kuchikirukia View Post
But there are only 3 Star Wars films.
6 if with prequel trilogy
feisty2 is offline   Reply With Quote
Old 13th August 2015, 16:08   #15  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
There are only 3 Star Wars films.

Anyway, back on topic, SparkTank, can I suggest that you try, after overlaying all the movies, overlaying the results over itself, but flipped horizontally? And then also flipped vertically, if you like. The result can be pretty trippy.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 13th August 2015, 19:17   #16  |  Link
duedel
Registered User
 
Join Date: Nov 2014
Posts: 36
Quote:
Originally Posted by feisty2 View Post
6 if with prequel trilogy
Whoosh
duedel is offline   Reply With Quote
Old 14th August 2015, 00:26   #17  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Quote:
Originally Posted by davidhorman View Post
flipped horizontally? And then also flipped vertically
I should do this to the animated How the Grinch Stole Christmas!
(There is only one of those!)

Since we're still in GD, I find with current releases, fan projects aside (of which there a millions of builds), there are Zero Star Wars.

Until Disney decides to create a DeSpecialized OT release, I only have the boxset because it was 60% off during the Christmas sales.
Though, PT has its visual qualities.

This whole thing can really help with new animated avatars (where supported).
And I think it's time to give my tumblr a nice revamp.
Tumblr people love this kind of stuff. Just add pretty hues for a border, throw in some glittery text and Twilight will live again.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 14th August 2015, 08:17   #18  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by feisty2 View Post
Code:
Function maxY (clip1, clip2)
{
...
Y = mt_merge (clip1.converttoy8 (), clip2.converttoy8 (), Mask)
U = mt_merge (clip1.utoy8 (), clip2.utoy8 (), Mask)
V = mt_merge (clip1.vtoy8 (), clip2.vtoy8 (), Mask)
YtoUV (U, V, Y)
}
The last four lines can be replaced by:
Code:
mt_merge (clip1, clip2, Mask, luma=true, U=3, V=3)
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 14th August 2015, 11:04   #19  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940


Neat to see how things can work differently.
One day I just may learn something lol.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Reply

Tags
avisynth, expirement, project, research


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.