Skip to content
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

Begin and end point of clip with "Speed: forward only" filter randomly change #1498

Open
php4fan opened this issue Dec 23, 2023 · 5 comments

Comments

@php4fan
Copy link

php4fan commented Dec 23, 2023

23.11.29 on Manjaro Linux (installed via Pamac)

I don't know what exact steps lead to reproducing this, but it has happened to me a few times already and believe me I'm not hallucinating.

Here's what I did:

  1. Created a new project
  2. Added a couple of files to the playlist
  3. placed them on the timeline
  4. sliced them into a few pieces (using "split at playhead" in several places)
  5. readjusted the beginning and ending point of some of them
  6. moved them around

So far, basic editing
7. On some of the clips in the timeline, added the "speed: forward only" filter to speed up the clip to 2x constant speed

Context: all I wanted to do was to speed up those clips to a constant speed of e.g. 2x. The only way I found was to use the "speed: forward only" filter, and it's a bit cumbersome to use. If I simply add the filter and change the speed, that speed gets applied to the particular point in time where the playhead happens to be at that particular moment, as if I'm creating some sort of keyframe there, and then the speed is interpolated linearly after and perhaps before that keyframe to 1.0x. So, in order to speed up a clip at a constant speed e.g. 2x, I need to position the playhead at the beginning of the clip, set the speed there, then put the playhead at the end, set the same speed there. And if I forgot to do this and changed the speed at some random point in the middle, I couldn't find how to correct that, I just delete the filter and start over.

Anyway, that part should be irrelevant to the issue.

  1. I moved around the clips some more
  2. saved the project
  3. Reopened the project the following day
  4. played it

The clips that had the filter now do not start at the same start and end point that they did.

I mean: at the place in the timeline where I had a sped-up clip, there's a sped-up clip. It has the same duration that it had, it has the same speed, it has the same duration (i.e. occupies the same timespan on the timeline), it is from the same file from the playlist that it was from, but it start and ends at different times than what I had done. And it's not by a small amount, it's a completely unrelated piece of the video.

This completely destroyed the editing work I had done.

I'm not sure whether this happened when moving clips around on the timeline, or when I saved and reopened the file. This had happened to me before, and I had noticed it while editing. So it's possible that it again happened when moving clips around on the timeline, and I failed to notice it right away and only noticed it when I reopened the project.

Just in case there's a misalignment between the behavior that I expect and some very unintuitive and unconventional but somehow internally consistent behavior that perhaps is by design (some very wicked design), I'll try to be extra explicit about the behavior that I expect when I speed up a clip and move it around on the timeline.

Let's say I have two videos in the playlist and they go like this:

SourceVideo1: |aabbccddeeff|
SourceVideo2: |ppqqrrssttuu|

I take some middle portion of SourceVideo1 and speed it up, then take a portion of SourceVideo2 without any filter, and I place them onto the timeline like this:

...|cde|rrsstt|....
```
where "cde" represents the middle portion of SourceVideo1 at 2x speed, "rrsstt" represents the portion of SourceVideo2 at normal speed, the "|"s represent boundaries (I know this isn't rigorous) and "..." represent other stuff in the timeline before and after those clips.

If I select both clips and move everything to the left, i.e. to the "before" direction in time (e.g. after deleting othe clips that were there), I expect to get something like this:
```
|cde|rrsstt|.....
```
that is, the exact same thing that I had, but moved.
Not something crazy like 
```
|abc|rrsstt|
```

And if I take the "cde" clip and move it after the "rrsstt" clip, i.e. switch the order in which they appear on the timeline, I expect to get:
```
....|rrsstt|cde|......
```
and not something like, I don't know, 
```
....|rrsstt|def|....
```

That is, if I select a clip that is already on the timeline, and move it around on the timeline, I expect it to remain  the same thing, just moved to another point in time. Does that make sense?
@php4fan
Copy link
Author

php4fan commented Dec 23, 2023

The strangest thing happened.
This should almost certainly help diagnose the issue.

I opened again the project that was affected by this issue.

I grabbed the left edge of the affected clip (the one whose start point wrt the original video was changed at some point without me changing it) and dragged it a tiny bit to the right. Then I grabbed it again and dragged it back to the left to exactly where it was. This should have changed nothing. But surprisingly, this "fixed" the screwed-up clip, changing the starting point back to what it was yesterday before it got "corrupted".

By the way, I did this like three times because it ketp crashing. I suspect the crashes might be related to this issue. Perhaps something in the time calculations related with speed changes is screwed up, and sometimes it just cause the times to be computed incorrectly and sometimes leads to crashes. This is just speculation.

I did not save after doing this, so I could reload the project and try it again and it was 100% reproducible.

@bmatherly
Copy link
Member

Your report sounds similar to this issue which was fixed 6 months ago:
https://forum.shotcut.org/t/problem-with-speed-forward-reverse/39575

mltframework/mlt@7bc867c

I wonder what version of MLT your distribution is using.

As a test, it would be good to try the portable package that we provide from our download page. We ensure to have all the correct dependencies for Shotcut in our build:
https://shotcut.org/download/

all I wanted to do was to speed up those clips to a constant speed of e.g. 2x. The only way I found was to use the "speed: forward only" filter,

Have you tried setting the Speed parameter in the clip properties panel? Most people prefer that if they are using a fixed speed that does not need to ramp up and down
image

Some of your recent issues suggest that you are still in a learning/exploring mode with Shotcut. I would recommend that you spend some time on our Forum
https://forum.shotcut.org/
Search for advice and tutorials there. Ask questions about how to accomplish the things you want to do. Then, if you can narrow down a clear-cut bug, we can attack it. There isn't anyone here monitoring this issue tracker who can engage at that level.

@php4fan
Copy link
Author

php4fan commented Dec 24, 2023

I wonder what version of MLT your distribution is using

It's 7.22.0-1.

Was the known issue fixed in mlt or Shotcut?

Some of your recent issues suggest that you are still in a learning/exploring mode with Shotcut.

Sure, but this was clearly a bug.

Have you tried setting the Speed parameter in the clip properties panel? Most people prefer that if they are using a fixed speed that does not need to ramp up and down

Thank you, I had been looking for that and missed it.

@bmatherly
Copy link
Member

I've been trying my hardest to reproduce a problem here: move clips, trim them, open/close/reopen. In all my testing, the beginning and ending points are exactly where I left them. I'm not saying there isn't a bug here. But if there is, I have not found the steps to reproduce it.

readjusted the beginning and ending point of some of them

If you trim the beginning of a clip with the Speed:Forward filter applied, it will absolutely change the frame that it starts and ends on. The Speed filter assumes that the clip is played at 1.0x speed up to the "in" point on the clip where it begins the apply the speed specified by the first keyframe.

Is it possible that you trimmed the beginning of the clip while trying to do something else and that caused the unexpected results you see?

@php4fan
Copy link
Author

php4fan commented Dec 28, 2023

I have not found the steps to reproduce it

Me neither (though I haven't tried hard to reproduce on purpose)

If you trim the beginning of a clip with the Speed:Forward filter applied, it will absolutely change the frame that it starts and ends on.

Sure but it doesn't seem to change in the expected way. I mean not always. One thing that I have observed (but I don't think is what happened in this case) is that when you do trim the beginning, it sometimes changes everything in an unpredictable, seemingly random way.

Let's say I have a source video that is 10 seconds long and I take a 4-second piece in the middle of it. Then I apply the filter, starting at some speed S1 and ending at some other speed S2 >= S1. Then I trim off a few frames at the beginning (either by slicing at playhead and removing the first bit, or by dragging the left edge to the right).
The resulting clip should start at a slightly later time and at a slightly higher or equal speed. And if the piece I sliced was small, the difference should be small. Also, if I revert the change (not with Ctrl+Z but by dragging the left edge back to exactly where it was) I should get back to everything being exactly the same as it was before trimming the beginning. In other words, changes should be "smooth", and tend to zero as the timespan involved tends to zero.
But sometimes, the starting point changes radically to something seemingly random (and I'm not sure if the speed does too). I'm not 100% sure whether it happens when trimming off the beginning or when reverting the change (i.e. extending the beginning to an earlier time).

I'm not sure if in this case I did exactly that and that's exactly what happened, but instead of noticing right away I only noticed once I had saved, closed, and reopened the project.

Is it possible that you trimmed the beginning of the clip while trying to do something else and that caused the unexpected results you see?

In the way I described, it is possible; that is, it is possible that what triggered a definitely buggy behavior was the act of trimming the beginning (and/or the end) of a clip, and not just the act of moving it around on the timeline or even doing nothing at all.
It is not possible (to the extent that I can be trusted) that I trimmed the clip in such a way that the result would be the expected one.

I mean, of course if I did something that I didn't intent to do I wouldn't know it, there's always the theoretical possibility that I made a mistake and I didn't realize, but I'm reasonably sure that's not what happened. It happened too many times for that to be the case.

Again all of this is with 23.11.29 and with MLT 7.22.0-1. I assume that's after the fix you mentioned, otherwise this could be the bug that was already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants