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. |
![]() |
#221 | Link |
Registered User
Join Date: Dec 2005
Location: Denmark
Posts: 52
|
Average an entire clip, return 1 frame
Is there a filter/function/script in Avisynth that will take the average of an entire clip? That is, to create a single frame from a clip, where each pixel in the result frame is the average of all pixels in that position in the clip. The result could be a clip containing 1 frame (ie 32-bit float), or to write the result to a file, fx TIFF in 32-bit float format?
I am only aware of temporal filters that return the average of 3 to 7 frames at a time, for each frame in a clip (TemporalDegrain(), MedianBlurTemporal(), ex_median(), etc.). The next question will be if this can be done with other statistics, for example maximum, minimum, median? My objective for this is to create a single-frame mask for a clip that isolates specific areas according to the statistic - for example the areas of an image that are consistently dark for the whole scene. (assuming the clip contains a single scene) |
![]() |
![]() |
![]() |
#222 | Link | |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,675
|
Quote:
Code:
#Or to get a single frame average of all frames in a clip: AviSource("blah.avi") ClipBlend() Trim(FrameCount-1,-1) |
|
![]() |
![]() |
![]() |
#223 | Link |
Registered User
Join Date: Dec 2005
Location: Denmark
Posts: 52
|
Thanks @Reel.Deel. Spot on!
![]() Given that I have 10-bit source (YUV442P10), I assume I should use source.ConvertToStacked() as input to ClipBlend16(), to use all 10 bits in the process (assuming no overflow in the accumulator). Do I need to convert to YUV444P16 first? I'll add my vote for HBD support for ClipBlend, and option for running maximum or minimum. Internal 64-bit float accumulator would also be nice. ![]() |
![]() |
![]() |
![]() |
#224 | Link | ||
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,236
|
Quote:
Using the Reel.Deel example, in your case it would be like: Code:
#Indexing the 10bit planar source LWLibavVideoSource("whatever.mov") #Going to 16bit planar ConvertBits(16) #Go to 16bit stacked (MSB and LSB) ConverttoStacked() #Work with 16bit stacked precision ClipBlend16() #Go back to 16bit planar ConvertFromStacked() #Final result with 16bit planar precision Trim(FrameCount-1,-1) Quote:
Cheers, Frank |
||
![]() |
![]() |
![]() |
#226 | Link | |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,675
|
Quote:
![]() If you need 32-bit you can do it with expr but you will have to modify the AvgAll_16 script. |
|
![]() |
![]() |
![]() |
#228 | Link | |
Registered User
Join Date: Nov 2009
Posts: 2,375
|
Quote:
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread |
|
![]() |
![]() |
![]() |
#229 | Link | |
Registered User
Join Date: Sep 2020
Posts: 138
|
Quote:
|
|
![]() |
![]() |
![]() |
#230 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,929
|
Yes, you would match these folder names as given in script.
Or choose your own folder names and match script.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..." Last edited by Emulgator; 29th January 2023 at 19:59. |
![]() |
![]() |
![]() |
#231 | Link |
22 years and counting...
Join Date: Oct 2002
Location: Germany
Posts: 729
|
I have another syntax question.
Is there any difference between these 3 script snips: 1) Code:
PRE1=filter1() PRE2=filter2(PRE1) filter3(PRE2) Code:
filter1().filter2().filter3() Code:
filter1() filter2() filter3() It would help me to understand some of the more advanced scripts any better. ![]() |
![]() |
![]() |
![]() |
#234 | Link | |
Banana User
Join Date: Sep 2008
Posts: 1,140
|
Quote:
Anyway, why this thread is treated like "Ask any question about AvS" thread, when it's about AvS wiki?
__________________
InpaintDelogo, DoomDelogo, JerkyWEB Fixer, Standalone Faster-Whisper - AI subtitling |
|
![]() |
![]() |
![]() |
#237 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,929
|
You may want to PM Wlbert https://forum.doom9.org/member.php?u=2705
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..." |
![]() |
![]() |
![]() |
Tags |
avisynth, faq |
Thread Tools | Search this Thread |
Display Modes | |
|
|