View Full Version : Use Avisynth in VB.NET
GillesH
30th September 2014, 11:48
I use Avisynth and VirtualDub in a small development VB.NET.
VirtualDub is enabled in console mode (not shown) by a BackgroundWorker + Process argument with Jobs script.
Everything works fine except that I have not managed to set a ProgressBar during this process.
Do you have a solution to have the same thing as the "Show Status Windows" of VirtualDub?
A ProgressBar would be sufficient.
Thank you for your advice
raffriff42
30th September 2014, 12:13
Off top of my head, I would say:
1) Avisynth CALL plugin, execute some kind of notification to your VB.NET application.
http://forum.doom9.org/showthread.php?t=46506
https://en.wikipedia.org/wiki/.NET_Remoting
2) RT_Stats: RT_Call, similar to the above (have not worked with either one, myself)
http://forum.doom9.org/showthread.php?p=1584313#post1584313
3) Avisynth WriteFile(current_frame); your application attempts to read that file periodically.
http://avisynth.nl/index.php/WriteFile
4) VirtualDub scripting: Log void Log(string output); (VirtualDub 1.6.5+ or later)
Outputs an entry to the log at Info priority. When VirtualDub is run
from the command-line, this text will also be output to the standard
output.https://www.google.com/search?q=.net+capture+standard+out
(why are you trying to hide VirtualDub?)
GillesH
30th September 2014, 13:37
Thank you raffriff42 for these tracks.
I will explore all.
Lanes 3 and 4 seem interesting because they can be integrated into one of the AVS script or Jobs script.
And so, probably, less slow process.
What do you think?
But we must turn that into ProgressBar !!!
The Hidden option in VirtualDub is just not to hide the GUI.
Also, VirtualDub is just used for the final encoding.
Just so you know, our current application :
http://letransfert.soforums.com/t809-FILM9-Logiciel-de-Restauration-de-Films.htm
This is for the restoration of old films. It's free and and we always try to improve a new version.
I want you informed. Again thank you.
raffriff42
30th September 2014, 14:30
Hi GillesH, that sounds great.
Number 3 may not work if there is a severe file access conflict, that's why I said "attempt." You may have to try to read the file many times for each successful read. However if Avisynth spends most of its time processing and very little time writing to file, this should not be a major problem.
Number 4 looks the best to me at first glance, assuming it works.
StainLessS will have some ideas for RT_Call maybe? I imagine it could launch a tiny VB.NET console app that sends a message to your main application. True, launching so many processes might be slow.
I agree, in situations like this, you have to try all alternatives. In the course of doing so, you may stumble on something even better. Please let us know what you discover!
The Progress bar is very easy with the ProgressBar control (https://www.google.com/search?q=vb.net+progressbar), and a little math involving (current-frame / total-frames).
For an example, see my FRAFS Bench Viewer (https://sourceforge.net/projects/frafsbenchview/) application - here is the relevant source code:
https://sourceforge.net/p/frafsbenchview/svn/HEAD/tree/trunk/_frm_BenchViewer_2.vb#l944
rvs75
30th September 2014, 14:44
http://sourceforge.net/projects/avisynthui/
I don't know if you can find useful code.
StainlessS
30th September 2014, 15:37
I would imagine that it would be better to send some kind of message only every so many frames, not at every one, which could easily
be done using current_frame in one of the runtime scripting filters eg ScriptClip(). Where you could use RT_Call, or WriteFile, or my preferencial
alternative RT_WriteFile. Also note, that CallCmd() func can take a string of frame numbers where an action will be performed, and also
can call func at filter Construction and Destruction.
Snippet from CallCmd() doc
CallCmd(clip,string "Command"="", string "Frames"="",string "Insert"="",int "Digits"=6,bool "Once"=true,int "Offset"=0,
bool "Hide"=false,bool "Debug"=false,string "Open"="",string "Close"="",int "Synchronous"=7)
Command (default"")
A command string that will be executed on each frame specified by the Frames arg. Can contain a single INSERT arg character
which will be replaced by a string representing the frame number with optional OFFSET. If the command naturally contains the
INSERT character then choose a different INSERT charcter or use two INSERT characters in the Command string to escape it
(one of them will be removed in the executed command).
Frames (default "")
String to specify the frames upon which the COMMAND arg is executed.
Comments beginning with '#' can occur in the FRAMES arg, SEMICOLON Cannot be used in a comment.
SEMICOLON ";" or NewLine [Chr(10)] is used as a frame specifier terminator.
COMMA "," specifies a frame range where the 2nd range end number can be '0' meaning last frame, and eg '-4' meaning 4 frames.
"0,0" Specifies ALL frames.
Example:
FRAMES="
1 # This is a comment, calls on frame 1.
3;5;7 # Calls on frames 3 and 5 and 7, SEMICOLON is SOFT End Of Line and terminates any COMMENT.
8 # Call Frame 8 ; 10 # *** IMPORTANT *** And because of SEMICOLON also calls on Frame 10.
14,16 # Calls on frames 14 to 16, COMMA specifies a frame range.
18,20;22 # Calls on Frame range 18 to 20 and frame 22.
24,-4 # Specifies frames 24 to 27, ie 4 frames starting at frame 24.
"
EDIT: CallCmd here: http://forum.doom9.org/showthread.php?t=166063&highlight=callcmd
GillesH
30th September 2014, 17:07
Thank you for all these tips.
After some quick research, WriteFile does give an interesting file at the same time as the creation of the AVI file.
By cons, we need to recover after starting in the Process VB.NET.
Wait until the process starts VDub then read the WriteFile containing the currentframe (line by line).
I have not figured out how to synchronize the "StreamReader" WriteFile file for display.
For VDub, failed to make a Log file.
I put the following command in a script Jobs:
VirtualDub.Log ("E: \\ SCRIPT VD \\ NewScript3 \\ File.txt");
But I may have made a mistake.
Thank you and Bravo StainlessS for all your research.
Besides, I'm just a hobbyist. But I try .....
I will immerse myself in RT_Stats and CallCmd but it take me a lot of oxygen to the deep sea diving.
Thanks
raffriff42
1st October 2014, 04:22
For VDub, failed to make a Log file.
I put the following command in a script Jobs:
VirtualDub.Log ("E: \\ SCRIPT VD \\ NewScript3 \\ File.txt");
But I may have made a mistake. Yes, what VirtualDub calls the "Log" is what you see when you select View, Log in the GUI. I don't think it's a physical file - or maybe it's a temporary file. In any case you want to use the command line vdub and capture stdout to your own file (https://www.google.com/search?q=.net+capture+standard+out).
EDIT ...not to a file, since you want real time updates; to an input stream, I guess.
Example script: (save as "vdub-logtest.vdscript")
VirtualDub.SetStatus("status OK");
VirtualDub.Log("Captain's log, stardate 41153.7 ...");
Run this from the GUI: File, Run script. Then View, Log; you will see the message there.
Now run the command line vdub. C:\VirtualDub>vdub /s "vdub-logtest.vdscript"
VirtualDub CLI Video Processor Version 1.10.4 (build 35491/release) for 80x86
Copyright (C) Avery Lee 1998-2009. Licensed under GNU General Public License
Captain's log, stardate 41153.7 ...
C:\VirtualDub>
GillesH
10th October 2014, 14:27
Please let us know what you discover!
I advanced slowly.
I confirm that the "WriteFile" option may work for a ProgressBar.
Then you should read the lines of text in a loop "While Not ....."
Still much work to put it all in order.
With your guidance, the principle works.
A great thank you.
GillesH
15th January 2017, 13:04
It's always about Avisynth in VB.NET.
What is the best AVS Player to be integrated into a VB.NET application ?
It is possible with Windows Media Player, provided you configure the AVS script in RGB.
But if we want to return to the Current Frame (currentposition), it is necessary to go through the Focus of WMP.
It's very cumbersome to manage .....Important Timing !!!!
Do you have a preference for another Player ?
Of course, VirtualDub is a one solution, but it is not possible to integrate in Interface.
Which one is best suited for Visual Studio and Avisynth ?
Thanks for your advices.
raffriff42
15th January 2017, 15:08
StaxRip (https://github.com/stax76/staxrip) is written in VB.NET and plays AviSynth scripts. You might want to take a look at it. Its MIT License (https://github.com/stax76/staxrip/blob/master/License.txt) permits re-use of the code in a commercial product. As a courtesy though, be sure to give credit.
GillesH
15th January 2017, 15:43
Thanks for this info, but StaxRip is an encoder.
Is it possible to display the video ?
I am looking for a Player more powerful than WMP and better adapted for Avisynth scripts.
It's just to view the video, as in AvsPmod.
Groucho2004
15th January 2017, 17:16
Thanks for this info, but StaxRip is an encoder.No it's not. It's a frontend for all sorts of programs, multiplexers, encoders, etc, just like almost all "GUIs".
Is it possible to display the video ?I believe it has a simple preview but that's about it.
raffriff42
15th January 2017, 23:45
Right. StaxRip has a preview window; it uses AviSynth internally; therefore it must play AviSynth scripts.
...checking source...
In AVIFile.vb (https://github.com/stax76/staxrip/blob/master/General/AVIFile.vb) & VideoDrawer.vb (https://github.com/stax76/staxrip/blob/master/General/VideoDrawer.vb), it calls the Windows API to read video frames from AviSynth as Bitmaps. Nice and simple.
Motion video is not implemented, only frame-by-frame. There may be a performance problem at play speed with this (bitmap) approach.
GillesH
16th January 2017, 09:48
Thank you for your guidance. I'll look at the possibilities.
There are some very interesting ideas.
But, I believe, it no longer uses the classic Avisynth version 2.6 (only Avisynth+ and VapourSynth)
There may be a performance problem at play speed with this (bitmap) approach.
I think, too, that it will be difficult to see the result when there are temporal filters, and therefore, when the computation is performed on several successive images.
In this case, a Player with the image stream is required.
MysteryX
21st January 2017, 03:08
Here's an idea. How about using AvsFilterNet to create a VB.NET plugin that notifies your UI via inter process communication? Then you insert that plugin at the end of the script.
https://github.com/mysteryx93/AvsFilterNet
See the InterProcessSample for an example of such inter process communication within a filter.
stax76
22nd January 2017, 03:44
for playback there is also a library called directshownet, probably it includes a simple playback example app.
MysteryX
22nd January 2017, 04:04
I'll add that the .NET plugin idea has the advantage of allowing for greater control and communication with the script: you're able to not only send progress status, but also video frame information and other relevant data from within the script straight to your application. Otherwise, to get the FPS or resolution of a script, you have to write to a file and then read the file, which is not very convenient nor scaleable. You'd be able to control both the UI outside the script and within the script itself.
However, I haven't tested the error handling code of AvsFilterNet much and there might still be a few tweaks to handle some errors correctly.
GillesH
22nd January 2017, 10:21
Thanks for your advices.
library called directshownet
Regarding DirectShow, it is necessary to check whether the future will remain compatible.
Because, except for my error, this solution is no longer supported by Microsoft.
But it is necessary to analyze ....
using AvsFilterNet to create a VB.NET
The idea of being able to write an AVS Plugin in VB.NET is excellent.
We're not all super-developers in C++ or C#. Me the first !!!!
This is why a small VB.NET example would be very useful. Thank you in advance.
feisty2
22nd January 2017, 11:17
The idea of being able to write an AVS Plugin in VB.NET is excellent.
We're not all super-developers in C++ or C#. Me the first !!!!
This is why a small VB.NET example would be very useful. Thank you in advance.
you can actually use y8_rpn (http://forum.doom9.org/showthread.php?t=172601) to write filters directly in avisynth if C++ is the big problem here (modern C++ is actually pretty easy tho, automatic type deduction, nested function definition (lambdas) and stuff, it's totally possible to do Python-style programming in modern C++, and example here (https://github.com/IFeelBloated/Fix-Telecined-Fades/blob/d43ff7c7c5d308fbe77eefcebb6f82920a9dd6fc/Source.cpp).)
wonkey_monkey
22nd January 2017, 13:37
you can actually use y8_rpn (http://forum.doom9.org/showthread.php?t=172601) to write filters directly in avisynth if C++ is the big problem here
Someone remembers!
Perhaps worth noting though that there are some things rgba_rpn/y8_rpn can't do, or at the very least would be completely impractical to do. Also while it's fast, it is extremely unlikely to be optimal compared to a bespoke C++ filer.
There is a new version coming soon with YV24 and YV12 support (the latter will come with certain necessary restrictions).
GillesH
22nd January 2017, 15:52
MysteryX
About AvsFilterNET :
With the link, we have access to the AvsFilterNET Code (GitHub).
But where is the update (7 months ago) of the file AvsFilterNET.dll ?
We find that of SAPikachu dated 27 February 2011 (AvsFilterNet r62998).
But where is the last ?
Another question: your version is, a priori, dedicated to Avisynth+. Is it usable with Avisynth 2.6 ?
Thank.
stax76
22nd January 2017, 21:13
Regarding DirectShow, it is necessary to check whether the future will remain compatible.
Because, except for my error, this solution is no longer supported by Microsoft.
But it is necessary to analyze ....
You mean you are afraid Microsoft will remove DirectShow from Windows? As far as I know they never removed a old but popular API and they are very serious about backward compatibility. The successor Media Foundation is largely compatible as far as I know.
GillesH
23rd January 2017, 09:15
stax76
you are afraid Microsoft will remove DirectShow from Windows
To my knowledge, the last DirectShowNET is from 22/02/2010 (DirectShowLibV2-1 version).
In the ZIP file, there is a Docs directory with 2 files (including 1 in French ... Ouf !!).
In the ReadMe.rtf file, the following is noted:
"What’s more, MS has dropped support for this solution"
Unless otherwise stated, DirectShow also depends on the development of DirectX.
And DirectX is no longer supported by Microsoft since June 2010.
Google search : "Where is the DirectX SDK (2015 Edition) ?"
"As noted on MSDN, the DirectX SDK is deprecated"
But, perhaps, that is still usable, especially with Windows SDK. But, I have not tried .....
This being so, congratulations for this StaxRip.
MysteryX
25th January 2017, 19:02
MysteryX
About AvsFilterNET :
With the link, we have access to the AvsFilterNET Code (GitHub).
But where is the update (7 months ago) of the file AvsFilterNET.dll ?
We find that of SAPikachu dated 27 February 2011 (AvsFilterNet r62998).
But where is the last ?
Another question: your version is, a priori, dedicated to Avisynth+. Is it usable with Avisynth 2.6 ?
Thank.
My changes haven't been merged into SAPikachu's branch, you have to get it from my repository.
It supports both Avisynth+ and Avisynth 2.6. It uses the headers of Avisynth+ which are compatible with both.
y8_rpn might make development a bit simpler but it won't provide easy cross-process communication the way VB.NET does.
MysteryX
29th January 2017, 05:45
Right. StaxRip has a preview window; it uses AviSynth internally; therefore it must play AviSynth scripts.
...checking source...
In AVIFile.vb (https://github.com/stax76/staxrip/blob/master/General/AVIFile.vb) & VideoDrawer.vb (https://github.com/stax76/staxrip/blob/master/General/VideoDrawer.vb), it calls the Windows API to read video frames from AviSynth as Bitmaps. Nice and simple.
Motion video is not implemented, only frame-by-frame. There may be a performance problem at play speed with this (bitmap) approach.
What would it take to play an Avisynth script in .NET without using a Windows Media Player control? The only .NET player I know is MPDN and it's not open source... can't find anything else doing such a thing.
Edit: I probably won't want to do that... if I get something in .NET that plays like VirtualDub, it doesn't allow video resizing and fullscreen, and doesn't allow SVP to hook into the rendering chain. There's probably a lot of work required to get that to work like a media player.
GillesH
31st January 2017, 13:47
Hello MysteryX
Yes, it's not easy to find a VB.NET Player for AVS scripts.
I tried WMP. It's OK, but it is slow, and some commands are only accessible by the Focus for an AVS script.
DirectX is no longer current. Too bad !
One of the few solutions I tested is the "mciSendString", but it's hyper-complicated to implement in a PictureBox (video resizing, etc..).
For now, not found better than VirtualDub in terms of reactivity, but it is not possible to include in the Interface.
___________________
Film9 (http://www.film9.org)
MysteryX
31st January 2017, 15:22
What I do is remote-control an instance of MPC-HC via its API. It gives limited control but it's workable.
stax76
31st January 2017, 15:50
@GillesH
here is code for a basic DirectShow player I wrote in VB.NET:
http://www.mediafire.com/file/2wba44zaqq5k0xn/StaxPlayer.7z
I used SharpDevelop 4.4 to automatically convert the DirectShowNet pinvoke code from C# to VB.NET
@MysteryX
What kind of API has MPC? It would be cool if it had a real scripting API like MediaMonkey 5 (JS V8), Kodi (Python) or VLC (Lua), personally I would try to use the Chakra API.
MysteryX
3rd February 2017, 01:12
What kind of API has MPC? It would be cool if it had a real scripting API like MediaMonkey 5 (JS V8), Kodi (Python) or VLC (Lua), personally I would try to use the Chakra API.
MPC-HC has basic API using Windows messaging API. It's limited; kind of "shoot the message in the dark and hope something happens". Sometimes playback doesn't start when asked; then I set a timer and try again after a few seconds if it didn't take my command.
http://forum.doom9.org/archive/index.php/t-134336.html
I found some VB.NET wrapper code around this written in Italian and I customized it. I can send you the code if you're interested. I don't have the link of where I got it from.
Also to save you some time, if you're going to use WMP in VB.NET, you need to register the AVS extension so that it recognizes it. Your application isn't authorized to make such changes to the registry, so you must do it during setup. If using Inno Setup, add this code
[Registry]
Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Multimedia\WMPlayer\Extensions\.avs\"; ValueType: string; ValueName: "PerceivedType"; ValueData: "video"; Flags: createvalueifdoesntexist
Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Multimedia\WMPlayer\Extensions\.avs\"; ValueType: dword; ValueName: "Permissions"; ValueData: "$0000000f"; Flags: createvalueifdoesntexist
Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Multimedia\WMPlayer\Extensions\.avs\"; ValueType: dword; ValueName: "Runtime"; ValueData: "$00000007"; Flags: createvalueifdoesntexist
MysteryX
3rd February 2017, 01:23
here is code for a basic DirectShow player I wrote in VB.NET:
http://www.mediafire.com/file/2wba44zaqq5k0xn/StaxPlayer.7z
Nice black box but... how do you actually play something in it?
It would be really nice if there was a cross-platform .NET player control that can be embedded into any application or platform using either the .NET Framework or MONO, and that is compatible with both SVP and madVR ... but Christmas isn't until next year
MysteryX
3rd February 2017, 02:09
For playing audio from Avisynth in .NET, I just found the SoundPlayer class as an alternative to WMP.
https://msdn.microsoft.com/en-gb/library/system.media.soundplayer.aspx
However, it can only read a WAV file. Perhaps AVFS would allow to read it anyway? That approach seems kind of hacky for a deployed app to mount into the root folder.
stax76
3rd February 2017, 03:01
Nice black box but... how do you actually play something in it?
It would be really nice if there was a cross-platform .NET player control that can be embedded into any application or platform using either the .NET Framework or MONO, and that is compatible with both SVP and madVR ... but Christmas isn't until next year
It's actually my main player I use for 99% of all videos since a couple of years, it has only OSD, Drag & Drop, CLI and shortcut keys interface, there is a context menu but no play controls or main menu, I control it with shortcut keys, it can open files by CLI and drag & drop both supporting multiple files as playlist, F1 shows the shortcut keys, they are hardcoded like the graph building with LAV Filters and regular EVR. Context menu lists only the loaded filters and allows to open the filter's properties dialog. F1 shows the keys.
As far as I know it's the only open source .NET DirectShow video player, MPC maybe the only other open source DirectShow video player, my C++ knowledge was and still is basic so working with MPC wasn't the most simple option for me.
MysteryX
3rd February 2017, 04:23
I compiled in x86 and I tried opening an Avisynth file in it and got:
Exception thrown: 'System.Runtime.InteropServices.COMException' in StaxPlayer.exe
Additional information: The request is invalid because Shutdown() has been called.
SVP also doesn't hook up into it. Would it be difficult to allow SVP and madVR to integrate?
But anyway... the main issue I'm having with my setup is regular crashes, but that's not due to MPC-HC anyway. I believe it's due to a bug in ffdshow. Using yours wouldn't solve that; and I still would need to run it into a separate process to kill it when it hangs.
stax76
3rd February 2017, 06:10
Maybe the crash is because I use x64, I looked at the code and it looks like EVR being the only filter added manually to the graph and the rest is handled by the system, by default DirectShow would use a crappy old renderer prior EVR. Custom graph building can be done but needs some knowledge about DirectShow, needed pinvoke interfaces are probably there so you just need to know how to use them, code is in the 'PlayFile' method.
MysteryX
3rd February 2017, 20:56
I don't know how much more time you want to put into this player but here are my thoughts. It seems you've done the hardest job already and you're proficient with DirectShow.
Windows Media Player is fine to view videos or play Avisynth scripts within an application. MPC-HC is fine to play them in a separate process. I use WMP for AVS preview, and MPC-HC for playback with SVP+madVR.
The problems are...
1. It's limited to Windows x86. It won't work in x64, nor be cross-platform with MONO.
2. SVP hooking into MPC-HC via ffdshow causes regular crashes when resetting the cache (on seek).
Adding support for ffdshow might be an option for you, but that would leave the same existing problems: constant crashes, and lack of support for x64 (due to other bugs in ffdshow x64).
The developers of SVP are actively developing it and are looking for other ways to support x64 playback (and also work on non-Windows platforms). If you'd provide them an interface to hook into without using ffdshow, I'm sure they'd be willing to work with you to make SVP use your interface -- because they haven't solved the x64 support problem yet.
Another approach, perhaps even better, is to add Windows support and these features to Banshee. It's a C# Open Source media player that is the default player on Linux, but its Windows support is still in beta. Both a stand-alone player and a control within an application are useful.
http://banshee.fm/
stax76
4th February 2017, 04:24
staxplayer is my personal only player and I don't miss features at the moment.
since there isn't much similar code around I should probably upload the code to my githup repo, and few other codes also, problem is I'm by no means proficient with git, so far I only use it far staxrip, I have git integrated in Visual Studio and use that for staxrip, I've also used the desktop app, it's a well done app, I know most use the command shell for git, my command shell knowledge is another thing I need to work on, actually it's currently a topic of interest of mine, I was learning powershell lately for instance, PS runs also on linux as far as I know just as bash runs on Windows nowadays.
I heard of Banshee, GTK# and gstreamer based as far as I know, I'm a MediaMonkey user since 10 years and nowadays post much more in the MediaMonkey forums than here at doom9. Since you are interested in cross platform I can recommend you MediaMonkey 5, still alpha, v5 is a complete re-implementation of the GUI with Chromium, Linux support is probably far away but they have definitively plans for Mac, far away also but they'll get there.
I notice your logo, sold a book last week (converting everything from paper to ebook), it was comic version of Tao Te Ching and since I had the last copy in amazon.de I got 40€, in the us it's only 9$, found it a lot easier to read then the original.
GillesH
4th February 2017, 12:03
Thanks to MysteryX and stax76 for their remarks and their respective skills.
I have studied their proposals and other research, but for now I do not really find a good solution.
WMP is very simple to use with AVS scripts, but it is not reactive.
This is very good for a simple reading. But if we want to make a freeze on image, then a return on this image after adjustment of the script, it is laborious.
It takes a minimum of 4 to 5 seconds to reposition itself on the image (and with a very simple script). It's too long to make adjustments ...
I studied the old mciSendString MCI API solution that still works on Visual Studio 2015.
It's a bit better reactive than WMP, but you have to go through PictureBox and hundreds of lines of codes. Too complicated....
I do not question the very good development StaxPlayer, but for me, it is also very complicated to implement DirectShow.
I dream of a much faster WMP with commands adapted to the scripts. But, a priori, the reality is still far .....
___________________
Film9 (http://www.film9.org)
MysteryX
4th February 2017, 16:02
I use WMP for preview. You can send it command to freeze at a specified position. However...
1. The frame won't be exact; it will move within a 2 seconds range of the specified position
2. It takes a few seconds to display it.
If you want immediate display frame by frame, you can use the approach mentioned earlier. If you want real-time playback, you can use WMP. Actually, I generally use MPC-HC for final preview because WMP requires converting to RGB and MPC-HC is the only option allowing to detect color matrix shift.
If you trim your video to a single frame, WMP will probably display it much faster -- and it will display that exact frame.
Or, another approach would be to call ImageWriter in the script, and then reading and displaying the image file. Or, creating a VB.NET plugin that calls a service with the frame data.
MysteryX
4th February 2017, 16:49
I actually really like the idea of creating a .NET service to receive frame data. It would take 2 parameters: clip id and info, and frame data.
Then I'd create a .NET plugin to send the frame to the service. At the end of the script, I would TRIM and call this plugin. Be careful with temporal plugins: necessary frames must be available and trimmed after.
This would allow quick display without needing to fill a buffer with unnecessary frames. It would display the exact image without resize or stretching. I'd be able to compare Script1, Script2, Script3 and Original side-by-side, pan/zoom on the different views at the same time, and even perform a diff on 2 versions of the script. MT would be disabled, and running 4 scripts would run on 4 cores, so the display of all 4 scripts would still be quick.
Might put that on my todo list; but got a lot of other priorities.
Unless there's a way of calling Avisynth directly in .NET without needing to insert a plugin within the script? Stax76, I see you inquired into this (http://forum.doom9.org/showthread.php?t=172127). Found any good solutions?
forclip
4th February 2017, 20:54
Few years ago I wrote a simple AviSynth player class (https://github.com/svn2github/xvid4psp/blob/master/classes/AviSynthPlayer.cs) for XviD4PSP 5 (C# + WPF). It uses AviSynthWrapper.dll to retrieve video and audio data, handles video- and audio- playing threads, draws the video on WPF surface (InteropBitmap or WriteableBitmap, RGB32), optionally outputs the audio with DirectX\DirectSound. The script can be a file or text string.
XviD4PSP 5 also can use DirectShow (https://github.com/svn2github/xvid4psp/blob/master/windows/MainWindow.xaml.cs#L5034) to play AviSynth's scripts (stored in file) and actually uses it by default. If anyone want to try how both player engines works and don't want to install - PM me.
https://s27.postimg.org/f0eb7savz/vp2.jpg (https://s27.postimg.org/okxxuo083/vp2.jpg)
stax76
4th February 2017, 21:34
Unless there's a way of calling Avisynth directly in .NET without needing to insert a plugin within the script? Stax76, I see you inquired into this. Found any good solutions?
I don't have requirements for staxrip that would need to call AviSynth directly, as far as I know AviSynth has only a C++ interface and no C or COM+ interface that would allow a .NET host to call it directly. If I remember right then megui uses a wrapper dll from the C++ interface to C interface and the managed code calls the C interface then. If it's important to you then you could talk to pinterf about it, if I remember right then you know C++ so you could ask pinterf if he would accept a pull request.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.