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 22nd January 2017, 13:37   #21  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,967
Quote:
Originally Posted by feisty2 View Post
you can actually use y8_rpn 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).
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is online now   Reply With Quote
Old 22nd January 2017, 15:52   #22  |  Link
GillesH
Registered User
 
Join Date: Dec 2013
Location: France
Posts: 60
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.
GillesH is offline   Reply With Quote
Old 22nd January 2017, 21:13   #23  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,338
Quote:
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.
stax76 is offline   Reply With Quote
Old 23rd January 2017, 09:15   #24  |  Link
GillesH
Registered User
 
Join Date: Dec 2013
Location: France
Posts: 60
stax76
Quote:
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.
GillesH is offline   Reply With Quote
Old 25th January 2017, 19:02   #25  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,194
Quote:
Originally Posted by GillesH View Post
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 is offline   Reply With Quote
Old 29th January 2017, 05:45   #26  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,194
Quote:
Originally Posted by raffriff42 View Post
Right. StaxRip has a preview window; it uses AviSynth internally; therefore it must play AviSynth scripts.

...checking source...
In AVIFile.vb & 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.

Last edited by MysteryX; 29th January 2017 at 06:11.
MysteryX is offline   Reply With Quote
Old 31st January 2017, 13:47   #27  |  Link
GillesH
Registered User
 
Join Date: Dec 2013
Location: France
Posts: 60
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
GillesH is offline   Reply With Quote
Old 31st January 2017, 15:22   #28  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,194
What I do is remote-control an instance of MPC-HC via its API. It gives limited control but it's workable.
MysteryX is offline   Reply With Quote
Old 31st January 2017, 15:50   #29  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,338
@GillesH

here is code for a basic DirectShow player I wrote in VB.NET:

http://www.mediafire.com/file/2wba44.../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.

Last edited by stax76; 31st January 2017 at 16:02.
stax76 is offline   Reply With Quote
Old 3rd February 2017, 01:12   #30  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,194
Quote:
Originally Posted by stax76 View Post
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
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

Last edited by MysteryX; 3rd February 2017 at 01:15.
MysteryX is offline   Reply With Quote
Old 3rd February 2017, 01:23   #31  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,194
Quote:
Originally Posted by stax76 View Post
here is code for a basic DirectShow player I wrote in VB.NET:

http://www.mediafire.com/file/2wba44.../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

Last edited by MysteryX; 3rd February 2017 at 01:26.
MysteryX is offline   Reply With Quote
Old 3rd February 2017, 02:09   #32  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,194
For playing audio from Avisynth in .NET, I just found the SoundPlayer class as an alternative to WMP.
https://msdn.microsoft.com/en-gb/lib...undplayer.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.
MysteryX is offline   Reply With Quote
Old 3rd February 2017, 03:01   #33  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,338
Quote:
Originally Posted by MysteryX View Post
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.

Last edited by stax76; 3rd February 2017 at 04:15.
stax76 is offline   Reply With Quote
Old 3rd February 2017, 04:23   #34  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,194
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.

Last edited by MysteryX; 3rd February 2017 at 04:29.
MysteryX is offline   Reply With Quote
Old 3rd February 2017, 06:10   #35  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,338
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.
stax76 is offline   Reply With Quote
Old 3rd February 2017, 20:56   #36  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,194
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/

Last edited by MysteryX; 3rd February 2017 at 21:11.
MysteryX is offline   Reply With Quote
Old 4th February 2017, 04:24   #37  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,338
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.
stax76 is offline   Reply With Quote
Old 4th February 2017, 12:03   #38  |  Link
GillesH
Registered User
 
Join Date: Dec 2013
Location: France
Posts: 60
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
GillesH is offline   Reply With Quote
Old 4th February 2017, 16:02   #39  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,194
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.

Last edited by MysteryX; 4th February 2017 at 16:13.
MysteryX is offline   Reply With Quote
Old 4th February 2017, 16:49   #40  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,194
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. Found any good solutions?

Last edited by MysteryX; 4th February 2017 at 16:55.
MysteryX 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 16:44.


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