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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th March 2021, 18:40   #881  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,147
Thanks pinterf!
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 21st March 2021, 15:06   #882  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,147
VideoInfo.GetPlaneWidthSubsampling and VideoInfo.GetPlaneHeightSubsampling both throw exceptions if called with a parameter of 0. Since "0" is the default parameter for GetReadPtr, etc, and so is effectively the plane ID for interleaved RGB video, could those functions be updated to return 0 if called with 0, rather than throwing an exception?

Also edit: could IsY(), IsYUV() and IsYUVA() be updated/replaced to be consistent and intuitive?
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 21st March 2021 at 19:56. Reason: typo
wonkey_monkey is offline   Reply With Quote
Old 21st March 2021, 18:43   #883  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,146
Maybe one of em should be VideoInfo.GetPlaneHeightSubsampling.

EDIT:
Code:
Function X_IsY(clip c)  { 
    # True=Single Plane 
    #     (!IsRGB)=True = Any type with Y, YUY2/YUVA/Y8 etc. 
    #     BEWARE Y8_Clip.IsYUV returns True
    c 
    IsAvsPlus ? IsY : IsAvs26 ? IsY8 : False
}
__________________
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; 21st March 2021 at 19:09.
StainlessS is offline   Reply With Quote
Old 25th March 2021, 18:21   #884  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,146
From here [Internal functions]:- http://avisynth.nl/index.php/Interna...ons#propSetInt

Not sure if this lot is correct,

Quote:
propSetInt

propSetInt(clip, string key_name, function func_obj [, integer "mode"]) AVS+

propSetFloat

propSetFloat(clip, string key_name, function func_obj [, integer "mode"]) AVS+

propSetString

propSetString(clip, string key_name, function func_obj [, integer "mode"]) AVS+

propSetArray

propSetArray(clip, string key_name, function func_obj [, integer "mode"]) AVS+
these setters accept only the specific type
Should it be more like this
Code:
propSetInt

    propSetInt(clip, string key_name, integer value [, integer "mode"])   AVS+

propSetFloat

    propSetFloat(clip, string key_name, float value  [, integer "mode"])   AVS+

propSetString

    propSetString(clip, string key_name, string value  [, integer "mode"])   AVS+

propSetArray

    propSetArray(clip, string key_name, array value  [, integer "mode"])   AVS+
    these setters accept only the specific type
Also, something seems a bit messed up here,
Quote:
propGetAsArray

propGetAsArray(clip, string key_name[, integer "index", integer "offset"]) AVS+
returns an array. For a single property array size will be 1. (only in array-aware AviSynth+ versions)

propGetAll

propGetAsArray(clip [, integer "offset"]) AVS+
returns an array. For a single property array size will be 1. (only in array-aware AviSynth+ versions)
Returns all frame properties in an array of [key-value] pairs. Array size will be 'numProps'
Each key-value pair is contained in a two dimensional subarray.
If the property value for a given key is an array again then "value" will be an array as well.
Once you have the array with all properties you can access them with the "associative" feature of AviSynth array access
Extracting from C prototypes I see this, [can only extract single C prototype]
Quote:
propGetAsArray "cs[offset]i"
EDIT: And
Quote:
propGetAll "c[offset]i"
__________________
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; 25th March 2021 at 21:10.
StainlessS is offline   Reply With Quote
Old 26th March 2021, 16:47   #885  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,853
Quote:
Originally Posted by StainlessS View Post
From here [Internal functions]:- http://avisynth.nl/index.php/Interna...ons#propSetInt

Not sure if this lot is correct,



Should it be more like this
Code:
propSetInt

    propSetInt(clip, string key_name, integer value [, integer "mode"])   AVS+

propSetFloat

    propSetFloat(clip, string key_name, float value  [, integer "mode"])   AVS+

propSetString

    propSetString(clip, string key_name, string value  [, integer "mode"])   AVS+

propSetArray

    propSetArray(clip, string key_name, array value  [, integer "mode"])   AVS+
    these setters accept only the specific type
They are O.K. These names are different only for parameter lists with function object.
Other plain propSet versions can establish the property type from the type of the provided value.

More on function objects:
http://avisynth.nl/index.php/Function_objects

