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

command: let frame-step go through multiple frames #10132

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

Dudemanguy
Copy link
Member

This commit gives the frame-step command the ability to accept an
additional argument specifying the amount of frames (forwards or
backwards) to step through. By default, it steps forward 1. The
frame-back-step command is reworked to simply be a call to frame-step
with a -1 value. In the case where the value is exactly 1, mpv will play
exactly 1 frame and stop like before. However if a backwards step is
requested or multiple frames forward, then mpv will perform a very exact
seek. This working well, of course, depends on the pts values in the
stream being reliable which may not be the case. As a minor note,
MPSEEK_BACKSTEP is renamed to MPSEEK_FRAMESTEP since forward seeks use
this as well. Fixes #10128.

player/playloop.c Outdated Show resolved Hide resolved
@Dudemanguy Dudemanguy force-pushed the frame-step branch 2 times, most recently from 544a2e7 to 7f6072c Compare April 25, 2022 20:18
@Dudemanguy
Copy link
Member Author

I added an additional flag to the command that controls how mpv tries to skip frames. By default, it uses the play mode (if anyone has a better name, that would be appreciated) which works like how frame-stepping forward currently works. Basically, mpv just plays x amount of frames and stops. This mode only does anything when going forward and is the default. Otherwise, it uses seek which does that: tries to perform a seek to the correct pts. frame-stepping backwards will always do a seek. You can do this forwards as well but it's not the default.

As aside, this sort of solves #6104 since seeking won't play audio. The only thing is that frame skipping forwards exactly 1 with a seek isn't very accurate. You'll often end up going forward 2 frames in actuality.

@dardo82
Copy link

dardo82 commented Apr 25, 2022

@Dudemanguy wow, you actually did it, thanks! 👏

@Terr2048
Copy link

Terr2048 commented Jan 3, 2025

Why it is not merged?

@Dudemanguy
Copy link
Member Author

Why it is not merged?

Because it sucked. I'll revisit soon-ish.

@Dudemanguy
Copy link
Member Author

I fixed the problems I originally had with this way back when I originally wrote it. I think it works correctly now.

player/playloop.c Show resolved Hide resolved
DOCS/man/input.rst Outdated Show resolved Hide resolved
@Dudemanguy Dudemanguy force-pushed the frame-step branch 4 times, most recently from 40491bb to 83d4137 Compare January 27, 2025 22:36
player/command.c Outdated Show resolved Hide resolved
Previously, the default behavior of frame-step and frame-back-step is to
play forward 1 frame or seek back 1 frame. We keep this behavior but
introduce additional flags to control the exact behavior of the frame
stepping. The first argument simply specifies how many frames to go
through. The second argument specifies whether to play video to step
through frames or to seek to step through frames. Playing through the
video to step through frames only works going forwards (otherwise it
will always seek). In theory we could use backwards playback for this,
but that can be decided later.

As a minor note, MPSEEK_BACKSTEP is renamed to MPSEEK_FRAMESTEP since
forward seeks can use this as well. Fixes mpv-player#10128.
@Dudemanguy Dudemanguy merged commit 9661a38 into mpv-player:master Jan 28, 2025
27 of 28 checks passed
@Dudemanguy Dudemanguy deleted the frame-step branch January 28, 2025 04:20
@Dudemanguy
Copy link
Member Author

Dudemanguy commented Jan 28, 2025

It's probably possible to make seeking backwards work with the play flag by doing backwards playback, but I'll follow up on that later. Would be a more involved changed.

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

Successfully merging this pull request may close these issues.

Go back and forward multiple frames at once
6 participants