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 12th April 2021, 12:16   #941  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
4 post not related with Avs+ moved to why MP2 files are decoded as s16?

They are related with audio decoders plugins behaviour also with standard AviSynth.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 26th April 2021, 07:23   #942  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Fieldbased vs Framebased:-
If I go through avisynth+ documentation ( assumeFieldbased(), assumeFramebased, seperateFields() , get impression that a frame of clip will consist of 2 fields. If seperateFied() was used it becomes fieldbased. For progressive input possibly assumefieldbased need to be used. In the plugin code vi.IsFieldBased() will give true. But when I querry each frame property then _FieldBased will be 0. Some confusing notation.
I looked into code of avsresize to understand how frame properties could be accessed. Then I noticed this code:
Code:
// TODO: support interlaced video through dual filter graphs.
    if (v8 && env->propNumElements(props, "_FieldBased") > 0 && env->propGetInt(props, "_FieldBased", 0, nullptr) > 0)
        throw_error("clip must be frame-based");
    if (vi.IsFieldBased())
        throw_error("clip must be frame-based");
The message one will get is not in line with the documentation I cited above. If one uses assumeFrameBased() script call how does this change?
I have also some problem of coding for getting frame properties in GetFrame section.. I had to use following which I thought as strange
Code:
PVideoFrame src = child->GetFrame(in, env);
	// did not compile
	//AVSMap * srcprop = src->getProperties();
	AVSMap&  srcprop = src->getProperties();
	if (v8 && env->propNumElements(srcprop&, "_FieldBased") > 0 && env->propGetInt(srcprop&, "_FieldBased", 0, nullptr) > 0)
		env->ThrowError("clip must be frame-based");
Is it the correct way to get frame properties?
On going through the avsresize code I found the following code
Code:
for (int p = 0; p < planes; ++p)
            env->BitBlt(ret->GetWritePtr(p), ret->GetPitch(p), frame->GetReadPtr(p), frame->GetPitch(p), frame->GetRowSize(p), vi.height);
As the height of a plane can also change why v.height was used?
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 27th April 2021, 09:53   #943  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by vcmohan View Post
On going through the avsresize code I found the following code
Code:
for (int p = 0; p < planes; ++p)
            env->BitBlt(ret->GetWritePtr(p), ret->GetPitch(p), frame->GetReadPtr(p), frame->GetPitch(p), frame->GetRowSize(p), vi.height);
As the height of a plane can also change why v.height was used?
Good catch. It won't work properly but fortunately in Avisynth+ the alignment is always O.K., so it will never run.
pinterf is offline   Reply With Quote
Old 27th April 2021, 10:05   #944  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by vcmohan View Post
I have also some problem of coding for getting frame properties in GetFrame section.. I had to use following which I thought as strange
Code:
PVideoFrame src = child->GetFrame(in, env);
	// did not compile
	//AVSMap * srcprop = src->getProperties();
	AVSMap&  srcprop = src->getProperties();
	if (v8 && env->propNumElements(srcprop&, "_FieldBased") > 0 && env->propGetInt(srcprop&, "_FieldBased", 0, nullptr) > 0)
		env->ThrowError("clip must be frame-based");
Is it the correct way to get frame properties?
Did not try but you have to implement something like this.
We are using variable 'error' which can flag success (frame property with index==0 exists)

Code:
  PVideoFrame src = child->GetFrame(n, env);
  if(v8) { // use frameprop calls only when supported
    const AVSMap* avsmap = env->getFramePropsRO(src);
    int error = 0;
    int64_t result = env->propGetInt(avsmap, "_FieldBased", 0, &error);
    if(error != 0 || result > 0) // not exists or >0
      env->ThrowError("clip must be frame-based");
  }
pinterf is offline   Reply With Quote
Old 27th April 2021, 13:10   #945  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Thanks. I want a progressive or a field separated input frame. In the script I querry isfieldseparated() or use assumefieldbased(). Framebased will mean the clip has interleaved fields. The error message in script is Frame based input is not allowed. But in coding for each frame the message will be input is fieldbased not allowed, or input must be framebased. These two are contradictory. Can the property _Fieldbased be altered to _Progressive or some such?
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 3rd May 2021, 22:32   #946  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
Is there any way for a filter to get information about other filters, for example their AddFunction parameter strings, or the short description that is returned at the end of AvisynthPluginInit3?

It occured to me that there's no built-in help for filters. I thought about writing a "Help" filter which you could call and would then tell you - either by throwing an error or generating a clip with text - about the filter you've asked it about, e.g.:

Code:
Help("FlipVertical")
...would return the short description plus a description of its parameters.

Another idea I had is that it could check for a filter called, according to a convention, something like "_help_[filtername]" (to be implemented by filter authors) which could return longer help text.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 4th May 2021, 02:07   #947  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
AvisynthPluginInit3(), I thought that it should return some info on filter name, however, some dll's return a string, some an int (0),
and not sure but think some may return void. [so basically not of much use for anything].

The Help() thing is a real good idea.
These functions from RT_Stats,
Code:
RT_InternalFunctions()
 Returns String, SPACE separated list of internal filter and function names.
 Returns "", if cannot find InternalFunctions.
 If you like a good read try this:-
  S=RT_StrReplace(RT_InternalFunctions," ",Chr(10))
  ColorBars.ScriptClip("""RT_Subtitle("%s",S,align=5,y=height+100-current_frame,expx=true,expy=true)""").killaudio

***
***
***

RT_PluginFunctions()
 Returns String, SPACE separated list of external filter and function names.
 Returns "", if cannot find PluginFunctions.
 If you like a good read try this:-
 S=RT_StrReplace(RT_PluginFunctions," ",Chr(10))
 ColorBars.ScriptClip("""RT_Subtitle("%s",S,align=5,y=height+100-current_frame,expx=true,expy=true)""").killaudio

***
***
***

RT_PluginParam(String FunctionName)
 FunctionName, String, name of Avisynth built-in or Plugin filter or function name.
 Returns "", if FunctionName Parameter string not found.
 Returns String, the Avisynth CPP Interface style argument specifier string used by Avisynth to determine argument types and optional names.
  Optional arguments have square brackets surrounding their name as in [name] and are followed by a type specifier character that gives
  the type. Unnamed arguments are not optional. eg "cc[arg1]b[arg2]i" would be two compulsory unnamed clip args, followed by optional
  'arg1' of type bool and optional 'arg2' of type int.
    # Argument type specifier strings.
      c - Video Clip
      i - Integer number
      f - Float number
      s - String
      b - boolean
      . - Any type (dot)
    # Array Specifiers
      i* - Integer Array, zero or more
      i+ - Integer Array, one or more
      .* - Any type Array, zero or more
      .+ - Any type Array, one or more
    #    Etc
   To show params:-
      colorbars().Killaudio()
      S=RT_PluginParam("RT_YStats")
      S=RT_StrReplace(S,"[",Chr(10)+"[")
      RT_Subtitle(s)
Also, 3 functions in RT_Stats AVS/FunctionLists/ folder for extracting
1] All builtin function prototypes,
2] All RT_Stats prototypes,
3] Prototypes for a dll in plugins directory. [dll is selected via FileSelector dialog box]

