Add transform with motion blur effect - #1301
Draft
RocketJannis wants to merge 5 commits into
Draft
RocketJannis wants to merge 5 commits into
RocketJannis wants to merge 5 commits into
Conversation
This filter is based on the same concept as qtblend but with added motion blur. Motion blur is achieved by sampling the source image multiple times. The filter supports the basic transforms: rect translation, rotation, opacity. It also supports changing the shutter angle (changes blur amount) and used sample count. Flow: 1. compute whether blur is necessary (only transform when if is no motion in the current frame or shutter angle is set to 0) 2. compute the contribution of one sample (build_weighted_source) 3. sample weighted source multiple times to build the blurred image 4. apply opacity to the final image if set below 1 mlt_slices_run_normal is used to parallelize the expensive sampling step
build_weighted_source was the primary performance bottleneck in the implementation
Member
|
It is a great idea and prototype! People have longed for this. However, a couple of things. If separate, users will expect it to be as functional as the regular transform. So, it will grow to approach parity with qtblend. Secondly, I am not accepting many new effects into MLT and prefer people to contribute to FFmpeg or to port it to frei0r or OpenFX plugin APIs to maintain it independently. I strongly encourage to support >8-bit and OpenFX supports this as well as integration with MLT slices. You do not need to make a custom UI in an OpenFX implementation, and MLT does not support that yet anyway. It will be better for Kdenlive users if integrated into qtblend. Even when Kdenlive adds support for OpenFX, it is less convenient. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello, I did an implementation of a new video effect which does a similar thing as
filter_qtblendbut adding motion blur to the transform. I did this primarily because I miss a motion blur transform filter in Kdenlive.How it works conceptually: It samples the animated image multiple times with alpha onto itself resulting in an image blurred correctly by its motion
How it works technically:
Optimizations: both step 3 and 4 are parallelized individually via
mlt_slices_run_normalto improve performanceI use this XML to integrate it into kdenlive: transformblur.xml
A question I had: Would it be better to integrate this into the qtblend effect? When using it with shutter lengh = 0, it does just a simple transform like qtblend. I thought it would bloat this standard and highly used filter too much so I decided to put it into an extra file first and ask here. Also qtblend does some handling for different compositions/alpha/scaling edge cases which this effect currently does not have. Integrating it into qtblend would require having both.
Alternative concepts I explored:
dblur(directional blur) filter also used in Kdenlive in "Directional blur". By calculating the angle and blur amount from the translation, it can blur the source image. I didn't choose it as the sampling blur was faster and has a better blur. dblur uses a gaussian kernel which doesn't look as good as a "linear blur" which I think is physically more accurate. This is especially visible in animated text - I can give examples if anyone is interested. Alsodblurworks with a uniform direction/amount per frame so it can't support scaling/rotation at all.AI Notice: I used Claude Sonnet 5 to help me with the build setup, getting to know the codebase and also implementing and optimizing the effect in large parts. I didnt find an AI policy and assumed that's okay. I'm an experienced programmer but have only little knowledge about the QT, MLT or kdenlive codebase which is why I used AI to help me get this implemented.
It's a draft PR because I didn't test with different resolutions yet. It also may need additional optimization / edge case hardening as qtblend does. It currently only supports 8 bit color space.
Demo:
test2.mp4