Fix snapping audio times to current video position#609
Conversation
9a67aa5 to
c4a7ab3
Compare
|
Summarizing some conversation on Discord for posterity:
I feel like this is otherwise a good solution, but the “meaning” of the rectangle is not intuitively clear. I at first imagined it was supposed to show the “frame-middle” boundaries that lines would snap to (i.e. the edges of the rectangle would be the “snap targets”), but that is not the intent.
Notably, while this is indeed quite possible, I see myself using this snapping a fair bit; for example, when trying to snap a line’s end time to a scene change that isn’t recognized as a keyframe. |
dfaa85c to
7d7cfd4
Compare
In preparation for adding Yet Another Argument
Lots of text incoming, since timestamp wrangling is hell and I want to write down my reasoning before I inevitably forget it again in two weeks. Before commit 5d4973a, snapping an audio line's end time to the "current video position" indicator line would reliably make the line end on the frame before the current video frame (i.e. make the current video frame be the first frame where the selected line is *not* visible any more). Commit 5d4973a broke this, making the behavior of snapping audio times to the "current video position" inconsistent. The commit in question is definitely not fully correct, ultimately just because the entire concept of implicitly converting millisecond timestamps to centisecond timestamps is flawed in and of itself, and bound to always fail in sufficiently crazy edge cases. Fixing the timestamp conversion properly would entail either working with centisecond timestamps from the beginning, or somehow making the process of converting timestamps aware of the context the timestamps are from (e.g. "coming from some frame timestamp"). However, this specific issue was only *exposed* by this commit, and not solely caused by it. Its root cause was just that the "current video position" marker on the audio display would mark the *exact* time of the current video frame, rather than the ideal start/end time for a line to start/end at that video frame. This is why only snapping to the "current video position" broke while snapping to keyframes worked fine. It's quite possible that snapping to the "current video frame" marker was just never thought of as a use case. So, for now, #421 can just be fixed by making a line snapped to the "current video position" marker snap to the middle of the frame rather than at the frame's exact start, and 5d4973a can be untangled at some later time. We still *draw* the "current video position" marker at the exact start of the frame so that one can read off the audio display which lines are visible on the current frame, only the *snap* position is changed. This does mean that snapping a line to the marker snaps the line to a position that's slightly *away* from the marker, but my impression is that this does not actually cause too much confusion. Fixes #421.
This reverts commit c4a7ab3.
This reverts commit 0e2b1ce.
Lots of text incoming, since timestamp wrangling is hell and I want to write down my reasoning before I inevitably forget it again in two weeks. Before commit 5d4973a, snapping an audio line's end time to the "current video position" indicator line would reliably make the line end on the frame before the current video frame (i.e. make the current video frame be the first frame where the selected line is *not* visible any more). Commit 5d4973a broke this, making the behavior of snapping audio times to the "current video position" inconsistent. The commit in question is definitely not fully correct, ultimately just because the entire concept of implicitly converting millisecond timestamps to centisecond timestamps is flawed in and of itself, and bound to always fail in sufficiently crazy edge cases. Fixing the timestamp conversion properly would entail either working with centisecond timestamps from the beginning, or somehow making the process of converting timestamps aware of the context the timestamps are from (e.g. "coming from some frame timestamp"). However, this specific issue was only *exposed* by this commit, and not solely caused by it. Its root cause was just that the "current video position" marker on the audio display would mark the *exact* time of the current video frame, rather than the ideal start/end time for a line to start/end at that video frame. This is why only snapping to the "current video position" broke while snapping to keyframes worked fine. It's quite possible that snapping to the "current video frame" marker was just never thought of as a use case. So, for now, #421 can just be fixed by making a line snapped to the "current video position" marker snap to the middle of the frame rather than at the frame's exact start, and 5d4973a can be untangled at some later time. However, we would still like to *draw* the "current video position" marker at the exact start time of the current video frame, so that one can tell from the audio display which lines are visible at the current video frame and which aren't. Hence, we use the following middle-ground solution: - Keep drawing the "current video position" marker at the exact start time of video frames - Do not allow snapping to the exact time of the "current video position" marker. Instead, allow either snapping to the middle of the previous frame, or the middle of the current frame. - To make this behavior understandable for the user, draw a semi-transparent rectangle behind the "current video position" marker indicating the duration of the previous and current video frame. Fixes #421.



Lots of text incoming, since timestamp wrangling is hell and I want to write down my reasoning before I inevitably forget it again in two weeks.
Before commit 5d4973a, snapping an audio line's end time to the "current video position" indicator line would reliably make the line end on the frame before the current video frame (i.e. make the current video frame be the first frame where the selected line is not visible any more).
Commit 5d4973a broke this, making the behavior of snapping audio times to the "current video position" inconsistent.
The commit in question is definitely not fully correct, ultimately just because the entire concept of implicitly converting millisecond timestamps to centisecond timestamps is flawed in and of itself, and bound to always fail in sufficiently crazy edge cases. Fixing the timestamp conversion properly would entail either working with centisecond timestamps from the beginning, or somehow making the process of converting timestamps aware of the context the timestamps are from (e.g. "coming from some frame timestamp").
However, this specific issue was only exposed by this commit, and not solely caused by it. Its root cause was just that the "current video position" marker on the audio display would mark the exact time of the current video frame, rather than the ideal start/end time for a line to start/end at that video frame. This is why only snapping to the "current video position" broke while snapping to keyframes worked fine. It's quite possible that snapping to the "current video frame" marker was just never thought of as a use case.
So, for now, #421 can just be fixed by positioning the "current video position" marker in the middle of the frame rather than at the frame's exact start, and
5d4973a can be untangled at some later time.
Fixes #421.
Still need to decide how to handle the fact that keyframe markers and current frame markers may now overlap.