See source of RT_Stats, and the AVS scripts too.

however, where multiple alternative prototypes, we can only extract the first one, others dont seem to be exposed.
So, a Help() whotsit with mutliple alternatve prototypes extractable, would be a real good idea.
[eg AvsPMod (and others) could interogate valid prototypes to give user assistance, in them little yellow floating text box thingies. EDIT: Tooltips]
__________________
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; 5th May 2021 at 14:40.
StainlessS is offline   Reply With Quote
Old 6th May 2021, 14:34   #948  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
I think I asked about the MT nomeneclature and meanings long time back. But I am repeating as it is somewhat confusing to me. As I understand:
MT_SERIALIZED ensures that input and output from plugin is in serial order of frames. No multi threading whatsoever.
MT_MULTI_INSTANCE ensures that only one instance of plugin operates at any time. Therefore buffers created by constructor with pointers in class, can be safely used as temporary work to read and written by GetFrame method. The input and output can be in any order.
MT_NICE_FILTER input/ output can be in any order. several instances of GetFrame may be present simultaneously. Dangerous to use Class variables for writing.
My freq domain functions use FFTW dll which is not thread safe. While for those requiring visual inspection of output frame, I am using MT_SERIALIZED. For rest I am using MT_MULTI_INSTANCE. Is this correct way?
Instead of late binding of the DLL at run time, I have created the lib file using the def and dll. By including this in additional dependencies in link section of VC++ 2019, I am able to compile. Whether this can be thread safe?
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 8th May 2021, 13:42   #949  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
I read through avisynth wiki on the multi threading nomeneclature. I think it needs some editing. There are comments like "a bad programmer keeps in class' for MT_SERIALIZED and "large buffer space required" for MT_MULTI_INSTANCE and not much explanation for MT_NICE_FILTER. I am forced to use MT_SERIALIZED for my freq domain functions as the fft dll does not support multi threading. In that case I use buffers created by constructor. In other cases for large memory requirements can request env->Allocate. I do not see much problem. I am sure a MT_NICE_FILTER can also use large memory through env->Allocate.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 8th May 2021, 19:23   #950  |  Link
Morku
Registered User
 
