Bug 455883

Summary: if Zone contains clip's last frame then it cannot be dropped into project tracks
Product: [Applications] kdenlive Reporter: bodzio131 <bodzio131>
Component: User Interface & MiscellaneousAssignee: erjiang <erjiang>
Status: RESOLVED FIXED    
Severity: normal CC: erjiang
Priority: NOR    
Version First Reported In: 22.04.1   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description bodzio131 2022-06-24 11:54:27 UTC
STEPS TO REPRODUCE
1. open clip (tried with mts 1080p 50i clip, kdenlive suggested project settings = 1080i 25p), go into Clip Monitor, forward into some frame, click "Set Zone In"
2. go into the clip end: you can press "End" key or choose "Go to Clip End" from menu, click "Set Zone Out", then "Insert Zone in Project Bin"
3. now try to drag this zone from the Project Bin into any track, it is not possible (cursor seems to look fine but preview doesn't show and there is nothing to drop)

OBSERVED RESULT
if the Zone contains the very last frame then it cannot be dropped into project tracks

EXPECTED RESULT
the Zone containing the very last frame should treated like any other zones (be possible to add into project tracks)

WORKAROUND
when you are in the very end of the clip then just move backward just a little (click "arrow down" on the right side of clip timer, or left arrow on the keyboard), then click "Set Zone Out" and "Insert Zone in Project Bin": such Zone can be dropped into project

SOFTWARE/OS VERSIONS
Windows: 8.1
Comment 1 erjiang 2022-07-05 03:57:34 UTC
Confirmed, something is broken about "Insert Zone in Project Bin", although dragging the clip directly from the clip monitor seems to work normally. Tested in latest master (cf47be8af).
Comment 2 erjiang 2022-07-06 05:54:17 UTC
There's an off by one bug when inserting a zone into the project bin. The clip monitor and rest of the program seem to disagree on whether the out point is the last frame or the last frame + 1.
Comment 3 Bug Janitor Service 2022-07-07 04:14:08 UTC
A possibly relevant merge request was started @ https://invent.kde.org/multimedia/kdenlive/-/merge_requests/323
Comment 4 Jean-Baptiste Mardelle 2022-07-15 14:38:02 UTC
Git commit 28a919ac7fcabf0d831614f7aae00d3321316bf1 by Jean-Baptiste Mardelle, on behalf of Eric Jiang.
Committed on 15/07/2022 at 14:26.
Pushed by mardelle into branch 'master'.

Fix Insert Zone to Bin out point off by 1

If the user sets in=100, out=101 and select Insert Zone in Project Bin,
the clip is created 1 frame longer than it should be. This is especially
noticeable when creating a subclip when the out point is the last frame
in the clip, resulting in a broken subclip that cannot be added to the
timeline.

M  +3    -1    src/mainwindow.cpp
M  +4    -0    src/monitor/monitor.h
M  +1    -1    src/timeline2/model/timelinemodel.cpp

https://invent.kde.org/multimedia/kdenlive/commit/28a919ac7fcabf0d831614f7aae00d3321316bf1
Comment 5 Jean-Baptiste Mardelle 2022-07-15 14:40:13 UTC
Git commit d38f885b9115ad53e9ebf61def968480109f604a by Jean-Baptiste Mardelle, on behalf of Eric Jiang.
Committed on 15/07/2022 at 14:39.
Pushed by mardelle into branch 'release/22.08'.

Fix Insert Zone to Bin out point off by 1

If the user sets in=100, out=101 and select Insert Zone in Project Bin,
the clip is created 1 frame longer than it should be. This is especially
noticeable when creating a subclip when the out point is the last frame
in the clip, resulting in a broken subclip that cannot be added to the
timeline.

M  +3    -1    src/mainwindow.cpp
M  +4    -0    src/monitor/monitor.h
M  +1    -1    src/timeline2/model/timelinemodel.cpp

https://invent.kde.org/multimedia/kdenlive/commit/d38f885b9115ad53e9ebf61def968480109f604a