ffmpeg - images to videos and vice versa

To get training material for an image classifier I recorded a few videos with my GoPro and converted them later to images using ffmpeg.

My example usage here:

ffmpeg -i GOPR0001.MP4 -s 1280x720 -vf fps=10 images/G01%04d_720p.png

The 4k MP4-video is converted to 720p with 10 png images per second. A frame number is added to the image name with %04d.

After written some Python-opencv code to generate data for training I wanted to have a preview video to show my collaborators. So the other way around: a lot of images converted to a video.

cat images/* | ffmpeg -f image2pipe -framerate 5 -i - -f webm -vcodec libvpx-vp9 video.webm

The images are piped to ffmpeg and a webm(vp9) video is generated with a framerate of 5 images per second.

I experimented a bit with codecs but I found none that worked on every plattform out of the box. The biggest problem here is the slack-android-app in-app-video-player. The webm video at least gives a preview image and works on all other plattforms.