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 Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th December 2020, 19:01   #81  |  Link
CrendKing
Registered User
 
Join Date: May 2019
Posts: 42
Quote:
Originally Posted by clsid View Post
I really recommend to use static linking. Pretty much every DirectShow filter uses static linking. Requiring runtimes is really annoying for distribution and also a support nightmare.
Good suggestion. I didn't bother to change the default from Visual Studio. Now you mention it, next version will be statically linked.
CrendKing is offline   Reply With Quote
Old 7th December 2020, 05:06   #82  |  Link
CrendKing
Registered User
 
Join Date: May 2019
Posts: 42
Quote:
Originally Posted by cork_OS View Post
2. Player hangs on start if this script is loaded:
The reason why it hangs is because the plugin tries to get frame on it own whenever the script is imported. However, the filter needs to import script during initialization phase to determine video info, when the source samples are not yet available. It becomes a chicken egg problem.

I could make it not hang by providing fake empty frame during initialization, and switch to real frame after, but I think you might be better just use FDecimate2 instead, if that's an option. I can give you a test build if you want.

Last edited by CrendKing; 7th December 2020 at 05:14.
CrendKing is offline   Reply With Quote
Old 7th December 2020, 14:55   #83  |  Link
cork_OS
Registered User
 
cork_OS's Avatar
 
Join Date: Mar 2016
Posts: 160
Quote:
Originally Posted by CrendKing View Post
I could make it not hang by providing fake empty frame during initialization, and switch to real frame after, but I think you might be better just use FDecimate2 instead, if that's an option. I can give you a test build if you want.
Unfortunately, FDecimate2 fails in my very simple 1-in-5 case where TDecimate instead works perfectly with default settings. Additionally, TDecimate has a very informative display (debug) mode. So it would be great to make AVSF TDecimate compatible. However, if requesting a frame on filter initialization is bad practice, maybe it's better to ask pinterf to fix TDecimate instead?

Quote:
Originally Posted by StainlessS View Post
EDIT: ApparentFPS() wil need linear access, need set as such in your SetMTMode.avs thing. [MT_SERIALIZED]
so probably best placed AFTER Prefetch().
I've added SetFilterMTMode("ApparentFPS", MT_SERIALIZED) string to script, nothing changed.
__________________
I'm infected with poor sources.

Last edited by cork_OS; 7th December 2020 at 15:06.
cork_OS is offline   Reply With Quote
Old 7th December 2020, 18:04   #84  |  Link
CrendKing
Registered User
 
Join Date: May 2019
Posts: 42
Quote:
Originally Posted by cork_OS View Post
requesting a frame on filter initialization is bad practice
It's not necessarily bad practice, because for conventional avs usage the source video file is probably always available. It is just not very compatible with the video playing use case.

You can try https://github.com/CrendKing/avisynt...ynthFilter.zip if that fixes the TDecimate problem. It shouldn't hang, and I can see FPS change to 24, but I can't guarantee if every part of TDecimate is working properly.

I'll tend to the other one later. Maybe you can submit an issue for tracking purpose?
CrendKing is offline   Reply With Quote
Old 7th December 2020, 20:53   #85  |  Link
cork_OS
Registered User
 
cork_OS's Avatar
 
Join Date: Mar 2016
Posts: 160
Quote:
Originally Posted by CrendKing View Post
You can try https://github.com/CrendKing/avisynt...ynthFilter.zip if that fixes the TDecimate problem. It shouldn't hang, and I can see FPS change to 24, but I can't guarantee if every part of TDecimate is working properly.
Thanks, it works.
Interestingly, TDecimate injected into SVP generated script doesn't hang with the previous AVSF version.
Quote:
Originally Posted by CrendKing View Post
I'll tend to the other one later. Maybe you can submit an issue for tracking purpose?
Sure, I'll do it now.
__________________
I'm infected with poor sources.
cork_OS is offline   Reply With Quote
Old 7th December 2020, 23:15   #86  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by cork_OS View Post
I've added SetFilterMTMode("ApparentFPS", MT_SERIALIZED) string to script, nothing changed.
Yeh, and how bout RequestFramesLinear() ?
__________________
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 16th October 2021, 10:26   #87  |  Link
sappyyy
Registered User
 
Join Date: Jun 2014
Posts: 3
Here's autohotkey code to control - switch on/off - avisynthfilter from the player. PotPlayer taken as an example, replace with your .avs path,
remote control should be enabled


Code:
StrPutVar(string, ByRef var, encoding)
{
    ; Ensure capacity.
    VarSetCapacity( var, StrPut(string, encoding)
        ; StrPut returns char count, but VarSetCapacity needs bytes.
        * ((encoding="utf-16"||encoding="cp1200") ? 2 : 1) )
    ; Copy or convert the string.
    return StrPut(string, &var, encoding)
}


;-------------------------------------------------------------------------------
send_WM_COPYDATA(Code, Str, WinId) { ; send string via WM_COPYDATA
;-------------------------------------------------------------------------------
    DetectHiddenWindows, On
	avsfilter := WinExist(WinId)
	VarSetCapacity(COPYDATASTRUCT, A_PtrSize * 3, 0)
    NumPut(Code, COPYDATASTRUCT)
    if Str > 0
	          {
			   Numput(StrPutVar(Str, Str, "cp0"), COPYDATASTRUCT, A_PtrSize)
			   NumPut(&Str, COPYDATASTRUCT, A_PtrSize * 2)
	           SendMessage, 0x4a, A_ScriptHwnd, &COPYDATASTRUCT,, ahk_id %avsfilter%
              }			   
	else
	SendMessage, 0x4a, A_ScriptHwnd, &COPYDATASTRUCT,, ahk_id %avsfilter%
}


