Skip to content

ffmpeg can cut off the end of a transparent VP9

  • by

It’s a current bug

tl;dr: use -lag-in-frames 0 as a workaround for now

I have been creating stinger transitions for my stream. These are animated transparent transitions that switch out scenes when at least one frame has no transparency.

Example stinger from A ? B ? A
Example stinger from A ? B ? A

I’ve been using Blender to create the animations, and ffmpeg to encode the images into a video. The VP9 encoder can handle transparent videos, so the command looks like:

ffmpeg -framerate 60 -f image2 -i frame%04d.png -c:v libvpx-vp9 -pix_fmt yuva420p -an -lossless 1 stinger.webm

However, my latest stinger was slightly longer than others at five seconds. I noticed that it was ending a few frames too early. Thanks to Carl on the ffmpeg-user mailing list it was pointed out that this is a known bug.

In the Trac ticket a user called User posits the problem is with lag-in-frames; by setting it to 0 the correct number of frames are output.

Tell us what's on your mind

Discover more from Rob's Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading