[FFmpeg-user] encoding video from png diffs

Moritz Barsnick barsnick at gmx.net
Fri Sep 2 01:27:51 EEST 2016

On Thu, Sep 01, 2016 at 10:31:15 -0700, Joshua Grauman wrote:
> So I know ffmpeg can encode video from a list of pngs. (img1.png, 
> img2.png, img3.png, etc). But what if I have one png, and then a list of 
> diffs (using vcdiff) like (img1.png, img2.diff, img3.diff, etc.).

So you basically created a lossless codec of your own. ;-) How good is
the compression level for your use cases?

> I could of course generate all the pngs, but it would take up a lot
> of space and I'm wondering if anyone knows of any creative way to do
> this? Thanks!

ffmpeg can handle image pipes. So what you would do is to pipe the
first PNG to ffmpeg. Then create the seconds frame from img1.png and
img2.diff, and pipe that to ffmpeg. Reuse that second frame to create
the third one from img3.diff, and pipe that to ffmpeg. You can then
always "reuse" or drop the previous result, and always have no more
than two frames to keep for the moment.

It would be something like
$ create_png.sh | ffmpeg -f png_pipe -i - ...
(Untested. create_png.sh could be a complex command line instead of a

I don't see any documentation right now, so just check
$ ffmpeg -h demuxer=png_pipe
I don't think you need most of the options, except the framerate

Disclaimer: I haven't actually tested this. ;-)


More information about the ffmpeg-user mailing list