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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th May 2021, 18:49   #1  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
Waveform v2.0.2 - anti-aliasing and support for all colourspaces


Waveform v2.0.2
  • v2.0.2 adds frame property pass-through support
  • v2.0.1 fixes a minor but potentially crash-causing bug with RGB24/32/48/68 formats

Waveform is a rewrite of my old Waveform plugin with the following improvements:
  • Support for all Avisynth+ colourspaces
  • Anti-aliased waveforms
  • Fewer crashes, hopefully
  • When using "zoom" it no longer looks like the waveform is clipping if it goes out of bounds
  • Uses min/max of samples for a more accurate display of sample values
  • The "window" parameter is no longer restricted to integer values

Code:
waveform
========

An Avisynth plugin to display audio waveforms on video clips.

Usage
=====

Waveform(
  (clip)
  (float)    window = 0
  (float)    height = 1/3
  (float)    zoom   = 1
  (bool)     under  = false
  (bool)     smooth = false
  (bool      aa     = true
)


Parameters:
-----------

window (0):
    The number of frames either side to display a waveform for

height (1/3):
    >= 1 : height in pixels of waveform overlay
     < 1 : total height of waveform display as a fraction of video height (default: 0.333)

zoom (1):
    Scale up waveforms

under (false):
    Display the waveform underneath the video instead of superimposed on it

smooth (false):
    Smooth out waveforms

aa (true);
    Anti-aliasing
This image shows the effect of the "smooth" and "aa" parameters on oversampled (more samples than pixels per frame) and undersampled audio (fewer samples than pixels per frame):

__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 4th March 2024 at 23:58. Reason: Title version correction
wonkey_monkey is online now   Reply With Quote
Old 15th May 2021, 19:02   #2  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,857
Nice! Thanks!

Cu Selur
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 15th May 2021, 19:06   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,407
Ooh Luvely Jubely, and version on the zip, outstanding.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 15th May 2021, 19:24   #4  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,676
Very nice, thanks wonkey
Reel.Deel is offline   Reply With Quote
Old 2nd March 2022, 20:20   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,407
Updated WaveForm_Filmstrip(Bool Under="False") # As Wonkey suggestion,
also removed marks arg as no longer supported in v0.3 x64 or Waveform v2.0.
Works now with older version waveform and newer v2.0

Code:
Function WaveForm_FilmStrip(clip c,int "Window",Float "Height",Bool "Under",Float "Zoom",Float "SubSize",Bool "ShowAudio",Int "W",Int "H") {
/*  Waveform_FilmStrip:- by StainlessS @ Doom9 ::: https://forum.doom9.org/showthread.php?p=1965005#post1965005
        Where ShowAudio=True, Requires WaveForm v2.0 plugin (c) Wonkey_Monkey, https://forum.doom9.org/showthread.php?t=182866
           [Wonkey_Monkey, The Prince formerly known as David.]

    WARNING - Marks arg no longer a setting in WaveForm v0.3 x64 or v2.0 - so removed from WaveForm_FilmStrip
    Also, Made Under default False as Suggested by Wonkey.

    WaveForm_FilmStrip(clip c,int "Window"=0,Float "Height"=0.333,Bool "Under"=FALSE,Float "Zoom"=1.0,Float "SubSize"=0.0,Bool "ShowAudio"=True,Int "W"=-1,Int "H"=W_Based)

        Window,       Default 1 (0 <= Window <=3), Filmstrip thumbnail Images across = 2 * Window + 1.
        Height,       Default 0.333=1/3 of FilmStrip Height. See Waveform docs for more.
        Under,        Default False, If True, then audio graph stacked under video, else overlay over video.
        Zoom,         Default 1.0. Amplify audio signal for viewing (1.0=No Amp).
        SubSize,      Default 0.0(0.0 <= SubSize <= 1.0). Suggest 0.0(No Frame Number) to about 0.5. : 1.0=biggest size for current clip Height (probably too big).
        ShowAudio,    Default True. If False, Switches OFF WaveForm Display, Shows FilmStrip Only.
        W,            Default -1. Governs width of thumbnail images making up the FilmStrip.
                         -ve) Entire FilmStrip width (multiple thumbnail images based on Window arg) will be about same [smaller or equal] as input clip width.
                           0) Each FilmStrip thumbnail image is SAME size as input clip, result could be a quite wide clip.
                        Else) Each FilmStrip thumbnail image Width is set by W (best Mod 2).
        H,            Default based off W. (Suggest Dont supply H arg, let it default based on W arg. Can call with H=Undefined where will behave as if defaulting).
                        IF H is Supplied ie not defaulted THEN     H = Supplied H    # could be -ve, 0, or +ve(explicit height).
                        else                                       if W <= 0, then H = W, ELSE H = input clip height Aspect Ratio Scaled to match W.
                        Here, H could be -ve, 0, or +ve, defaulted or non defaulted.
                        Where H,
                         -ve) FilmStrip height scaled down to Aspect Ratio match FilmStrip width of individual thumbnail images.
                           0) Each FilmStrip thumbnail image Height is SAME size as input clip height.
                        Else) Each FilmStrip thumbnail image Height is set by H (best Mod 2).
*/
    Window=Default(Window,0)  Height=Max(Default(Height,0.333),0.0)  Under=Default(Under,false)  SubSize=Default(SubSize,0.0)  ShowAudio=Default(ShowAudio,True)
    W=Default(W,-1)  H=Default(H,W<=0?W:Int(W.Float/c.Width*c.Height)/2*2)
    Assert(0 <= window <= 3,"WaveForm_FilmStrip: 0 <= window <= 3")
    Assert(0.0 <= SubSize <= 1.0,"WaveForm_FilmStrip: 0.0 <= SubSize <= 1.0")
    Frms    = 1 + (2*Window)      WW=(W<0)?c.Width/(Frms*2)*2:(W==0)?c.width:W        HH=(H<0)?c.Height/(Frms*2)*2:(H==0)?c.Height:H
    sc=(WW!=c.Width||HH!=c.Height) ?c.BiCubicResize(WW,HH,b=-0.5,c=0.25) :c           scSubsSz=Round(sc.Height*SubSize)
    SSS="""Subtitle(String(current_frame,"%.0f")""" + String(scSubsSz,",SIZE=%.0f") + String((sc.Height-scSubsSz)/2.0,",Y=%.0f") + """,align=8)"""
    sc=(scSubsSz!=0)?sc.ScriptClip(SSS):sc          bc=sc.BlankClip(Length=1,Color=$000000)
    p1c=bc+sc               p2c=bc+p1c              p3c=bc+p2c
    n1c=sc.FrameCount>1?sc.Trim(1,0)+bc:bc          n2c=n1c.FrameCount>1?n1c.Trim(1,0)+bc:bc        n3c=n2c.FrameCount>1?n2c.Trim(1,0)+bc:bc
    Select(Window,sc,StackHorizontal(p1c,sc,n1c),StackHorizontal(p2c,p1c,sc,n1c,n2c),StackHorizontal(p3c,p2c,p1c,sc,n1c,n2c,n3c))
        \ .AudioDubEx(c).Trim(0,-c.FrameCount).DelayAudio(0.0)
    return (ShowAudio && HasAudio) ? WaveForm(window=Window,height=Height,under=Under,zoom=Zoom) : Last
}
Test Client
Code:
#AviSource("D:\G.avi")
Colorbars.Trim(0,-100)

WINDOW    = 3           # Frames Wide = 2 * WINDOW + 1
HEIGHT    = 0.33        # Audio graphs height, 0.333 = 1/3 of result filmstrip image height.
UNDER     = false       # True, then audio graphs stacked under video, else overlay over video.
ZOOM      = 1.0         # Amplify audio signal for viewing (1.0=No Amp).
SUBSIZE   = 0.5         # Suggest 0.0(off) to about 0.5. (0.0 <= SubSize <= 1.0) : 0.0 = No Frame Number,  1.0=biggest size for current clip Height (probably too big).
SHOWAUDIO = True        # Default True. If False, Switches OFF WaveForm Display, Shows FilmStrip Only.
W         = 264         # Default -1, (or 0 or +ve). -1 = Normal Downscale behaviour, filmstrip width ~= input clip width.
#H         = Undefined  # Undefined, Let W govern height of thumbnail images (or just dont use h=H in function call, same as h=Undefined).

###### Can Remove this lot ######
TONE      = False       # Replace Colorbars tone with selected TONETYPE tone
TONETYPE  ="NOISE"      # Pick from:- "Silence", "Sine", "Noise", "Square", "Triangle" or "Sawtooth"
TONECHANS = 5           # Tone Channels Count (test channels display)
#
(TONE)    ? AudioDub(Tone(Length=FrameCount/FrameRate,Type=TONETYPE,Channels=TONECHANS))  : Last
###### End Of Can Remove   ######
WaveForm_FilmStrip(window=WINDOW,Height=HEIGHT,under=UNDER,zoom=ZOOM,subSize=SUBSIZE,ShowAudio=SHOWAUDIO,w=W) #,h=H)
Return Last
[clickme] 1st frame of clip, 7 thumbnails wide (window=3 : thumbs = 2 * Window + 1)


EDIT:
Or with client settings
Code:
WINDOW    = 1           # Frames Wide = 2 * WINDOW + 1
HEIGHT    = 0.33        # Audio graphs height, 0.333 = 1/3 of result filmstrip image height.
UNDER     = false       # True, then audio graphs stacked under video, else overlay over video.
[click me] Last frame of clip, 3 thumbnails wide (window=1).


EDIT: This posted elsewhere, repost here
Quote:
And here with SHOWAUDIO=TRUE [but animated gif(via VDub2 export) dont have audio, so silent]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 31st July 2022 at 15:42.
StainlessS is offline   Reply With Quote
Old 2nd March 2022, 21:20   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,407
Wonkey, can you check out whats happening here, [weird horizontal lines] {ALSO: See above post}

Code:
#AviSource("D:\G.avi")
Colorbars.Trim(0,-100)

WINDOW    = 1           # Frames Wide = 2 * WINDOW + 1
HEIGHT    = 0.33        # Audio graphs height, 0.333 = 1/3 of result filmstrip image height.
UNDER     = false       # True, then audio graphs stacked under video, else overlay over video.
ZOOM      = 0.7         # Amplify audio signal for viewing (1.0=No Amp).
SUBSIZE   = 0.5         # Suggest 0.0(off) to about 0.5. (0.0 <= SubSize <= 1.0) : 0.0 = No Frame Number,  1.0=biggest size for current clip Height (probably too big).
SHOWAUDIO = True        # Default True. If False, Switches OFF WaveForm Display, Shows FilmStrip Only.
W         = 264         # Default -1, (or 0 or +ve). -1 = Normal Downscale behaviour, filmstrip width ~= input clip width.
#H         = Undefined  # Undefined, Let W govern height of thumbnail images (or just dont use h=H in function call, same as h=Undefined).

###### Can Remove this lot ######
TONE      = true       # Replace Colorbars tone with selected TONETYPE tone
TONETYPE  ="SINE"      # Pick from:- "Silence", "Sine", "Noise", "Square", "Triangle" or "Sawtooth"
TONECHANS = 5           # Tone Channels Count (test channels display)
#
(TONE)    ? AudioDub(Tone(Length=FrameCount/FrameRate,Type=TONETYPE,Channels=TONECHANS))  : Last
###### End Of Can Remove   ######
WaveForm_FilmStrip(window=WINDOW,Height=HEIGHT,under=UNDER,zoom=ZOOM,subSize=SUBSIZE,ShowAudio=SHOWAUDIO,w=W) #,h=H)
Return Last


I'de never used v2.0 as Waveform_Filmstrip did not work because of removed Marks arg.
[old v0.3 x86 did not produce the lines, I think]
EDIT: TONECHANS=4 produces 1 line, 5=2 lines, 6=3 lines.

TONECHANS=9


TONECHANS=9 UNDER=TRUE
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 2nd March 2022 at 21:44.
StainlessS is offline   Reply With Quote
Old 2nd March 2022, 22:47   #7  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
There was a small bug in the code for drawing lines when applied to interleaved RGB formats (because they're upside-down). Now fixed, link in first post updated.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is online now   Reply With Quote
Old 2nd March 2022, 22:55   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,407
Tanks WubbleYou Em,
Seems to have done the trick.

EDIT:
Perhaps I should add an anti-alias aa arg to WaveForm_FilmStrip(Bool "aa"),
and just pass it as named arg to WaveForm(aa=aa),
[without any default in WaveForm_FilmStrip(), just use Waveform default].
Anyways, if anybody wants it do as described in this edit.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 2nd March 2022 at 23:19.
StainlessS is offline   Reply With Quote
Old 15th March 2022, 16:03   #9  |  Link
mastrboy
Registered User
 
Join Date: Sep 2008
Posts: 365
Is there a download mirror available? http://horman.net/avisynth/download/waveform2.0.1.zip does not work for me, it just times out...
__________________
(i have a tendency to drunk post)
mastrboy is offline   Reply With Quote
Old 15th March 2022, 16:42   #10  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,170
Work well for me, but here a ggdrive link
https://drive.google.com/file/d/1Rmb...w?usp=drivesdk
kedautinh12 is offline   Reply With Quote
Old 15th March 2022, 16:43   #11  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,857
works here, may be https://easyupload.io/q8g8va works for you,..
(*gig* kedautinh12 was faster)
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 17th March 2022, 22:04   #12  |  Link
mastrboy
Registered User
 
Join Date: Sep 2008
Posts: 365
Thanks for sharing kedautinh12 and Selur, I was able to get the plugin now.

Not sure why I get connection timeout against the original link, I didn't do much troubleshooting other than testing 2 different browsers...
__________________
(i have a tendency to drunk post)
mastrboy is offline   Reply With Quote
Old 20th March 2022, 15:31   #13  |  Link
shae
Registered User
 
Join Date: Jun 2006
Posts: 408
So refreshing to see small DLLs.
(Even if there are minor external DLL dependencies.)

Something you barely see today.
shae is offline   Reply With Quote
Old 31st July 2022, 17:55   #14  |  Link
gispos
Registered User
 
Join Date: Oct 2018
Location: Germany
Posts: 1,097
Waveform crashes when window=1 is set. Tested with AvsPmod and VDub. Waveform(window=1)
video YV12, audio 6 channels, 32bit 48000Hz
__________________
Live and let live
gispos is offline   Reply With Quote
Old 1st August 2022, 21:52   #15  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
Coudn't reproduce. What's the source filter? Does adding

Code:
Trim(0, framecount - 1)
make any difference?
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is online now   Reply With Quote
Old 2nd August 2022, 00:48   #16  |  Link
gispos
Registered User
 
Join Date: Oct 2018
Location: Germany
Posts: 1,097
Quote:
Originally Posted by wonkey_monkey View Post
Coudn't reproduce. What's the source filter? Does adding

Code:
Trim(0, framecount - 1)
make any difference?
At the moment I can't reproduce it either. I don't know what script I had used. And there were only problems with window=1.
So forget it for now... Sorry.
__________________
Live and let live
gispos is offline   Reply With Quote
Old 13th November 2022, 01:23   #17  |  Link
SamKook
Registered User
 
Join Date: Mar 2011
Posts: 216
Nice to see an updated version, I really like audio displayed in waveform.

I was wondering if it would be possible to add something to make it very obvious when an audio channel is silent, like changing the color of the background or the line or something like that.
When it's near silent, it can take a bit to see when not zoomed in too much and with hd+ width and it's something I do a lot so would be nice to have a faster way to figure it out.
__________________
AMD Ryzen 9 5950X and EVGA RTX 3080 with G.skill 64Gb 3600 (2 16x2 kit) on Asrock X570 Taichi with Samsung 980 Pro 500Gb NVMe SSD running Win10 x64 on LG 34GN850-B 34.0" 3440 x 1440 160 Hz
SamKook is offline   Reply With Quote
Old 13th November 2022, 14:52   #18  |  Link
StvG
Registered User
 
Join Date: Jul 2018
Posts: 594
@wonkey_monkey, can you add support for frame properties passthrough?
StvG is offline   Reply With Quote
Old 13th November 2022, 16:17   #19  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,820
Does this work?

https://horman.net/avisynth/download/waveform2.0.2.zip
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is online now   Reply With Quote
Old 13th November 2022, 18:26   #20  |  Link
StvG
Registered User
 
Join Date: Jul 2018
Posts: 594
Quote:
Originally Posted by wonkey_monkey View Post
Yes, thanks.
StvG is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 14:39.


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