u8sand / Baka-MPlayer

The libmpv based media player
https://u8sand.github.io/Baka-MPlayer/
GNU General Public License v2.0
428 stars 93 forks source link

mpv seek command stuck in threshold of every 5 seconds #312

Closed Kienyew closed 2 years ago

Kienyew commented 2 years ago

I have been using Baka-MPlayer for long time, and is doubtlessly an excellent software.

But there's a bug when I using it, when the program is processing mpv seek +/-N command, it doesnt work in desired way, jumps the video to left/right N seconds. Instead, it will jump straight to the next multiple of 5 seconds.

For example, let's says the video is on 00:41, when mpv seek +1 is sent to BakaEngine::Command, instead of jumping to 00:42, it turns out to be 00:45, the next multiple of 5. And, if I'm on 00:41, when the command mpv seek +6 called, instead of jumping to 00:47, it jumps to 00:50.

Some Debugs I have made

https://github.com/u8sand/Baka-MPlayer/blob/61740cda65f71f132d2b1db1fb2041e2ab83e06a/src/ui/mainwindow.cpp#L579-L595 Everytime mpv seek +/-N is called, this anonymous function called twice, the first time with i is the correct time, the second time, i is the erroneous multiple of 5.

u8sand commented 2 years ago

Thank you for your report. I suspect that seek not being too precise is related to mpv itself:

Precise seeks in mpv are expensive (i.e. noticably slow and not desirable) in my experience even absolute seeks are expensive so I opted to always use imprecise relative seeks.

I'm guessing it gets triggered twice with the two values, once when the seek is triggered using what baka knows is the right seek, but then mpv reports the new position after the imprecise seek.

If you use mpv seek +5 exact it should use a precise seek, you can bind it and see if you like the experience.

Kienyew commented 2 years ago

Thank you for your report. I suspect that seek not being too precise is related to mpv itself:

* [https://mpv.io/manual/master/#command-interface-seek-%3Ctarget%3E-[%3Cflags%3E]](https://mpv.io/manual/master/#command-interface-seek-%3Ctarget%3E-%5B%3Cflags%3E%5D)

* https://mpv.io/manual/master/#options-hr-seek

Precise seeks in mpv are expensive (i.e. noticably slow and not desirable) in my experience even absolute seeks are expensive so I opted to always use imprecise relative seeks.

I'm guessing it gets triggered twice with the two values, once when the seek is triggered using what baka knows is the right seek, but then mpv reports the new position after the imprecise seek.

If you use mpv seek +5 exact it should use a precise seek, you can bind it and see if you like the experience.

The inconsistent interval of seeking annoyed me a lot, at least for my own, I didn't experience any visible delay after adding the exact option, which fits me more. Thanks!

u8sand commented 2 years ago

Awesome, I'm glad it works for you. Maybe hr seek performance has improved. I'll try it out on some slow systems and consider again whether or not hr should be opt in or opt out.