Join Date: Jul 2012
Posts: 208
Someone experience something similiar?
When processing a videofile with AviSynth, it starts fine, but stops at a completely random moment without error. The processed frames won't rise anymore, the remaining time goes up forever, HDD usage stops, no CPU workload anymore. It just stops, without any error but going 'further'. As my PC got tired to do.

First I thought, it's maybe my HDD Dock, so I copied the file on my internal SSD, but same issue. Maybe I thought it's MeGUI, so I processed the file with VirtualDub2, but same issue...
So my best guess is the Avisynth/Plug-ins I use. I try to have anything up to date.
For example encode som BD content always works fine and finish.
Code:
LoadPlugin("D:\Sonstiges\Videotools\MeGUI\tools\dgindexnv\DGDecodeNV.dll")
DGSource("E:\video.dgi")
ConvertBits(8)
And thats the script with the "sporadic issue":
Code:
global MeGUI_darx = 160
global MeGUI_dary = 117

AVISource("a.avi", audio=true).AssumeFPS(25,1)

AssumeTFF()
top = Crop(0,0,-0,288)
bot = Crop(0,289,-0,-0).AddBorders(0,0,0,1)

StackVertical(top,bot)

QTGMC(Denoiser="dfttest", Preset="slow", EdiMode="NNEDI3", EdiThreads=8, Sharpness=1.0)

ConvertToYV12()

__film = last
__t0 = __film.trim(134, 281048)
__t0
This is my Avisynth Info Tool Logfile:
https://pastebin.com/C3qSz3RU

Every AVSI Script should be up to date from realfinder GitHub repo.
The source file is UT video avi 720x576 25fps YUV 4:2:2, PCM 48.0kHz stereo

I don't know how to specify and analyze any further. Since I am rarely encoding this way (but update frequently), I can't tell when it started to happen. Any idea what I could do is appreciated.

Last edited by Morku; 8th May 2021 at 19:29.
Morku is offline   Reply With Quote
Old 9th May 2021, 10:25   #951  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Nope, it doesn't happen on my end.
The only time it does actually happens is if I'm encoding with an executable remotely located on the network and there's a network problem on a switch, but again that's a rare scenario.

Can you try to give your AVS Script a spin with AVSMeter and see if it happens there as well?
FranceBB is offline   Reply With Quote
Old 9th May 2021, 11:12   #952  |  Link
Morku
Registered User
 
