I searched and tried possible solutions for a lua script that autoloop some images from one directory. The result should be these images to be launched by mpv(media player) with a different duration.
I know there is an autoload script that takes every image but just 1 second each.
https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autoload.lua
(working on windows 10 with the script directory for windows: C:\Users\Username\AppData\Roaming\mpv\scripts)
The following is not an exact answer but slightly related. I often had this need to have a image slideshow where images should be shown for variable duration. Most often accompanied by audio. These solutions worked for me.
Matroska format is very helpful for this. In mpv, I accomplished it with a lua script with images as attachment. Then duration list given in a tag. I don't use it actively because I cannot distribute to others. But instead I found the following approach more portable.
This is the concept. You create a mjpeg video with all the jpegs you want to create. Then you have a video player play with variable frame rate. You specify how long each frame should be shown. Only some container formats allow variable frame rate. Matroska container format allows. So wrap your mjpeg encoded video along with timing information in a matroska container. You can extract jpeg images from mjpeg without any loss.
I used these tools on linux. I am not sure if they exist for windows. They are open-source tools.
This uses the variable frame rate ability of matroska container format.
Make a mjpeg video of all the jpegs in the sequence you wanted. You can use ffmpeg tool to do that. Be careful with file naming. Any gap in number sequence is unforgiveable for ffmpeg. You may need to specify a container format for mjpeg encoded video. You can use .mkv format as well. I think other formats can also be used. I used .mkv format which is matroska format.
create time-sequence file. Refer to matroska container timestamp file format. I used version-2 format. In that format you specify the time for each frame in milliseconds. One line for each image frame. First line is header specifying the version
Create a matroska container using mktoolnix-gui. Add the mjpeg encoded video file. specify the timestamp file. create an mkv file.
The tool will extract the mjpeg encoded video from the input container. Using the timestamp, it will create a new .mkv container.