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

Rewrite #8

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open

Rewrite #8

wants to merge 28 commits into from

Conversation

po5
Copy link
Owner

@po5 po5 commented Dec 26, 2022

Should make it easier to add new features. Much less dumb global state management required.

Finally closes #2. Closes #5. I've realized there probably is no downside to restoring original speed, didn't make an option to disable it.
Closes #1 through a script message to be used for input.conf commands like ; script-message-to evafast set-option speed_cap 5.
Closes #7.

All current functionality and dumb QoL stuff I could remember has been reimplemented.
It's not impossible I've missed edge cases. I have missed edge cases.

speedup-target is barely tested, but seems to work fine.
Subtitle lookahead should be slightly more accurate.

To do:

  • Remove hardcoded 1's in speed_transition(), maybe use math instead of dumb recursion
  • Better caching/clearing of next_sub_at
  • Better displayed subtitle heuristic, check sub-start for image-based subs and sub-text for text-based subs
  • Flatten if pyramids in flash_speed()
  • Redo Speedup during silence #4
  • Steal dropOnAVdesync from speed-transition.lua
  • Warn about low demuxer-readahead-secs and cache-secs (depending on current settings and/or automatically set them)
  • Document script-bindings better
  • Customizable seek command Compatibility with osd-on-seek=msg-bar #6
  • Reset speed when seeking past speedup-target
  • Rewinding while toggled
  • Rewind toggle binding
  • Subtitle lookbehind when rewinding
  • Solve speed fluctuation at gap between subtitles in slowdown range (including when the player is paused)
  • Restore original play-dir, if the user was playing a video backwards for whatever reason
  • Releasing speedup key after reaching full speed on files without subtitles shouldn't seek
  • (?) Simulate repeat to allow for mouse input Events from mouse doesn't have repeat, so they never call evafast. #3
  • Ability to use osd display even when the user has uosc
  • Holding down a toggle key shouldn't make speed flicker
  • Don't fetch next sub for every single line in frame-by-frame typesetting

Should make it easier to add new features
evafast.lua Outdated Show resolved Hide resolved
evafast.lua Outdated Show resolved Hide resolved
evafast.lua Outdated Show resolved Hide resolved
@po5
Copy link
Owner Author

po5 commented Dec 26, 2022

Does this work as expected for you @tomasklaen, @xfzv?

@po5

This comment was marked as resolved.

@xfzv
Copy link

xfzv commented Dec 27, 2022

Does this work as expected for you @tomasklaen, @xfzv?

Yes, all good here. Solves #2.

@tomasklaen
Copy link

I wrote my own little speed adjustment script thingy, so don't wait on me with this :)

@po5
Copy link
Owner Author

po5 commented Dec 27, 2022

