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

Allow frame by frame navigation by buffering on-demand #46

Open
jojje opened this issue Aug 5, 2023 · 6 comments
Open

Allow frame by frame navigation by buffering on-demand #46

jojje opened this issue Aug 5, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@jojje
Copy link

jojje commented Aug 5, 2023

Problem definition

It seems that in order to perform frame-by-frame navigation with the A and D keys, frames have to be buffered already. When navigating to some point in the clip(s) with the mouse or any of the key-shortcuts, the buffer is empty, so frame-by-frame navigation isn't possible. In order to get the frame navigation to work, the user has to use the following cumbersome process:

  1. Find interesting spots in the clips to be analyzed by jumping around with the available seek-options.
  2. Once a spot has been found, jump back one keyframe (e.g. - key).
  3. Press play until the buffer fills up to 50 frames, and be quick on the trigger to pause the video.
  4. Navigate back with the A key until the specific frame of interest is found.

Proposed improvement

Get rid of steps 2-4 by either:

  • A) Optimal UX: buffering the surrounding frames automatically. E.g. 25 frames on each side and have the code re-buffer automatically if frame navigation reaches either end of the buffer (buffer position 0 or (left|right)_frames.size()-1)
  • B) OK UX: providing two new key shortcuts (e.g. shift-A & shift-D) that the user can trigger to automate step 2-3 above. I.e. seek backward one key-frame and then decode the frames up until the current position. Similarly for forward buffering where the buffering would work exactly like playing for 50 frames, with the exception that the views get rendered from the first item in the buffer. I.e. the same as performing steps 2-4 above, and navigating all the way back to the beginning of the buffer using the A key.

With option A, the user could navigate the entire clip frame-by-frame seamlessly.
With option B, they'd have to buffer manually, but would still allow pretty much uninterrupted workflow with just one extra key to press every now and then.

The reason I even mentioned option B was that after looking at the code, it might be easier to implement. Whatever improvement can be done in terms of frame-by-frame navigation would be greatly appreciated.

PS. fantastic tool. Just discovered it and am kicking myself for not finding it sooner.

@jonfryd
Copy link
Member

jonfryd commented Aug 7, 2023

Hi @jojje,

Thanks for sharing your ideas in such detail.

I'm in the process of finalizing the next version (which should be out this week), and once it's done, I'll take a break from working on the tool for at least three to four months. However, I'll keep your input in the back of my mind and see if there is something we can do in the future perhaps.

If someone wants to work on this, I'm willing to accept PRs, of course.

Cheers!

@jonfryd jonfryd added the enhancement New feature or request label Aug 7, 2023
@jojje
Copy link
Author

jojje commented Aug 7, 2023

Looking forward to the new version. Hopefully I can implement this one myself on that code base.

Was staring for 30 minutes at CompareVideo::video function, but failed to find an obvious way to enhance the buffering due to so many different concerns being complected in that one function. Will see how the design has changed in the next version, and hopefully it'll simplify this task.

@jonfryd
Copy link
Member

jonfryd commented Aug 7, 2023

Looking forward to the new version. Hopefully I can implement this one myself on that code base.

Was staring for 30 minutes at CompareVideo::video function, but failed to find an obvious way to enhance the buffering due to so many different concerns being complected in that one function. Will see how the design has changed in the next version, and hopefully it'll simplify this task.

Haha, please don't expect a complete rewrite (even though that would be nice and long overdue). I'm mostly focusing on bug fixes and minor, incremental improvements for the sake of reliability.

Unfortunately, even after my unpushed changes, the entire video() method remains overly complex to comprehend and maintain. I appreciate that you had the courage to look into it, though.

@teijiIshida
Copy link

Frame by frame comparison is super useful and not many programs do this. I look forward to this feature whenever it will be implemented.

@Frizlab
Copy link

Frizlab commented Jan 30, 2024

I’m looking forward to it too! It would be a game changer.

jonfryd added a commit that referenced this issue Feb 3, 2024
… frame-by-frame navigation during paused video playback
@jonfryd
Copy link
Member

jonfryd commented Feb 3, 2024

I've pushed a commit that enables fetching new frames when D is pressed. It's nothing fancy, but it's surely an improvement to the user experience. However, it doesn't resolve the process outlined by @jojje above, as addressing backward navigation—which requires frame-accurate seeks and actual pre-buffering—will be harder to do. Maybe at some later point...

jonfryd added a commit that referenced this issue Mar 2, 2024
… D keys as strictly for in-buffer navigation + refactoring
jonfryd added a commit that referenced this issue Mar 2, 2024
…D keys as strictly for in-buffer navigation + refactoring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants