VSE: Retime Tool misinterprets the length of image sequences #108160

Open
opened 2023-05-22 20:21:56 +02:00 by Julien Kaspar · 2 comments
Member

System Information
Operating system: Linux-6.3.2-gentoo-x86_64-AMD_Ryzen_Threadripper_1950X_16-Core_Processor-with-glibc2.36 64 Bits, X11 UI
Graphics card: Quadro GP100/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 530.41.03

Blender Version
Broken: version: 4.0.0 Alpha, branch: HEAD (modified), commit date: 2023-05-21 14:00, hash: 8c6908eba578
Worked: (newest version of Blender that worked as expected)

Short description of error
When importing an image sequence into the sequencer and making the "Retime" tool active in the toolbar, it shows the speed percentage.
But it always misinterprets the last frame as the second to last frame, showing 92% speed as a result instead of 100%.

Screenshot_20230522_201628.png

An imported video in comparisson is always by default on 100% speed.

Screenshot_20230522_201625.png

Sidenote: The retiming handle is strangely always placed a bit offset behind the last frame of the strip (In this case even between frames)

Exact steps for others to reproduce the error

  • Import an image sequence
  • Use the Retime tool and select the strip
**System Information** Operating system: Linux-6.3.2-gentoo-x86_64-AMD_Ryzen_Threadripper_1950X_16-Core_Processor-with-glibc2.36 64 Bits, X11 UI Graphics card: Quadro GP100/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 530.41.03 **Blender Version** Broken: version: 4.0.0 Alpha, branch: HEAD (modified), commit date: 2023-05-21 14:00, hash: `8c6908eba578` Worked: (newest version of Blender that worked as expected) **Short description of error** When importing an image sequence into the sequencer and making the "Retime" tool active in the toolbar, it shows the speed percentage. But it always misinterprets the last frame as the second to last frame, showing 92% speed as a result instead of 100%. ![Screenshot_20230522_201628.png](/attachments/cb60275a-b4bd-4dd1-9815-c0af1caf7eeb) An imported video in comparisson is always by default on 100% speed. ![Screenshot_20230522_201625.png](/attachments/327a2903-2433-43a7-b5bb-9ce0b05b2936) Sidenote: The retiming handle is strangely always placed a bit offset behind the last frame of the strip (In this case even between frames) **Exact steps for others to reproduce the error** - Import an image sequence - Use the Retime tool and select the strip
Julien Kaspar added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-05-22 20:21:56 +02:00
Evan Wilson changed title from VSE: Retime Tool misinterprets the length of iamge sequences to VSE: Retime Tool misinterprets the length of image sequences 2023-05-26 06:24:54 +02:00

I'd like to try and tackle this issue, if no one else is already working on it!

I'd like to try and tackle this issue, if no one else is already working on it!

It seems like the root cause of this issue also applies to videos, but they have so many frames in comparison to image sequences that the retime percentage just rounds up to 100% when dealing with them.
The retiming handle speed is determined in this function (strip_retiming.cc):

float SEQ_retiming_handle_speed_get(const Sequence *seq, const SeqRetimingHandle *handle)
{
  if (handle->strip_frame_index == 0) {
    return 1.0f;
  }

  const SeqRetimingHandle *handle_prev = handle - 1;

  const int frame_index_max = seq->len - 1;
  const int frame_retimed_prev = round_fl_to_int(handle_prev->retiming_factor * frame_index_max);
  const int frame_index_prev = handle_prev->strip_frame_index;
  const int frame_retimed = round_fl_to_int(handle->retiming_factor * frame_index_max);
  const int frame_index = handle->strip_frame_index;

  const int fragment_length_retimed = frame_retimed - frame_retimed_prev;
  const int fragment_length_original = frame_index - frame_index_prev;

  const float speed = float(fragment_length_retimed) / float(fragment_length_original);
  return speed;
}

So, there has to be an off-by-one error either here with frame_index_max, or elsewhere in the system when determining retiming sequence lengths. This is my first contribution to Blender, so I would appreciate it if someone more experienced could point me in the correct direction from here.

It seems like the root cause of this issue also applies to videos, but they have so many frames in comparison to image sequences that the retime percentage just rounds up to 100% when dealing with them. The retiming handle speed is determined in this function (strip_retiming.cc): ```cpp float SEQ_retiming_handle_speed_get(const Sequence *seq, const SeqRetimingHandle *handle) { if (handle->strip_frame_index == 0) { return 1.0f; } const SeqRetimingHandle *handle_prev = handle - 1; const int frame_index_max = seq->len - 1; const int frame_retimed_prev = round_fl_to_int(handle_prev->retiming_factor * frame_index_max); const int frame_index_prev = handle_prev->strip_frame_index; const int frame_retimed = round_fl_to_int(handle->retiming_factor * frame_index_max); const int frame_index = handle->strip_frame_index; const int fragment_length_retimed = frame_retimed - frame_retimed_prev; const int fragment_length_original = frame_index - frame_index_prev; const float speed = float(fragment_length_retimed) / float(fragment_length_original); return speed; } ``` So, there has to be an off-by-one error either here with `frame_index_max`, or elsewhere in the system when determining retiming sequence lengths. This is my first contribution to Blender, so I would appreciate it if someone more experienced could point me in the correct direction from here.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#108160
No description provided.