EDIT: the mess with propGetAll is quick-fixed, thanks for the report.

Last edited by pinterf; 26th March 2021 at 16:54.
pinterf is offline   Reply With Quote
Old 26th March 2021, 21:42   #886  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,147
There's something very odd going on...

I was getting a crash with this script and version 3.6.1 (edit: also with 3.7.0):

Code:
Colorbars
ResampleAudio(48000) # any value
It would play back from any frame other than frame 0, but if played back (in VirtualDub) from frame 0, it would crash. It would also crash using AVSMeter (I wrote a simple plugin to GetAudio within GetFrame, so that I could benchmark audio using AVSMeter).

So I updated to 3.7.0. The good news is, no more crash (EDIT: scratch that: it still crashes from frame 0. Not if you add trim(1,0), though). The bad news is, when I playback a simple Colorbars clip (even without ResampleAudio) in VirtualDub2, the sound is all messed up, like it's clicking on and off at (very rough guess) 25Hz. EDIT: It seems to be almost exactly 40Hz. Here's an Audacity screenshot of a recording of VirtualDub2 playback:


Using my waveform plugin, the waveform looks okay, but I guess something about how VirtualDub is getting the audio is getting things messed up. Sound generated by the Tone function is similarly messed up. A Wavsource, though, is fine.

Edit: ffmpeg encoding to a file seems fine. Maybe it's a VirtualDub2 thing, but it wasn't doing it under 3.6.1.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 27th March 2021 at 01:45.
wonkey_monkey is offline   Reply With Quote
Old 26th March 2021, 22:57   #887  |  Link
Richard1485
AviSynth monkey
 
Richard1485's Avatar
 
Join Date: Feb 2010
Posts: 402
Quote:
Originally Posted by wonkey_monkey View Post
Maybe it's a VirtualDub2 thing, but it wasn't doing it under 3.6.1.
It's not VirtualDub2, though I can hear it in VirtualDub2. I can also reproduce it in ffplay on the Linux build of AviSynth+ (latest version). It seems to me to be related to bit depth.
Code:
Colorbars
ConvertAudioTo16bit() # any bit depth
It's not audible in ffplay if I comment out the second line, but it is in VirtualDub2. VirtualDub never used to like playing back audio at anything other than 16-bit (though VirtualDub2 was an improvement), so maybe VirtualDub2 converts the audio as it comes in.

Last edited by Richard1485; 26th March 2021 at 23:02.
Richard1485 is offline   Reply With Quote
Old 27th March 2021, 00:02   #888  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,147
Same with ffplay on Windows.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 27th March 2021, 09:24   #889  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,853
Quote:
Originally Posted by wonkey_monkey View Post
There's something very odd going on...

I was getting a crash with this script and version 3.6.1 (edit: also with 3.7.0):

Code:
Colorbars
ResampleAudio(48000) # any value
It would play back from any frame other than frame 0, but if played back (in VirtualDub) from frame 0, it would crash. It would also crash using AVSMeter (I wrote a simple plugin to GetAudio within GetFrame, so that I could benchmark audio using AVSMeter).
Did it crash for you even at 48000? Because in this case the filter does nothing, no conversion occurs, just calls the child (colorbars) GetAudio. Anyway, I could not make it crash, neither from avsmeter not from vdub2.
pinterf is offline   Reply With Quote
Old 27th March 2021, 13:53   #890  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,147
I could have sworn it did yesterday, but it's not doing it now.

Rates other than 48000 are still causing it to crash on the first frame.

Code:
ColorBars
ResampleAudio(44100)

# ^ crashes

ColorBars
ResampleAudio(44100)
Trim(1,0)

# ^ does not crash
Both of these are true for 3.6.1 and 3.7.0. Garbled VirtualdDub2/ffplay audio only occurs with 3.7.0 (and on ffplay only if ConvertAudioTo16Bit() or ConvertAudioTo8Bit() is used).

I removed all plugins just in case but it didn't make any difference.

EDIT: Adding a call to Amplify - even with a value of 1 - before ResampleAudio stops the crash occuring.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 27th March 2021 at 16:21.
wonkey_monkey is offline   Reply With Quote
Old 27th March 2021, 14:19   #891  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,147
Re the glitch, my previous screenshot was taken while I had my laptop's audio processing enabled which I think gave a misleading impression. Here's a closeup with processing disabled:


It happens at the positive peak every 11 positive peaks. I'm guessing some change in the code or perhaps floating point mode when compiling is causing the generated sample to go just over 1.0, which makes the glitch audible when it's converted to integer samples before sending to the sound card. Adding:

Code:
Amplify(0.99)
stops the playback glitch.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 27th March 2021 at 17:11.
wonkey_monkey is offline   Reply With Quote
Old 27th March 2021, 15:49   #892  |  Link
Richard1485
AviSynth monkey
 
Richard1485's Avatar
 
Join Date: Feb 2010
Posts: 402
Quote:
Originally Posted by wonkey_monkey View Post
Both of these are true for 3.6.1 and 3.7.0. Garbled VirtualdDub2/ffplay audio only occurs with 3.7.0 (and on ffplay only if ConvertAudioTo16Bit() or ConvertAudioTo8Bit() is used).
On my end, it occurs in ffplay with ConvertAudioTo24Bit() and ConvertAudioTo32Bit() as well.
Richard1485 is offline   Reply With Quote
Old 29th March 2021, 09:00   #893  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,853
Quote:
Originally Posted by wonkey_monkey View Post
I could have sworn it did yesterday, but it's not doing it now.

Rates other than 48000 are still causing it to crash on the first frame.

Code:
ColorBars
ResampleAudio(44100)

# ^ crashes

ColorBars
ResampleAudio(44100)
Trim(1,0)

# ^ does not crash
Both of these are true for 3.6.1 and 3.7.0. Garbled VirtualdDub2/ffplay audio only occurs with 3.7.0 (and on ffplay only if ConvertAudioTo16Bit() or ConvertAudioTo8Bit() is used).

I removed all plugins just in case but it didn't make any difference.