Please share that, always good to spread ideas (:

@tomasklaen
Copy link

It's just a dumb hold to speed up or toggle a speed up. Don't want to maintain it so here's just a pastebin: https://pastebin.com/acXpcVYR

@xfzv
Copy link

xfzv commented Dec 27, 2022

As far as I'm concerned, due to #2 , I've been using this along with Natural-Harmonia-Gropius/InputEvent:

RIGHT               seek 5 ; script-binding uosc/flash-timeline             #@click
RIGHT               no-osd set speed 3.5 ; script-binding uosc/flash-speed  #@press
RIGHT               ignore                                                  #@release

until the rewrite is merged into the main branch.

@po5
Copy link
Owner Author

po5 commented Jan 9, 2023

Current state of affairs.

Slowdown with lookahead = true was wrong since its inception and would kick in slightly too late. That has been fixed.
sub-visibility flicker should also be reduced.
Haven't ran into fluctuating speed issues since making the lookahead accuracy fix, but I doubt it's fixed the underlying issue.

show_* options are a bit silly, maybe a single show_speed option with a comma-delimited list of which combinations of displays+states we allow e.g. osd_speed,uosc_speed,osc_toggled,uosc_toggled,osd_target. I'm afraid this would confuse people.

The functionality that's there has been tested enough that I'm contemplating making this the default branch, until it's finished and gets merged. Will do after documentation is written.

This is an accuracy tradeoff - not knowing the next sub right away
can cause speed flicker but I haven't noticed real-world regressions
@christoph-heinrich
Copy link

christoph-heinrich commented Apr 22, 2023

I have used this for about a week now and encountered two times where it would constantly set the speed to 2 (the original speed). Holding the forward button accelerates as it should and after letting go it decelerates again, but after reaching 2 it doesn't stop setting the speed to 2. As a result I can't change the speed because it will be immediately set to 2 again.

Unfortunately I couldn't figure out how to trigger it, but it's annoying when it happens.

Here is my conf in case it helps.
# How far to jump on press
seek_distance=5

# Playback speed modifier, applied once every speed_interval until cap is reached
speed_increase=0.07
speed_decrease=0.035

# At what interval to apply speed modifiers
speed_interval=0.05

# Playback speed cap
speed_cap=3

# Playback speed cap when subtitles are displayed, 'no' for same as speed_cap
subs_speed_cap=1.6

# Multiply current speed by modifier before adjustment (exponential speedup)
# Use much lower values than default e.g. speed_increase=0.05, speed_decrease=0.025
multiply_modifier=yes

# Show current speed on the osd (or flash speed if using uosc)
show_speed=yes

# Show current speed on the osd when toggled (or flash speed if using uosc)
show_speed_toggled=yes

# Show seek actions on the osd (or flash timeline if using uosc)
show_seek=yes

# Look ahead for smoother transition when subs_speed_cap is set
lookahead=yes

@po5
Copy link
Owner Author

po5 commented Apr 22, 2023

I've encountered this multiple times as well, and it killed my momentum. Haven't looked too much into it.

@xfzv
Copy link

xfzv commented Apr 22, 2023

@christoph-heinrich

What you describe seems similar to #9

Doesn't it?

@christoph-heinrich
Copy link

christoph-heinrich commented Apr 22, 2023

@xfzv Yes that's it, I didn't check issues because I didn't expect there to be one for a PR.

christoph-heinrich and others added 2 commits July 26, 2023 09:53
math.floor() can result in one value being off by 1 because one
was just barely below the whole integer while the other one was not.
(floating point numbers \o/)
Adding 0.5 for actual rounding avoids that problem.

Closes #9
This gets rid of text subtitle detection and our own empty subtitle
check, since it didn't work with subs_lookahead for muxed subtitles
(sub-text wasn't available straight away).
po5 added 2 commits July 26, 2023 23:44
Previous regex would skip subtitles that contained empty lines but
weren't empty. This is POSIX Extended RegEx, doesn't seem possible
in plain POSIX or mpv's JS regex to match the start and end of a
multiline string.
@verygoodlee
Copy link

evafast.conf has a key lookahead, but inevafast.lua named subs_lookahead
image

@po5
Copy link
Owner Author

po5 commented Nov 11, 2023

2c00ab2 removed our empty subtitle check, because sub-text wasn't available in time.
I wonder if anything improved after mpv-player/mpv#12819. It apparently helped with @christoph-heinrich's mpv-subtitle-lines.

@christoph-heinrich
Copy link

I'd expect it to help here too.

@verygoodlee
Copy link

verygoodlee commented Nov 20, 2023

There is a better symbol to replace ▶▶, mpv builtin fastforward osd symbol.
image
The definition in mpv source code is OSD_FFW, and it starts from OSD_CODEPOINTS.
See https://github.com/mpv-player/mpv/blob/6e161ff13fb83be9c5180e99427651975d33debf/sub/osd.h#L109-L133
the codepoint is OSD_CODEPOINTS + OSD_FFW = 0xE000 + 0x05 = 0xE005,
but it's not a normal unicode codepoint, only the mpv-osd-symbols font can display it properly.

evafast.lua can be written like this

local symbol = '▶▶'
if mp.get_property('osd-font') == 'mpv-osd-symbols' then symbol = '\u{E005}' end
mp.osd_message(symbol .. string.format(" x%.1f", current_speed))

mpv.conf change the OSD font to mpv-osd-symbols

osd-font=mpv-osd-symbols
  • Before
    image
  • After
    image

@po5
Copy link
Owner Author

po5 commented Nov 20, 2023

Thanks for bringing this up. We can use the symbol regardless of the user's osd-font with the ass \fn tag.

@verygoodlee
Copy link

verygoodlee commented Dec 16, 2023

We can use the symbol regardless of the user's osd-font with the ass \fn tag.

mp.osd_message() supports ass tag using osd-ass-cc/{0|1}

local ass_start = mp.get_property_osd("osd-ass-cc/0")
local ass_stop = mp.get_property_osd("osd-ass-cc/1")
local symbol = "{\\fnmpv-osd-symbols}\u{E005}"
mp.osd_message(ass_start .. symbol .. ass_stop .. string.format(" x%.1f", current_speed))

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.

Rewind Counterpart Speed doesn't return to original value Separate caps for toggle
5 participants