Ok thanks. I increased the value in this line:
#define AVCODEC_MAX_VIDEO_FRAME_SIZE (3*1024*1024)
which appears in these two files:
modules\codec\ffmpeg\encoder.c
modules\stream_out\switcher.c
and now my PNG snapshots work fine. I don't know if these changes broke anything else.