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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 4th May 2020, 23:04   #81  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Only source filter, same result with ffms2 and l-smash.
stax76 is offline   Reply With Quote
Old 4th May 2020, 23:16   #82  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by stax76 View Post
Only source filter, same result with ffms2 and l-smash.
Explicit or implicit load? Again - how did you install Avisynth?
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 4th May 2020, 23:25   #83  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Explicit load, I've not installed but uninstalled avisynth.

I just modify the path env var.

Code:
        If Not WasInitialized Then
            Package.Python.AddToPath()
            Package.AviSynth.AddToPath()
            Package.VapourSynth.AddToPath()
            WasInitialized = True
        End If
That was all to make it work for staxrip, av2pipemod and x264, child processes inherit the path.
stax76 is offline   Reply With Quote
Old 5th May 2020, 03:35   #84  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
http://git.videolan.org/?p=ffmpeg.gi...e2c2e6136931eb

Quote:
28 * Safe function used to open dynamic libs. This attempts to improve program security
29 * by removing the current directory from the dll search path. Only dll's found in the
30 * executable or system directory are allowed to be loaded.
Everything you listed as being affected uses libavformat. In such a case, say you've put AviSynth.dll in the same directory as mpv.com and mpv.exe and a simple Version() script named testver.avs,

In cmd.exe you can do:
Code:
mpv.com testver.avs
And it'll spit back the video window with the output of Version().

In bash or PowerShell, however, this will fail because those shells do not silently interpret the current directory as being on the PATH, and while you can execute mpv as a program (because Windows' filesystems and permissions systems don't map to the same execution bits that *nix does, it treats all files as executables), it won't load any other .dlls unless they're in a directory on the $PATH. But when you explicitly call the program's executable path:
Code:
./mpv.com testver.avs
It works.

Last edited by qyot27; 5th May 2020 at 03:45.
qyot27 is offline   Reply With Quote
Old 5th May 2020, 07:56   #85  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Thanks for the clarification qyot27. I don't know what I should think about overwriting Windows default behavior, appears to be over-zealous. If somebody made a feature request to enable path search via switch, do you think there is a chance it gets accepted?

If I put the tools in the same directory I confirm that it's working.

Last edited by stax76; 5th May 2020 at 08:40.
stax76 is offline   Reply With Quote
Old 5th May 2020, 08:38   #86  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
Quote:
Originally Posted by stax76 View Post
Thanks for the clarification qyot27. I don't know what I should think about overwriting Windows default behavior, appears to be over-zealous. If somebody made a feature request to enable path via switch, do you think there is a chance it gets accepted?
I highly doubt it.

However, there is a workaround. Just create symlinks in the ffmpeg/mpv/mpc directories using the Windows mklink command.
qyot27 is offline   Reply With Quote
Old 5th May 2020, 10:06   #87  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
I've never used mklink even though it appears to be a useful command. Unfortunately I'm not able to create a hardlink in a cmd admin console.

Code:
C:\Users\frank\Desktop\bin>mklink /h .\Apps\Support\mpv.net\AviSynth.dll .\Apps\Support\AviSynth.dll
The system cannot find the file specified.
Same command without /h works.
stax76 is offline   Reply With Quote
Old 5th May 2020, 10:23   #88  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
You don't want hard links, so /h not working isn't an issue.
qyot27 is offline   Reply With Quote
Old 5th May 2020, 10:56   #89  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
I successfully created soft links for AviSynth.dll and DevIL.dll in the mpv.net folder but mpv.net still does not open avs.

I think portable vapoursynth has worked in mpv.net even without soft links.

Even if I can get it work it's probably not useful for staxrip users or are soft links portable?

I can offer a portable version putting everything in the same directory, it's just not clean.
stax76 is offline   Reply With Quote
Old 5th May 2020, 11:03   #90  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Quote:
Originally Posted by stax76 View Post
Even if I can get it work it's probably not useful for staxrip users or are soft links portable?
Soft links yes, hard links no. But you can't have relative soft links I think!? So not really portable then.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 5th May 2020, 11:08   #91  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
If I could get it work with soft links staxrip could recreate the soft links whenever it notices that it was started from a new location.
stax76 is offline   Reply With Quote
Old 5th May 2020, 11:28   #92  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
I checked mpv.net portable x64 5.4.6.0 just now with AviSynth.dll in a subdirectory and a symlink to it next to mpvnet.com|exe. No issues opening a Version() script, or with one loading a local FFMS2.dll and invoking FFVideoSource.
qyot27 is offline   Reply With Quote
Old 5th May 2020, 11:37   #93  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
@qyot27 Does it affect the symlink if you copy the whole folder elsewhere?
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 5th May 2020, 11:46   #94  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
And avisynth was not located in system32? Here it's not working.

