How to read frames which are separated by a specific number ? [ffmpeg] I have around 1000 frames in *.png format, which are named like frame-0.png, frame-1.png, frame-2.png and so on. I read them and generate a movie by following command :

ffmpeg -f image2 -r 20 -i frame-%00d.png -vcodec mpeg4 -y movie.mp4 


Let's say I just want to read frames like frame-0.png,frame-20.png, frame-40.png and make a movie out of it. How can I achieve that ?

One possible way I know, is to make movie from all 1000 frames then generate a new movie by skipping frames from the following command :

ffmpeg -y -i movie.mp4 -filter:v "select='mod(n,20)'" out.mp4


Is there any direct method ?
The direct way to do this is by using the concat demuxer, where the text file only mentions the selected files. Besides being a hack, you no longer get to use the image2 options. The better way is to combine your present commands.

ffmpeg -framerate 20 -i frame-%d.png -vf "select='not(mod(n,20))'" -c:v mpeg4 -y movie.mp4