Search code examples
mpv

Jump by percentages (10%, 20%, 30%...) in MPV player, like on YouTube?


I'd like to reproduce this behavior:

Pressing the number keys 1-9 would automatically skip ahead in the current video to the corresponding percentage of time. So pressing "4" would jump to the 40% mark of the video, regardless of specific time length of the video. Basically similar to how this works on YouTube.

It seems there's no built-in method for this (and number keys are already assigned other tasks by default) but is there any sort of Lua Script that could achieve this?

Thank you


Solution

  • It was more simple than I anticipated. There is already a percentage command native to MPV. So to produce the desired behavior, I just added this to my input.conf file:

    1 seek 10 absolute-percent
    2 seek 20 absolute-percent
    3 seek 30 absolute-percent
    4 seek 40 absolute-percent
    5 seek 50 absolute-percent
    6 seek 60 absolute-percent
    7 seek 70 absolute-percent
    8 seek 80 absolute-percent
    9 seek 90 absolute-percent