Log in

View Full Version : Drag and Drop, perhaps?


DDogg
25th February 2003, 16:56
It would be great if we could drag and drop a file on an AVS like a batchfile. For example, the INFO parameter of avisynth is very useful. Let's say you wanted a drag and drop avs for the info command of avisynth. Would this be something the developers would consider implementing, or does the architecture of avisynth preclude this?:

#drag and drop info for avi files
#Info
set fname=%1% #(or whatever convention)(Imaginary)
avisource(fname).info

Unarmed
26th February 2003, 00:05
You could make a batch file that would create the .avs and then run it for you:

echo AVISource("%1").info > %temp%\info.avs
"C:\Program Files\Windows Media Player\mplayer2.exe" "%temp%\info.avs"

Then you could drag & drop onto the batch file.

Edit: It looks like you don't need the quotes around %1 on the first line for drag and drop; Windows inserts them for you.

DDogg
26th February 2003, 01:12
Very, very nice workaround. Thanks much. Works like a charm.

I still hope for a reply on the original topic.

sh0dan
27th February 2003, 09:06
This might be what you are looking for:

http://tangentsoft.net/video/asynther/

DDogg
28th February 2003, 01:14
Thanks for the reply but no, I was hoping a file dragged upon an avisynth script would read the filename in as a variable the same way a batch file does and run the AVS. Would this be so difficult to do? I am absolutely sure you would be using it all the time. :p

DD

vhelp
28th February 2003, 04:51
hi DDogg..

I'm curious.. do you mean, a user would proceed to click on an
* an .AVS file (ie, an icon w/ .avs extention ie, superman.avs)
* on a suposed container or .exe app that intercepts files,
* and reads their format (ie, .AVS and directs it to the VFAPI
.. plugin)
* thereby running AVIsynth, and as a result..
.. (give or take a little code) and (just for your scenario)
.. display some info about this .avs file ?? ?? ??

So..

scenario:
---------
* a user want to get some INFO on file: "superman.avs"
* he/she clicks it, and drags it to an AVS aware app
* as a result, AVIsynth is somehow loaded up and begins parsing/
..reading the file "superman.avs"
* as a result of this click and drag, a final display would be:

Superman AVS info:
--------------------------
Height & Width: 720x480
Length: 120 minutes
Media type: Film / 24fps
Source: mjpeg


If the above is what you're looking for, that's an interesting idea,
but you could get that by double-clicking or opening up in notepad.
Or, are you after something else all-to-gether ??

-vhelp

DDogg
28th February 2003, 09:14
Um, yes, Unarmed's workaround example shows exactly how to do that.

Simply save this in notepad as info.bat You can then drag any AVS, AVI onto it and see the information you gave in your question.

Like this:

Rem start of batchfile
@echo AVISource(%1).info > %temp%\info.avs
@"C:\Program Files\Windows Media Player\mplayer2.exe" "%temp%\info.avs"
rem end of batchfile

To answer you question more specifically, Windows is a drag and drop OS. Avisynth is used in Windows. The ability to be able to drop a file on a set of "toolkit" scripts would be a tremendous time saver. In a similar fashion, I don't even open a program to burn a disk. I just drag the CUE onto a small batchfile and it is done. Simple and elegant.

To get back to the topic, I had asked "Would this be something the developers would consider implementing, or does the architecture of avisynth preclude this?"

Look if it can't be done then so be it. If it can, and is reasonably simple, IMO, it ought to be done. As I can't do it, all I can do is ask and hope for a direct answer to my question.

sh0dan
28th February 2003, 11:13
Have you looked at the link I posted???

It makes it possible to use the "Send-To" menu to send files into templates, and create the AVS files you want.

trbarry
28th February 2003, 16:50
I think support for those same templates is also buit into VirtualdubMod. I use them to open .d2v files now.

But I don't know if that helps the drag-n-drop thing any. You can drop avi or avs files on Vdubmod but I don't think you can drop files on templates yet. This would be nicer.

- Tom

DDogg
28th February 2003, 19:14
@sh0dan, yes I use it a lot. Thanks.
...but I don't think you can drop files on templates yet. This would be nicer.
Yes, it would be much more elegant. Maybe some day.

Belgabor
28th February 2003, 21:09
Originally posted by trbarry
I think support for those same templates is also buit into VirtualdubMod. I use them to open .d2v files now.


