Algorithmically determine when a filter does nothing and remove it during render

tl;dr: Have Shotcut determine when a filter does nothing (e.g. between two specific keyframes) and, during rendering, automatically split the clips there and remove the filter to improve rendering performance.

Backstory: I was editing some Apex Legends footage (20 minutes, 1080p60, to be up-res’ed to 4k60 in the final render) and wanted to cut out a part in the middle and have the first part slide out towards the left, while the 2nd part slides in from the right simultaneously. So I overlapped both parts by 1 second, and added the “Size and Position” filter to both of them and keyframed it such that the first clip starts at the default position and moves out, and the 2nd clip starts moved out and moves to the default position.

In this configuration, rendering the final 8 minute result took over 40 minutes and almost completely locked up my PC in the meantime. (Core i9-9900KS@5GHz, using H.265 NVENC on NVIDIA RTX 2080 SUPER, 32GB RAM, all SSD storage -> 100% usage of all cores, mouse cursor stuttering across the screen, …) Normally, rendering about 20 minutes at the same settings takes ±15 minutes and my PC remains fully usable, with CPU cores hovering between 25% and 50% use.)

I figured that the performance problem must be coming from the “Size and Position” filter which I previously didn’t use. I then proceeded to split the two clips exactly at the transition spot, leaving the filter on the 1s parts that overlapped, but manually removing it from the parts before and after. This led to a significant performance improvement (video render time went down to 6 minutes, and my PC only locked up for a very brief time, probably at the point where it was handling the 1s transition).

I’m a novice editor, so maybe this is something that pros do anyway (best practice or something), but I figured it would be nice of the software could handle it for the user.

So my feature request would be to have this sort of process happen:

  1. When starting an export/render, for each clip and each filter of the clip:
  2. Shotcut analyses the filter applied to the clip and determines areas where it does nothing. Example for “Size and Position”: if there are two subsequent keyframes (including beginning and end of clip) which both have the default settings for all the scaling and position values and no preset active, the area between those two keyframes does not need the filter.
  3. Shotcut splits the clip at the determined keyframes, taking care to interpolate the values of any other filters between their keyframes so that they get set to the appropriate values at the boundaries. (i.e. if you have another filter with a value going from 0 to 100, and you’re making a cut 1/4th of the way, that filter probably needs the boundary value of 25 set at the cut.)
  4. Shotcut removes the filter it determined to be “doing nothing” from the resulting clip that was between the keyframes.
  5. Loop until no more filters with subsequent keyframes, that both have “does nothing” values, can be found. (May need to restart from the top if a cut was made, since amount of clips has changed in that case.)
  6. Output the final render script and proceed with rendering as usual.

Probably not trivial to implement. Would yield a noticeable performance benefit during rendering in my “novice editor” case though.

1 Like

It’s a great suggestion, and a good assumption about effort. We mix our time between adding new features and optimizing existing features. I have been thinking recently about ways to optimize the size and position filter. I will keep this idea in mind.