I have a sequence of images which I would like to display to some music that plays at 130bpm. I'll also need to scale down the images, which are a rather strange 2673x2151 pixels, to something that would fit inside a 1080p frame -- e.g. 1342x1080.
130BPM yields weirdness with the most common frame rates. There are 2.16666666667 (13/6) beats per second. This being the case, there doesn't seem to be an integer (i.e., non-fractional) number of frames to show each each image at the usual frame rates (24, 25, 30 fps). If I can make a movie with a frame rate of 2.16666667 frames per second, i could simply show each image for one frame. This seems like it might actually be optimal -- it would probably make a a very compact video file, right?? Question 1: can one specify fractional frame rates?
Alternatively, if we must set the frame rate to an positive integer value, 13 frames per second works if we just display each image for six frames. 13 FPS means 780 frames per minute. 780 frames divided by 130 beats means 6 frames per beat.
Finally, my images are named j1.jpg, j2.jpg, j3.jpg, etc.
Question 2: Can someone help me concoct an ffmpeg command to assemble these images, first in order, then reversed, into a video with each image lasting one beat at 130BPM? I'd like some common video format like MP4 or h264/265, something I can post to social media.
I've been trying to massage this command, which does assemble the images into a movie, but my attempts to specify a frame rate have had weird effects. E.g., doing a -r results in strange videos that change image very erratically. I think it's because there's a setpts=N/25/TB
bit in there.
ffmpeg -pattern_type glob -i "j*.jpg" -filter_complex "[0]reverse[r];[0][r]concat,loop=2:250,setpts=N/25/TB,scale=1342:1080" -pix_fmt yuv420p -c:v libx264 -preset slow -b:v 3500k output_looped.mp4
Question 3: how does one specify a number of frames to repeat each image? The default is one frame per image. If we want to specify more than one frame per image, how?
Question 4: What does setpts=N/25/TB
specify? I've read the docs on setpts but it's not clear to me what the three values are specifying without the option names.
Question 5: What does the 250 mean in loop=2:250
? The docs on loop also don't explain what values are set when you don't supply the specific option names.