Absolutely right. I used code from AviSynthesizer for the template engine.

I someone has a use for this I could add an option to vdubmod that pops up a window allowing selection of a template to open it with.

Cheers
Belgabor

trbarry
1st March 2003, 04:55
I someone has a use for this I could add an option to vdubmod that pops up a window allowing selection of a template to open it with.

I'd like that. :)

I guess it would just be a choice of whether the default dragondrop open behavior was open or the Open-with-Avisynth dialog. Right?

Or something else?

- Tom

DDogg
1st March 2003, 17:46
A general question:

1> When programming, what is required to make a application drag and drop aware, that is, for it to highlight when something is dragged on top of it and be passed the name of what was dragged on top of it?

Belgabor
1st March 2003, 20:40
Originally posted by trbarry
I'd like that. :)

I guess it would just be a choice of whether the default dragondrop open behavior was open or the Open-with-Avisynth dialog. Right?

Or something else?

- Tom

Yup, thats what I was thinking of :)

@DDogg: As I never implemented that myself I can only recommend to read the VDub Source on that.

DDogg
2nd March 2003, 22:23
@DDogg: As I never implemented that myself I can only recommend to read the VDub Source on that.

I was asking more about windows apps in general than vdub specific, but thanks for the reply.

Belgabor
3rd March 2003, 18:04
Originally posted by DDogg
I was asking more about windows apps in general than vdub specific, but thanks for the reply.

VDub is a windows app ;)

Atamido
4th March 2003, 02:13
Originally posted by DDogg
1> When programming, what is required to make a application drag and drop aware, that is, for it to highlight when something is dragged on top of it and be passed the name of what was dragged on top of it?

For basic VB controls, it is automatic within windows. For instance, in Visual Basic, if you create a text box within the interface, it will automatically accept text dragged to it. So, I would assume its just a matter of finding the correct control object, and defining a simple property for the window itself. But I have never done this, so I wouldn't know for sure.

You might glance at the sources for DivFix as I know it supports drag and drop of files.

NoX1911
16th August 2012, 03:02
*necrobump*

Please implement drag&drop. Filenames are passed as simple arguments to the exe/dll. It is indeed very useful.

