Log in

View Full Version : conditional filter: get currentframe audio sample/level?


protovision
9th July 2015, 20:37
I have a conditional filter that swaps between showing the main video, and the background video, using scene change detection (YDifferenceFromPrevious(clip) ).

I would also like to switch from main to background if the audio level goes low in main video, such as between songs at a concert, etc.

I didn't see anything useful in the exposed conditional-filter runtime functions, is there something I missed, or another way?

Gavino
9th July 2015, 22:20
There is nothing in the standard run-time functions to do this, but you can use Wilbert's MinMaxAudio (http://www.wilbertdijkhof.com/MinMaxAudio_v02.zip) plugin.

See here for an example of its use to detect silent frames.

StainlessS
9th July 2015, 23:18
ConditionalSelect example


Avisource("D:\avs\StarWars.avi")

C0=Levels(16,1.0,235,16,40).Subtitle("0",Size=height/3,align=5)
C1=Levels(16,1.0,235,16,90).Subtitle("1",Size=height/3,align=5)
C2=Levels(16,1.0,235,16,160).Subtitle("2",Size=height/3,align=5)
C3=Last.Subtitle("3",Size=height/3,align=5)


Script=("""
v=AudioRMS(0) # All samples all channels (framewise)
# RT_DebugF("AUDIO=%f",v,name="AUD_TEST:") # To DebugView (google)
Return (v > -25.0) ? 3 : (v > -50.0) ? 2 : (v > -100.0)? 1 : 0
""")

Last.ConditionalSelect(Script,C0,C1,C2,C3)

Return Last


@ProtoVision, how's your WOPA doing ?

protovision
14th July 2015, 17:00
thanks guys!

Stainless, the WOPR is doing well, goes by the name 'internet' now ;)