I tested now with vapoursynth, renamed the installed core folder to core- so the installed version cannot work. mpv.net opens vpy using portable vapoursynth (checked in Process Explorer). Even ffmpeg opens vpy using portable vapoursynth, but not mpc be (who cares...).
stax76 is offline   Reply With Quote
Old 5th May 2020, 11:50   #95  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
Quote:
Originally Posted by ChaosKing View Post
@qyot27 Does it affect the symlink if you copy the whole folder elsewhere?
Yeah, in that case Windows follows the symlink and does a full copy of the DLL.
qyot27 is offline   Reply With Quote
Old 5th May 2020, 12:00   #96  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
Quote:
Originally Posted by stax76 View Post
And avisynth was not located in system32? Here it's not working.

I tested now with vapoursynth, renamed the installed core folder to core- so the installed version cannot work. mpv.net opens vpy using portable vapoursynth (checked in Process Explorer). Even ffmpeg opens vpy using portable vapoursynth, but not mpc be (who cares...).
What's in system32 is a symlink to E:\Programs\AviSynth+\AviSynth64.dll, so all I have to do to disable it is rename E:\Programs\AviSynth+\AviSynth64.dll and the link can no longer find the DLL, resulting in the same error as if it wasn't installed.
qyot27 is offline   Reply With Quote
Old 5th May 2020, 12:19   #97  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Thanks for helping! I don't know what I could miss so have to give up for now.
stax76 is offline   Reply With Quote
Old 5th May 2020, 12:41   #98  |  Link
chros
Registered User
 
chros's Avatar
 
Join Date: Mar 2002
Posts: 2,323
Quote:
Originally Posted by ChaosKing View Post
Soft links yes, hard links no. But you can't have relative soft links I think!? So not really portable then.
I use hardlinks in script on Win8/10 as a normal user, but I can't use softlinks as normal user.
__________________
Ryzen 5 2600,Asus Prime b450-Plus,16GB,MSI GTX 1060 Gaming X 6GB(v398.18),Win10 LTSC 1809,MPC-BEx64+LAV+MadVR,Yamaha RX-A870,LG OLED77G2(2160p@23/24/25/29/30/50/59/60Hz) | madvr config
chros is offline   Reply With Quote
Old 5th May 2020, 17:42   #99  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
It's working now after a reboot.

The German Wikipedia article on symlinks says that Windows soft links support relative paths, I hope that this is portable across machines.

In mpv.net I added a workaround.

Code:
        bool wasAviSynthLoaded;

        void LoadLibrary(string ext)
        {
            if (!wasAviSynthLoaded && ext == "avs")
            {
                WinAPI.LoadLibrary("AviSynth.dll");
                wasAviSynthLoaded = true;
            }
        }
It's working, vapoursynth works without such workaround, reason unknown.


edit:

it's probably not portable:

https://superuser.com/questions/7560...portable-links

Last edited by stax76; 5th May 2020 at 17:49.
stax76 is offline   Reply With Quote
Old 5th May 2020, 17:52   #100  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by stax76 View Post
Code:
        bool wasAviSynthLoaded;

        void LoadLibrary(string ext)
        {
            if (!wasAviSynthLoaded && ext == "avs")
            {
                WinAPI.LoadLibrary("AviSynth.dll");
                wasAviSynthLoaded = true;
            }
        }
Did you leave out the error handling or is that the actual function?

Edit - The reason I'm asking: Is there some built-in error handling in .net when for example WinAPI.LoadLibrary("AviSynth.dll") fails?
__________________
Groucho's Avisynth Stuff

Last edited by Groucho2004; 5th May 2020 at 19:11.
Groucho2004 is offline   Reply With Quote
Reply


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 11:29.


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