Join Date: Jul 2012
Posts: 208
Yes, it also happen in AVSMeter. But instead of rising ETA, adjust FPS cur = 0 (like MeGUI, VDub2) all counters just stop. "Freeze". And pressing Esc at this step, won't cancel the process and go back to cmd start. The point (processed frames) is completely random, but for this example mostly somewhere at the beginning.
Tried now an utvideo version 20.6.1 from a year ago and shorten the QTGMC to "QTGMC(Preset="Medium", EdiMode="NNEDI3", Sharpness=1.0)", but still the same issue.



It's odd...
Morku is offline   Reply With Quote
Old 9th May 2021, 11:36   #953  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
How many AVS+ MT threads are you using? I don't see a Prefetch command in your script.

If you use more than 8 threads then I would try to lower the thread number in the prefetch command.

Another thing which worked wonders for me is to force linear access to some filters. I would add
RequestLinear(rlim=50, clim=50)
right after the source filter and also after the QTGMC call because dfttest needs fftw3 which is not thread safe.
manolito is offline   Reply With Quote
Old 9th May 2021, 11:41   #954  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
Originally Posted by manolito View Post

Another thing which worked wonders for me is to force linear access to some filters. I would add
RequestLinear(rlim=50, clim=50)
right after the source filter
Yep it helped me long ago for a thing, so I would recommend it too.

@Morku... let us know, but this is indeed odd. I'm trying to pinpoint whether it's a decoding issue or if one of the filters is to blame.
Out of pure curiosity, can you make some more tests?

Test 1:

Code:
AVISource("a.avi", audio=true)
just that to see if it stops.
If it doesn't, then it's not the source, but it's one of the filters and indeed RequestLinear() as suggested by Manolito can help, so make another test with it.

Test2:
Code:
AVISource("a.avi", audio=true)
RequestLinear(rlim=50, clim=50)

#rest of the script
as suggested by Manolito.
It will slow things down a bit, but it might help.


Test 3:

Code:
FFMpegSource2("a.avi", atrack=-1)
what happens if you swap the indexer? (I know that UTVideo videos are not supposed to be indexed, but again, I'm trying to pinpoint what's causing the issue).

Feel free to make all these tests in AVSMeter so that you don't have the additional nag on your CPU to actually encode a file...

Last edited by FranceBB; 9th May 2021 at 11:43.
FranceBB is offline   Reply With Quote
Old 9th May 2021, 17:24   #955  |  Link
Morku
Registered User
 
Join Date: Jul 2012
Posts: 208
@manolito
How I can find out? I am not that knowledged that way.

Test 1: Finished successfully: https://i.imgur.com/ZOSMxfp.png
Test 2: Stopped at a very late point this time. Might be coincidence? https://i.imgur.com/yOqqYvi.png
Code:
global MeGUI_darx = 160
global MeGUI_dary = 117

AVISource("3.avi", audio=true).AssumeFPS(25,1)
RequestLinear(rlim=50, clim=50)

AssumeTFF()
top = Crop(0,0,-0,288)
bot = Crop(0,289,-0,-0).AddBorders(0,0,0,1)

StackVertical(top,bot)

QTGMC(Preset="Medium", EdiMode="NNEDI3", Sharpness=1.0)

ConvertToYV12()

__film = last
__t0 = __film.trim(134, 281048)
__t0
Test 3: Stopped at a very early point... https://i.imgur.com/FpjF9Dn.png
Code:
global MeGUI_darx = 160
global MeGUI_dary = 117

FFMpegSource2("3.avi", atrack=-1).AssumeFPS(25,1)
RequestLinear(rlim=50, clim=50)

AssumeTFF()
top = Crop(0,0,-0,288)
bot = Crop(0,289,-0,-0).AddBorders(0,0,0,1)

StackVertical(top,bot)

QTGMC(Preset="Medium", EdiMode="NNEDI3", Sharpness=1.0)

ConvertToYV12()

