mpv icon indicating copy to clipboard operation
mpv copied to clipboard

Option to set --ab-loop-a to the beginning of file if unset, and --ab-loop-b to the end of file if unset (old behavior)

Open l0f4r0 opened this issue 2 years ago • 7 comments

Hello,

Could it be possible to add an option to restore an old ab-loop behavior please? I mean: unset --ab-loop-a implies the start of the file while unset --ab-loop-b implies the end of the file.

Let's wait the end of media file to set the implied missing a/b. Of course, do nothing is neither a nor b exists.

NB : I think an option/setting here would be adequate since everyone doesn't want it necessarily.

Thanks in advance :)

l0f4r0 avatar Mar 29 '23 21:03 l0f4r0

Why on earth would not setting ab-loop-a/ab-loop-b actually secretly mean setting time points at the beginning and end? Just use --loop-file if all you want to do is loop a file? I don't understand what you want to accomplish.

Dudemanguy avatar Mar 30 '23 14:03 Dudemanguy

I don't want to loop the whole file, only from ab-loop-a to ab-loop-b.

Sometimes one doesn't have time to set ab-loop-b because media is already over. So in this case, if ab-loop-a has already been defined then the option would automatically assume that ab-loop-b is the end of file.

On the contrary, if ab-loop-b has been defined but not ab-loop-a then the option would consider this is an oversight (or just a convenience) and so would automatically assume that ab-loop-a is the beginning of file.

Is it clearer?

l0f4r0 avatar Mar 30 '23 15:03 l0f4r0

I'd be more for being explicit than implicit, so something like ab-loop-b=end or ab-loop-a=begin.

cloud11665 avatar Mar 30 '23 15:03 cloud11665

I'd be more for being explicit than implicit, so something like ab-loop-b=end or ab-loop-a=begin.

This suggestion sounds reasonable. Does that work for you @l0f4r0?

Dudemanguy avatar Mar 30 '23 15:03 Dudemanguy

I'd be more for being explicit than implicit, so something like ab-loop-b=end or ab-loop-a=begin.

You mean in mpv config file?

If so, I find the implicit way more flexible than explicit because one doesn't have to anticipate any setting beforehand. Depending on what one does (setting ab-loop-a or b), the option completes the missing part. More, one can experience some inconvenience if (s)he doesn't uncorrelate shortcuts for ab-loop-a or b (for example, one sets up "ab-loop-a=start" only and then presses "l" during playback, mpv takes that for ab-loop-b and loops immediately which is maybe not what (s)he wants here...). If both a/b are specified, then it will loop and maybe it's undesirable too. I like the on-the-fly aspect of the implicit way :)

By the way, do you know why the following doesn't currently work in mpv.conf please? ab-loop-b=${duration}

It says:

Option ab-loop-b: invalid time: '${duration}' Error parsing option ab-loop-b (option parameter could not be parsed) /home/l0f4r0/.config/mpv/mpv.conf:4: setting option ab-loop-b='${duration}' failed.

but I'm not sure to understand why (duration is indeed supposed to be expressed in seconds but it is nonetheless displayed as time in my osd-playing-msg test...).

l0f4r0 avatar Mar 30 '23 22:03 l0f4r0

The old behavior was definitely convenient.

Situation: You set ab-loop-a when the action starts and wait for the action to end (to set ab-loop-b). But the action never ends. Instead, you reach the end of the file, and mpv deletes your precisely set ab-loop-a. This is not good.

Thank you for pointing out the issue, @l0f4r0 .

NoSuck avatar May 26 '25 05:05 NoSuck

You can bind ab-loop; set ab-loop-b ${=duration}

guidocella avatar May 26 '25 06:05 guidocella