I would use it to analyze YUV range (16..235) with histogram. Those damn (Apple/QT?) h264/MP4s are mostly 0..255 nowadays and no windows player (i'm aware of) respects the corresponding metadata (so i have to handle it manually). Histogram is a nice way to check it.

pbristow
22nd August 2012, 08:31
As I understand it, what people are asking for here is the ability to drag a video file to a particular avisynth script, and have that script executed using the video file as input. (If I've misunderstood, NoX1911, then please explain exactly what you want to do.)

Unfortunately, this is not something that can be done by making changes to Avisynth. Windows allows you to open a given file in a suitable *application*, by dragging the file and drop it onto the application.

Problem 1: An avisynth script is not an application: It's simply a text file that has to be interpreted *by* an application.

Problem 2: Even Avisynth itself is not an application: It's a frameserver designed to feed video to an application that knows what to do with the output from Avisynth.

Problem 3: Avisynth doesn't have a way of accepting filenames from the outside world to be inserted into a pre-existing script. Again, that's something that has to be done by an active application that has access to information coming from the Windows drag-and-drop interface. Avisynth isn't an application in its own right, so has no access to that.

So, to combine a video file with an avisynth script, and get it opened and read by avisynth, you need at least 4 things: The file, the script, Avisynth, and the application that calls Avisynth. But drag-and-drop only allows the user to create an association between *two* things.

Fortunately, Windows DOES provides a way to create pre-defined associations between things in a form that looks like an executable application: It's called a batch file or .BAT file. If we create a batch file to handle the relationships between our four things, then we can drag our video file onto *that*, and let it sort out the mess.

So, what people need (as I understand the oroginal post) is a batch file that:
1. Receives the name of the video file (either from the drag-and drop interface, or from a command line or some other method of invocation, the batch file doesn't care);
2. Inserts that filename into the right place in a template avisynth script, and writes the result as a new .AVS file;
3. Opens an avisynth-aware application, passing it the name of the newly created .AVS file as input.

Now, when we drag a video file to this .BAT file, it will open up our chosen application, which will see that it's being asked to open an avisynth script. The application passes the script over to Avisynth; Avisynth interprets the script and opens the video file... and at that point everything is back in the hands of the user, to tell the application what they want done next. (If the application is a video player, it might start playing the output of the script immediately. That depends on the player and how it's set up.)

*IF* the application is an editor that accepts command line arguments to tell it what to do with its input file, then you could add those into the BAT file, and create something that automatically creates an output file using the avisynth script. But that all depends on the capabilities of your video app (I only ever use Virtualdub, which I don't think allows that kind of command-line control...?).

So, to sum up: Making Avisyth scripts usable via drag-and-drop can't be done by making changes to Avisynth, but *you* can do it by writing your own batch file. :)

Zarxrax
22nd August 2012, 17:30
This can also pretty much be done with avsp or avspmod

NoX1911
22nd August 2012, 18:43
Making Avisyth scripts usable via drag-and-drop can't be done by making changes to Avisynth
Just look at zip/rar/7z extension capabilities. It just needs a wrapper or something to send the data to. They probably just don't want it in the avs core....

I will take a look at avsp or avspmod.

pbristow
23rd August 2012, 22:46
Just look at zip/rar/7z extension capabilities.

I don't see the relevance. Zips and rars and other compressed archives are opened either by *applications*, or by code added to the *operating system*. Some of those application use common libraries to handle the actual business of decompressing the data: Those *libraries* are the equivalent of AviSynth, and the .zip file is the equivalent of an avisynth script. But just like AviSynth, the libraries *have* to be invoked by something else: It's that something else - an application such as Winzip, or a virus-scanner, or whatever - that you drag and drop the .zip file onto, and which then pulls the file through the decoder library to get at the decoded data.

Now, I can drag-and drop an avisynth script on MPlayer, and that opens the output stream just fine. *That's* the equivalent to what happens when I drop a .zip file onto WinZip or 7Zip. But in the case the OP was asking about, there isn't just one source of data that would need to be dragged and dropped to get things moving, there's two: The .avs script, and the video file that needs to be passed through it. Hence...

It just needs a wrapper or something to send the data to. .

Exactly! It needs a wrapper called a .BAT file - or something else that will do the same job for you - which prepares the script for Avisynth to read and then hands it over to a suitable avisynth-aware application.

You haven't said (and neither did the OP) what you actually want done with the video output from Avisynth: Do you want it to play immediately, in real time? Then you need it to go to a video player app. Do you want it to be opened for editing? Then you need it to go to an editor app. Do you want it to be immediatley encoded as x264, or as DivX, or something else? Then you need it to be passed to a video encoder. All of those are complex bits of software with their own individual pitfalls and issues for the developers, which avisynth developers don't need to deal with because other people are already doing that. None of those tasks are the job of Avisynth; Avisynth exists to prepare video data for *any* of those applications to take as input.

That's why Avisynth *cannot* do anything without some avisynth-aware application calling it: It's designed to do only the first half of a job - or, in fact, of several different possible jobs! The 2nd half of the job varies, and will always be done by a separate piece of software designed specifically to do that part of the job, in a particular way.

Sure, somebody could write an application and we could host it here and it could be called "the Official Avisynth App" or whatever, but it would be a separate thing that serves a different purpose... And it would only be duplicating the capabilities of the other video players or editors or encoders that are already out there, and would require ongoing maintenance and development that takes time and attention away from working on Avisynth itself... So why bother?

The tools you're looking for already exist; They just aren't called AviSynth. :)

StainlessS
24th August 2012, 06:05
@PBristow,
Nuff said, if any more comeback, dont waste your breath. :)

pbristow
24th August 2012, 06:16
@PBristow,
Nuff said, if any more comeback, dont waste your breath. :)

Heh. I can't resist the urge to try to educate and inform. It runs in the family. :)

StainlessS
24th August 2012, 06:34
Arh, A True Educator Of Men. (& possibly women, but they never listen, bless'em)

NoX1911
24th August 2012, 17:46
The avisynth.dll should be able to enumerate the main function arguments of the host application (player). In combination with a registered drag&drop capable extension leading to that player and an avisynth parser able to process/substitute %1 it should work like intended. In case there's no interface providing that information there is still injection as last resort.

pbristow
24th August 2012, 18:02
Well, the beauty of open source development is that if you believe something can be done, there's nothing to stop you downloading the source and trying it yourself. Good luck!

(I'll stand by to have my hat steam-cleaned, just in case I need to eat it... ;) )