__film = last
__t0 = __film.trim(134, 281048)
__t0
Morku is offline   Reply With Quote
Old 9th May 2021, 17:31   #956  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
You could start by removing lines from the script,eg
MeGUI darx/y dont really need to be in there, and just adds extra fluff to the mix.

How bout
Code:
FFMpegSource2("3.avi", atrack=-1).AssumeFPS(25,1)

AssumeTFF()

QTGMC(Preset="Medium", EdiMode="NNEDI3", Sharpness=1.0)

ConvertToYV12()
If works ok, then start adding stuff back until problem. [EDIT: add back trims last]
EDIT: What version AVS+, and what version QTGMC.

EDIT: Is the height of the original clip ODD ?
(why add 1 to bottom, and deinterlace on originally odd height ???)
EDIT: No, I'm wrong, on bot clip you crop top scanline of bot, then add line to bottom of bot, but still a bit weird.

EDIT: Avoid RequestLinear if you are trying to find the bug [rather than hide it].
__________________
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; 9th May 2021 at 17:55.
StainlessS is offline   Reply With Quote
Old 9th May 2021, 19:12   #957  |  Link
Morku
Registered User
 
Join Date: Jul 2012
Posts: 208
Tried now the very basic:
Code:
AVISource("3.avi", audio=true).AssumeFPS(25,1)

QTGMC(Preset="Medium", EdiMode="NNEDI3", Sharpness=1.0)
and it stopped at 12min proceed video.

Avisynth is 3.7.0_20210111 and QTGMC v3.379, Zs_RF_Shared v1.152.

Well the sourcevideo is even and odd. I have to add bottom one, because cropping 289 won't work for chroma resolution I think. But this seems not to be the reason.

I wouldn't wonder if this is just another Windows 2004 issue. This release brought other bugs. Worst release ever.
Otherwise I would expect an error. I can even eject the HDD, because it's not in use anymore. All the Avisynth programs won't notice that the source is missing when the issue occur. Can't wait to see 21H2.
I can't remeber to had an issue like that with 1909 and prior und use the script for years (since Windows 8).

I might test older AVS releases and if I can find for QTGMC.

Last edited by Morku; 9th May 2021 at 19:19.
Morku is offline   Reply With Quote
Old 9th May 2021, 20:29   #958  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I've tried MEGUI [probably not an up to date version] on W10, and every now and again it just disappears with no error in log, think there was some AVS wrapper problem or something with current AVS+].

Quote:
and it stopped at 12min proceed video.
MeGUI or AvsMeter, or what
Yes, maybe try alternate version of QTGMC..

I'm currently screwing around with W10, trying to install 1909 on Linx 7 (1GB RAM, Win8.1) tablet, no memory for RAM disk error.
Can update from within W8.1, but not clean install from USB ISO.
__________________
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; 9th May 2021 at 20:36.
StainlessS is offline   Reply With Quote
Old 9th May 2021, 20:33   #959  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by Morku View Post
Tried now the very basic:
Code:
AVISource("3.avi", audio=true).AssumeFPS(25,1)

QTGMC(Preset="Medium", EdiMode="NNEDI3", Sharpness=1.0)
try with
Code:
ColorBars(width=720, height=576, pixel_type="yv16").AssumeFPS(25,1)

QTGMC(Preset="Medium", EdiMode="NNEDI3", Sharpness=1.0)
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 9th May 2021, 22:21   #960  |  Link
Morku
Registered User
 
Join Date: Jul 2012
Posts: 208
I reverted to AviSynth 3.5.1_20200402 and QTGMC 3.364 and it was looking promissing for a long time... but "failed" (stopped) again almost near the goal https://i.imgur.com/00NuHgZ.png

@StainlessS
All my last tests were with AVSMeter and I whish there would be error logs in MeGUI. But the Status window just stay there, Time remaining rise up, Current frames stop at a random point. Like an endless encoding.

Tomorrow I will update AVS and QTGMC to latest and test real.finder advise, but I don't have high hopes. Thanks to all.
Morku 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 17:43.


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