EDIT: Adding a call to Amplify - even with a value of 1 - before ResampleAudio stops the crash occuring.
No crash for me. Now to get any further: 32 or 64 bit Avisynth? Does it happen with SetMaxCPU("none") at the start of the script?
Which version of Virtualdub2 you are using (I'm at 44282). What are you exactly doing when vdub2 is crashing? Just load the script and press reload F2? Or File|Save audio.
I can see that after ResampleAudio, some samples can be more than 1.0, e.g. 1.00000023 but it cannot be a problem.
pinterf is offline   Reply With Quote
Old 29th March 2021, 12:29   #894  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,147
It seems to affect 64 bit Avisynth only. SetMaxCPU("none") has no effect. I'm using 44282 as well but the crash happens with ffplay.exe, as well as avsmeter64.exe and my own AVS viewer (when using a plugin that forces the fetching of audio with video - my original Waveform plugin and a completely new purpose-written one that just calls GetAudio within GetFrame). I also added a call to GetAudio to my own viewer and that let me narrow it down a little:

With the following script:

Code:
SetMaxCPU("none")
ColorBars
ResampleAudio(44100)
, the crash occurs if I attempt

Code:
clip->GetAudio(buffer, X, 1, env);
, where X is between 0 and 41. For x=42 and above, no crash.

If I change the new sample rate to 34100, it crashes with X between 0 and 39.
If I change the new sample rate to 10000, it crashes with X between 0 and 34.

Quote:
I can see that after ResampleAudio, some samples can be more than 1.0, e.g. 1.00000023 but it cannot be a problem.
I thought >1.0 samples might be the cause of the garbled playback with VirtualDub and ffplay, but may be entirely unrelated to the crash.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 29th March 2021 at 12:46.
wonkey_monkey is offline   Reply With Quote
Old 29th March 2021, 13:59   #895  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,853
Quote:
Originally Posted by wonkey_monkey View Post
It seems to affect 64 bit Avisynth only. SetMaxCPU("none") has no effect. I'm using 44282 as well but the crash happens with ffplay.exe, as well as avsmeter64.exe and my own AVS viewer (when using a plugin that forces the fetching of audio with video - my original Waveform plugin and a completely new purpose-written one that just calls GetAudio within GetFrame). I also added a call to GetAudio to my own viewer and that let me narrow it down a little:

With the following script:

Code:
SetMaxCPU("none")
ColorBars
ResampleAudio(44100)
, the crash occurs if I attempt

Code:
clip->GetAudio(buffer, X, 1, env);
, where X is between 0 and 41. For x=42 and above, no crash.

If I change the new sample rate to 34100, it crashes with X between 0 and 39.
If I change the new sample rate to 10000, it crashes with X between 0 and 34.



I thought >1.0 samples might be the cause of the garbled playback with VirtualDub and ffplay, but may be entirely unrelated to the crash.
Filter can request data for negative audio sample points in this case when we are in the very first frame. Resample is using overlapping buffers. Providing proper zeroified-samples for negative sample points is handled however when GetAudio is passing through "audio cache", so ColorBars is seeing only n>=0 audio sample requests.

EDIT: from 48000 to 44100 conversion, there is a -45 as the start parameter of GetAudio

Last edited by pinterf; 29th March 2021 at 14:02.
pinterf is offline   Reply With Quote
Old 30th March 2021, 16:46   #896  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,146
Bit more audio weirdness, StackVertical audio should be from first clip.
Code:
# Stack filters should produce audio from first clip.

CHANNELS = 2        # Try with 2 and 1

V=Colorbars.KillAudio
A1=Tone (length=30.0, frequency=440, samplerate=44100, channels=2,        type="Sine",  level=1.0)
A2=Tone (length=30.0, frequency=440, samplerate=44100, channels=CHANNELS, type="Noise", level=1.0)
V1=AudioDub(V,A1).Trim(0,-1000)
V2=AudioDub(V,A2).Trim(0,-1000)
#S=StackHorizontal(V1,V2)  # Seems OK
S=StackVertical(V1,V2)     # Wrong, CHANNELS=(2)=Audio from bottom clip, CHANNELS=(1)= maybe some mix of audio from both clips

#V1
#V2
S
EDIT: Does not occur in v2.60/2.61 std.

EDIT: DOES OCCUR in avs+ v0.1 r2772.
__________________
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; 30th March 2021 at 17:36.
StainlessS is offline   Reply With Quote
Old 31st March 2021, 00:16   #897  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 265
How much support is there for array variables? My tests indicate that currently you can
  • create an array variable: arr = [0.1, 0.2]
  • read from an array: a = arr[0]
  • loop through an array: for (i = 0, ArraySize(arr)-1, 1) { ... }

However I wasn't able to update a value to a specific index: arr[0] = 0.1

Is there a way to create an array with a specific size without listing all the values, something like arr = float_array[10]?

Thanks!
zorr is offline   Reply With Quote
Old 31st March 2021, 07:30   #898  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,853
Quote:
Originally Posted by StainlessS View Post
Bit more audio weirdness, StackVertical audio should be from first clip.
Code:
# Stack filters should produce audio from first clip.

CHANNELS = 2        # Try with 2 and 1

V=Colorbars.KillAudio
A1=Tone (length=30.0, frequency=440, samplerate=44100, channels=2,        type="Sine",  level=1.0)
A2=Tone (length=30.0, frequency=440, samplerate=44100, channels=CHANNELS, type="Noise", level=1.0)
V1=AudioDub(V,A1).Trim(0,-1000)
V2=AudioDub(V,A2).Trim(0,-1000)
#S=StackHorizontal(V1,V2)  # Seems OK
S=StackVertical(V1,V2)     # Wrong, CHANNELS=(2)=Audio from bottom clip, CHANNELS=(1)= maybe some mix of audio from both clips

#V1
#V2
S
EDIT: Does not occur in v2.60/2.61 std.

EDIT: DOES OCCUR in avs+ v0.1 r2772.
I suppose it happens only for packed RGB? Because this format has its lines upside down order, so input clip order is reversed as well. But then it has this side effect.
pinterf is offline   Reply With Quote
Old 31st March 2021, 12:56   #899  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 9,146
Well wadya know, I did not even think to try with non RGB interleaved when prob was audio, nice one P.
__________________
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 31st March 2021, 16:16   #900  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,853
Fixed, anyway.
pinterf 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 23:55.


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