Convert PNG frames to WebM video

How to convert a sequence of PNG images to a VP8 WebM video.  This is handy for converting a rendered animation from, for example, Blender to WebM.

To summarize the process: first we need to convert the PNG frames to a YUV4MPEG file, then vpxenc can encode that to a webm file.

On Ubuntu Linux

  

  1. Install the mjpegtools package - this gives you the png2yuv command.  (MJPEG Tools project)

  2. Install the vpx-tools package - this gives you the vpxenc command.  (Note: vpxenc is part of the official VP8 SDK.)

  3. Use png2yuv to convert the frames to a YUV4MPEG file (aka Y4M, I420 or IYUV).  For example:

png2yuv -I p -f 24 -b 1 -n 1440 -j big_buck_bunny_%05d.png > my.yuv

Let's break that down:

  4. Encode the YUV file with with vpxenc.  For example:

vpxenc --good --cpu-used=0 --auto-alt-ref=1 --lag-in-frames=16 --end-usage=vbr --passes=2 --threads=2 --target-bitrate=3000 -o my.webm my.yuv

This will output a file my.webm.  Perhaps the most important option above is --target-bitrate.  This is your primary control for the file size (lower bitrate, smaller file).  For details on the other encoding options please refer to the VP8 Encoder Parameter Guidelines.

Windows

Use the same commands as for Linux (above).  The only difference should be where you get the tools:

Happy encoding!