Please help me with this script so that it can create copies of YouTube's moving thumbnail of different sizes. By copies I mean that they must have all their characteristics, such as the specified number of frames (already done) and, therefore, FPS (you can find them out in the original mqdefault_6s.webp), duration = 3000 ms (in the original mqdefault_6s.webp, the duration is variable; for example, it varies between 33 and 34 ms from frame to frame), so you need to somehow copy the duration from the original mqdefault_6s.webp), the last frame passes with its own time stamp (already done), frame compression (or something similar, which creates the effect of sharpness or loss of colors, as in the picture below).
Frame extracted from the original webp: https://i.stack.imgur.com/Iow4N.png.
Frame extracted from the homemade webp by this script (to compare sharpness and colors): https://i.stack.imgur.com/Q3loy.png.
ffmpeg -ss hh:mm:ss.0 -i video.mp4 -c copy -t (the length of the video to extract frames; for the original mqdefault_6s.webp with 24 frames, this is probably 5.8; for the original mqdefault_6s.webp with 18 frames, this is probably 4.37; about 5.8*((number of frames in the original mqdefault_6s.webp)/24)) -y CuttedFor0.mp4 && ffmpeg -i CuttedFor0.mp4 -vf fps=24/6 -q 0 -y out%d.jpg && ffmpeg -sseof -3 -i CuttedFor0.mp4 -update 1 -q 0 -y out(number of frames in the original mqdefault_6s.webp).jpg && img2webp -loop 0 -min_size -kmax 0 "out1.jpg" (repeat unitl "out(number of frames in the original mqdefault_6s.webp).jpg") -d 1000/((number of frames in the original mqdefault_6s.webp)/3) -lossy -m 6 -o maxresdefault_6s.webp
Additional explanations:
hh:mm:ss.0(=ms) = time of 1st frame of the original mqdefault_6s.webp in the input video. CuttedFor0.mp4 (see this script to understand why '0').
Did you know that YouTube can change moving thumbnails over time (this is a rhetorical question)!?
So it was,
and so it became.