Log in

View Full Version : Can I open the same .avs file in multiple programs simultaneously?


RRD
23rd April 2025, 19:02
Say for example I want to start multiple different video encodes with ffmpeg using the same .avs file as the source, or even open the .avs with VirtualDub while a video encode is in progress: is it possible? Will it cause issues or should I know about specific limitations?

Thanks,

StainlessS
23rd April 2025, 19:38
Try it and let us know.

It is possible that a plugin relies on it being the only current instance, however I am not aware of any that do that.
(if WE <the AVS community> were aware of such, then is likely that we would try to mitigate the problem).

EDIT: It is usual to try make a plugin multi-instance within the same avisynth process, and in doing so, will likely be also
be without problem between process instances.
Sometimes, scripts that use Global variables can cause problems, and NOT be multi-instance within a single process,
but I think that would usually not be something that usually causes problems across multiple processes.

Perhaps others would like to chime in.

[It is a good question and hopefully will produce a response from the Avisynth glitterati]

DTL
23rd April 2025, 20:05
AVS script is read-only (also read-once) file and loaded at the address space of the process only once. So it expected to be freely loaded in any number of processes. Even if it is open for editing in FAR (or may be any other text editor) it can be loaded as current (last) saved in opearting system and file system state. It is typical source of missing update - user need to press 'save file' in the text editor to send changes to file system so any next reading of this file in AVS enviromnent got updates.
Also AVS file is not locked for writing (at least for any visible time) so can be re-written at any time. This also may cause some issues because it may depend only on operating system how to route write and read requests for the same file.

So user can use also single file system file to send different scripts to different processes:

Save 1.avs
Load 1.avs in Process1
Update 1.avs
Load 1.avs in Process2

The Process1 and Process2 will load different scripts from the same 1.avs file.

hello_hello
24th April 2025, 09:42
I often save create and save scripts using AvsPmod, and then open the script with MPC-HC to run them full screen on the TV.

You can also save a script, open it with a program such as MPC-HC, modify the script and resave it, and then open it again with another instance of the same program. The first instance will continue to display the script as it was before it was modified while the second instance will display the modified version. I sometimes do that sort of thing while adding and removing filters so I can compare the results while the scripts are running in full screen mode.

coolgit
26th April 2025, 18:22
Vdub can only do one avs at a time.
If you want to do more than 1 avs then open another instance of vdub then another script editor and load the other avs.
Sometimes my PC can cope with 3 vdub, 3 avs, depending what tasks avisynth doing.

v0lt
26th April 2025, 19:24
If you are using FFmpegSource2 (or similar), you should wait until the AVS script is opened for the first time and make sure that the index file has been created. After that, you can try opening the script in different applications at the same time.

qyot27
26th April 2025, 23:43
Say for example I want to start multiple different video encodes with ffmpeg using the same .avs file as the source, or even open the .avs with VirtualDub while a video encode is in progress: is it possible? Will it cause issues or should I know about specific limitations?

Thanks,

As far as the bolded portion goes, you don't have to invoke FFmpeg multiple times for that; it supports multi-output from the same process as it is. I use it to dump input as video+audio in one file, and audio only in another file. And while in my personal example I'm just doing a copy operation, setting up actual encodes works in exactly the same way.

ffmpeg -i "$n" -vcodec copy -acodec copy -bsf:a aac_adtstoasc "${n%.*}.mp4" -vn -acodec copy -bsf:a aac_adtstoasc "${n%.*}-audio.m4a"
[-------------------normal single-output part-----------------------------] [------------------second output stuff------------------]