-
Notifications
You must be signed in to change notification settings - Fork 358
OpenFX Module #1186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
OpenFX Module #1186
Conversation
|
@joinlaw any chance you can show the feature in action ? (like a screencast?) |
|
demos basic-gain-plugin.webm |
|
Thank you, I can start taking a look around middle of January. I am taking a break over the holiday before some release activities at the end of the year, which is often followed by increased support. |
src/modules/openfx/filter_openfx.c
Outdated
| mlt_properties params = mlt_properties_get_data(image_effect, "mltofx_params", NULL); | ||
| mlt_properties image_effect_params = mlt_properties_get_data(image_effect, "params", NULL); | ||
|
|
||
| *format = mlt_image_rgba; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not going to accept any new code that is 8-bit only. I see OpenFX has kOfxBitDepthShort that appears to correspond to the mlt_image_rgba64 that we added in 2025. Please try to include it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 3f8f847 I add code that will use rgba64 or rgba or rgb when plugin support it.
But after converting frame to rgba64 and getting it back to yuv422 the image become black this happen to me in kdenlive and melt how can I fix this?.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide a melt command line that demonstrates this? If so, I volunteer to look into it.
| /* TODO: add support for OpenGL plugins */ | ||
| propSetString(host_properties, kOfxImageEffectPropOpenGLRenderSupported, 0, "false"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might not ever be able to support for OpenGL (or CUDA or Metal) without a good way to prevent multiple heavy data transfers between CPU and GPU RAM. For example, the Movit module and proper management by the app such as Shotcut addresses that.
No code change requested here. Just FYI to inform any future plans. I guess the key point is that OpenGL integration should not be standalone and needs to coordinate with the movit module. Also, the qglsl consumer is a way for melt to provide an OpenGL context on the render thread. Also, the future of OpenGL is also rather uncertain. The GPU tech landscape is messy.
|
I was literally just searching the progress for OFX support and I'm pleasantly surprised to see effort being made within hours ago. I guess the big question is, Is there a supposed date when I'd finally be able to use OFX plugins in kdenlive? |
|
@joinlaw I am interested in helping to sponsor this change into the code base. I intend to fetch your branch and start testing. Do you have any work-in-progress that I should have? Also, do you want any help resolving the comments above? Let me know how i can help. |
Well after this first merge request get merged the main priority is to implement OpenFX OpenGL plugins suite and DrawSuite (openfx extension something like postscript or cairo vector graphics). Once I have free time I will resolve all comments by @ddennedy and hopefully we will have basic OpenFX support so we can implement all other openfx extensions later. |
1d7cfb4 to
d3cad6a
Compare
|
Please turn off this new module in |
|
@joinlaw, can you provide more commentary about how we can help potential users get access to openfx plugins? For example, I see you are using G'MIC plugins in your working copy. I have seen previous requests for that. So, I think in order to provide that, I will need:
I haven't found binary releases on the GitHub pages. And my Unbuntu package manger does not seem to provide the OFX files (it does provide the G'MIC library). Where will users get the OFX files from to use with this module? Will KDENLIVE help users download them? |
Actually I downloaded the Natron portable package and used them also I built the example plugins nothing more than that but I have seen before few other free software plugins over the internet. I added them to the environment variable |
|
There are a lot of OpenFX plugins, many of them commercial. Besides web search there are a lot of other so-called organic means to learn about them such as special interest web sites and forums. It is a lot like the VST plugin ecosystem. Expect to potentially deal with a lot of support and troubleshoot with the diversity. Properly supporting and debugging them in host may also cost money if you want to actually provide assistance. |
bmatherly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your continued progress on this great module. I have been doing some testing and here are some comments for your consideration.
| sprintf(s, "openfx.%s", plugin_ptr->pluginIdentifier); | ||
|
|
||
| /* if colon `:` exists in plugin identifier | ||
| change it to accent sign `^` because `:` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for running clang-format. But there are still tabs sprinkled around in the block comments. I suppose clang-format does not fix those because they are in block comments. Here and some other places.
| return result; | ||
| } | ||
|
|
||
| MLT_REPOSITORY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I run melt, i always see a new information message:
[OpenColorIO Info]: Color management disabled. (Specify the $OCIO environment variable to enable.)
This message is printed even if I do not try to use any openfx filters. Is there a way to avoid the message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plugins print their logs but I think this goes to the stderr so in bash we can forward it to 2> /dev/null this is what I know but maybe there is OpenFX host property that turns off logging if plugins is implemented according to the standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to turn off logging. Here is a patch that quiets the OCIO message:
diff --git a/src/modules/openfx/factory.c b/src/modules/openfx/factory.c
index 3007ef68..ca006ef5 100644
--- a/src/modules/openfx/factory.c
+++ b/src/modules/openfx/factory.c
@@ -161,6 +161,13 @@ MLT_REPOSITORY
MltOfxHost.host = (OfxPropertySetHandle) mlt_properties_new();
mltofx_init_host_properties(MltOfxHost.host);
+ // Quiet warnings from plugins that use OCIO
+ char *ocio = getenv("OCIO");
+ if (!ocio || !strcmp(ocio, "")) {
+ // If the OCIO environment variable is not set, set it to a built-in default config
+ setenv("OCIO", "ocio://ocio://default", 1);
+ }
+
char *dir,
*openfx_path = getenv("OFX_PLUGIN_PATH"),
*load_unsupported_plugins = getenv(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put a commit here which you are welcome to cherry-pick
4cc5e4f
| const char *id, | ||
| char *arg); | ||
|
|
||
| static void plugin_mgr_destroy(mlt_properties p) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I run melt and use an openfx filter, melt always ends with a crash. Here is the gdb backtrace:
0x00007fffe6f3d385 in ?? () from /home/brian/Downloads/Natron-2.5.0-Linux-x86_64-no-installer/Plugins/OFX/Natron/Misc.ofx.bundle/Contents/Linux-x86-64/Misc.ofx
(gdb)
#0 0x00007fffe6f3d385 in ??? () at /home/brian/Downloads/Natron-2.5.0-Linux-x86_64-no-installer/Plugins/OFX/Natron/Misc.ofx.bundle/Contents/Linux-x86-64/Misc.ofx
#1 0x00007fffe7809b89 in ??? () at /home/brian/Downloads/Natron-2.5.0-Linux-x86_64-no-installer/Plugins/OFX/Natron/Misc.ofx.bundle/Contents/Linux-x86-64/Misc.ofx
#2 0x00007ffff0967b70 in plugin_mgr_destroy (p=0x555555705150) at /home/brian/shotcut/src/mlt/src/modules/openfx/factory.c:108
#3 0x00007ffff7fa2abe in clear_property (self=0x55555586e450) at /home/brian/shotcut/src/mlt/src/framework/mlt_property.c:124
#4 0x00007ffff7fa433a in mlt_property_close (self=0x55555586e450) at /home/brian/shotcut/src/mlt/src/framework/mlt_property.c:920
#5 0x00007ffff7f9fe6c in mlt_properties_close (self=0x555555561360) at /home/brian/shotcut/src/mlt/src/framework/mlt_properties.c:1508
#6 0x00007ffff7f8ab3a in mlt_factory_close () at /home/brian/shotcut/src/mlt/src/framework/mlt_factory.c:520
#7 0x000055555555b5a5 in main (argc=21, argv=0x7fffffffd8d8) at /home/brian/shotcut/src/mlt/src/melt/melt.c:1155
Do you also experience this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes I face similar issues with the git version of melt and not only openfx branch but using kdenlive does not cause this issue. I need to do more testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seem to be a handful of plugins that crash when we call
pt->mainEntry(kOfxActionUnload, NULL, NULL, NULL);
From inspection, I notice that we load and then unload all plugins while we are discovering them. Then, we load them all again when we are generating metadata - and we leave them all loaded until the program closes and we call plugin_mgr_destroy. Do you know if it is good to leave them all loaded? Does that consume extra resources? Should we try to only keep open plugins that we are using?
| if (set_host != NULL) | ||
| set_host(&MltOfxHost); | ||
|
|
||
| mlt_properties_set(result, "identifier", id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I run this command:
melt -query filter=openfx.net.sf.openfx.Mirror
Here is the result:
[OpenColorIO Info]: Color management disabled. (Specify the $OCIO environment variable to enable.)
---
schema_version: 7.0
type: filter
identifier: openfx.net.sf.openfx.Mirror
title: openfx.net.sf.openfx.Mirror
version: 1
license: GPLv2
language: en
url: "https://openeffects.org/"
creator: mr.fantastic <mrfantastic@firemail.cc>
tags:
- Video
description: Process videos using OpenFX 1.5 plugins.
parameters:
Controls:
animation: yes
flip:
type: boolean
animation: yes
title: Vertical (flip)
identifier: flip
flop:
type: boolean
animation: yes
title: Horizontal (flop)
identifier: flop
...
Bus error (core dumped)
Besides the noisy info message and crash, the metadata is ill-formed. It should be:
parameters:
- identifier: flip
type: boolean
animation: yes
title: Vertical (flip)
- identifier: flop
type: boolean
animation: yes
title: Horizontal (flop)
The "Controls" item should not be there at all. And the identifier should be first and have a hyphen. See the schema in the framework.
| mlt_position length = mlt_filter_get_length2(filter, frame); | ||
| int params_count = mlt_properties_count(params); | ||
|
|
||
| for (int i = 0; i < params_count; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been trying to test using melt. I can get the filters to work. But I can't get any parameters to work. For example, here is a command I am using:
melt test.mpr -filter openfx.net.sf.openfx.Mirror flip=1
But the image is not flipped. Any idea what might be wrong?
|
As a git submodule, now whenever I make a release source tarball I need to copy those files into it manually. That made sense for glaxnimate because it does not have a lib and was changing regularly for a while. It does not make sense for this. Leave all OpenFX dependencies external like we do for everything else today. |
I could do that but no distribution currently is distributing this headers as a package not redhat flavours, debian or arch of course there is few free/libre OpenFX hosts currently after more libre plugins and hosts developed we will see it packaged to all major distros. |
|
I see. I wonder why I vaguely recall Brian talking about a Brian, what do you want to do? Regarding git submodule, what I am saying that it is virtually including the headers in the repo since I have to copy them into the release tarball anyways. Since these intentionally do not change frequently, I am willing to accept checking them in and update manually as needed. |
I agree with your comments about other examples of 3rd party code inside our code. I think this situation qualifies for that. I prefer a thirdparty folder and put the files in our git repository. I am also OK with manually updating them from time-to-time. I think it will be infrequent - and I volunteer to help test it. Similar to ebur128, I would like our build scripts to download the latest version to compile against and only fall back to internal thirdparty files as a convenience for other developers/packagers. I wonder if there is an easy way for a developer to specify an include path for a different plugin version so that they can override the files that we choose to include. Maybe a cmake parameter? I guess that could be "extra credit". After we merge this PR, I might try to work on that. |
… ends with other postfix
…ths from environment variable
…d widget '2dsize'
- handle the Microsoft Visual C++ compiler in module CMakeLists.txt - Change every copyright to the year 2025 - Use C99 variables in the for loop initializer declare style - Clang format and include <stdbool.h> explicitly - specify which versions of OpenFX supported - mention OpenFX header files URL in mlt_openfx.c - using mlt_image and its functions in src/modules/openfx/filter_openfx.c
…t frame to the suitable format
|
Here is a proposed commit to improve the plugin detection. It limits loaded plugins to ones that support "Filter" context and support byte or short formats. I notice that there are only a couple of plugins that support short, and about a dozen that support float. Most support byte only. |


continuation on the close PR #1051 on this version unsupported plugins such as draw suite and opengl plugins are filter out so they don't appear on the plugins (filters) list.
Some plugins such as
com.genarts:OpenGLSamplePluginandnet.sf.openfx.Shadertoydoesn't returnkOfxStatErrMissingHostFeaturestatus inkOfxActionDescribeandkOfxImageEffectActionDescribeInContextOpenFX mainEntry action but they are harmless when they run because they have no effect when mentioned suits are not available.Some plugins such as
com.genarts:OpenGLSamplePlugincontain colons:in the pluginIdentifier which I replace with^(openfx.com.genarts^OpenGLSamplePlugin) to avoid any issue with MLT filters naming constraints.