#IfWinActive, ahk_exe potplayermini64.exe
Q::
DetectHiddenWindows, On
potavsfilter := WinExist("ahk_class AvsFilterRemoteControlClass ahk_exe potplayermini64.exe")

if potavsstate != %potavsfilter%
    {
    potavstoggle = 0
	Send_WM_COPYDATA(403,"C:\Progs\PotPlayer\AviSynth\work\pot.avs","ahk_class AvsFilterRemoteControlClass ahk_exe potplayermini64.exe")
    potavsstate = %potavsfilter%
	}
else   
    if potavstoggle = 1
    {
    potavstoggle = 0
    Send_WM_COPYDATA(403,"C:\Progs\PotPlayer\AviSynth\work\pot.avs","ahk_class AvsFilterRemoteControlClass ahk_exe potplayermini64.exe")
    potavsstate = %potavsfilter%
    }
    else   
    {
    potavstoggle = 1
    Send_WM_COPYDATA(403,0,"ahk_class AvsFilterRemoteControlClass ahk_exe potplayermini64.exe")
    }
return
sappyyy is offline   Reply With Quote
Old 3rd November 2022, 03:50   #88  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 605
Is it possible to get the filepath of the video being played so that we can apply per-file/folder processing? I saw this question was asked earlier by chainik_svp but didn't see to have an answer, only this:

Quote:
Originally Posted by clsid View Post
You can get filename yourself.

Enumerate filters in the graph, until you find first one that implements IFileSourceFilter interface. Then use that to query filename.

https://docs.microsoft.com/en-us/win...lesourcefilter

Also here is a test clip 720x576 square pixels 1.25:1 according to MediaInfo and MadVR, but running it through CrendKing's Avisynth filter results in slightly squished 1.22:1 aspect & MadVR reporting 1.22:1 also.

edit: how it should look:



After Avisynth plugin with propShow():



Last edited by flossy_cake; 3rd November 2022 at 04:54.
flossy_cake is offline   Reply With Quote
Old 10th November 2022, 03:16   #89  |  Link
CrendKing
Registered User
 
Join Date: May 2019
Posts: 42
Handled in GitHub. Should be fixed in v1.4.6.
CrendKing is offline   Reply With Quote
Old 10th November 2022, 14:05   #90  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 605
Thanks a lot. Looks like I'll be migrating all my scripts across and using Avisynth this way from now on

Here is a template for noobs like myself


Code:
# main.avs

AvsFilterSource() # replaces DirectShowSource() etc.

if (FindStr(AvsFilterGetSourcePath(), "Series\Comedy\(2001-2003) The Office") != 0){
    Import("The Office.avs")
}
else if (FindStr(AvsFilterGetSourcePath(), "Series\Comedy\(2005-2007) Extras") != 0){
    Import("Extras.avs")
}
else {
    AvsFilterDisconnect()
}

# FindStr() is case-sensitive.
Code:
# The Office.avs
Subtitle("Now playing: The Office", last_frame=int(5*last.FrameRate)) # show for 5 seconds
Code:
# Extras.avs
Subtitle("Now playing: Extras", last_frame=int(5*last.FrameRate))
Then in CrendKing's Avisynth filter GUI point it to main.avs.

Note that resizing works differently now since the filter passes on aspect ratio metadata to the renderer. eg. no need to scale NTSC 4:3 720x480 to 720x540, but there may be an upcoming override for that to force square pixels for backwards compatibility with existing scripts (link)

Last edited by flossy_cake; 10th November 2022 at 14:37.
flossy_cake is offline   Reply With Quote
Old 11th November 2022, 09:27   #91  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 605
Quote:
Originally Posted by flossy_cake View Post

Note that resizing works differently now since the filter passes on aspect ratio metadata to the renderer. eg. no need to scale NTSC 4:3 720x480 to 720x540, but there may be an upcoming override for that to force square pixels for backwards compatibility with existing scripts (link)

Actually letting the renderer perform the DAR correction has an added benefit in that it allows deinterlacing to be performed by the renderer (eg. MadVR's film mode and DXVA deint). Whereas if the renderer already receives the aspect-corrected 720x540 from Avisynth, the field alignment is ruined and deinterlacing cannot be done after this point.

Although it would be possible to workaround it by instead performing the DAR correction manually in MadVR using its "screen config" setting, but this is a bit convoluted and would require making multiple "screen config" profiles in MadVR.

Last edited by flossy_cake; 11th November 2022 at 09:46.
flossy_cake is offline   Reply With Quote
Old 11th November 2022, 10:17   #92  |  Link
flossy_cake
Registered User
 
Join Date: Aug 2016
Posts: 605
Spoke too soon.

It seems the Avisynth frame counter resets to 0 every time we seek. This breaks a lot of things.

*sigh*

Hoping it can be fixed, but I'm not gonna get my hopes up.
flossy_cake 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 13:37.


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