mpv
mpv copied to clipboard
A way to pass arbitrary user data to VapourSynth script
Expected behavior of the wanted feature
Currently the vapoursynth video filter does not accept any argument for passing arbitrary user data. This still limits what the VS script can do.
Ideally, vapoursynth can have an user-data option that contains string value. mpv passes that value to the VS script just like container_fps and others. There could be a reasonable cap of the data size like 100. Once the VS script gets the data, it can do all sorts of data extraction and transformation.
Another benefit is that instead of mpv always have to catch up to user needs for this filter, with this users can just pass whatever needed themselves, thus future requests to add more properties can reduce.
Alternative behavior of the wanted feature
Main reason I'm asking this that the current alternatives are lacking. I've tried
- Install a Lua extension that can call OS API (e.g.
winapifor Windows), set environment variable from Lua side, thenmp.commandv('set', 'vf', 'vapoursynth=mpv.vpy'). Then in mpv.vpy, try to retrieve that data withos.environ. I noticed that even the variable is correctly present in Process Explorer,os.environdoesn't have that variable. I guess even thoughos.environsays it captured the mapping first time theosmodule is imported, mpv probably loads VapourSynth and thus theosmodule before my Lua script, so changing the process environment variables in Lua doesn't work. - In Lua, write to a file (e.g.
C:\test), then load file in VS script. This works, but then 1) someone has to cleanup that file; 2) what happens if multiple mpv instances with my scripts concurrently access that file? Ideally the file name should have the current process ID in it to avoid collision, but then that further complicates the task. - Any other usual IPC mechanism such as mailslots require deep integration with the OS API, which Lua lacks.
Log File
No response
Sample Files
No response