I am trying to encode a sequence of images generated in my c++ code into animated images to make viewing them easier. I picked webp and followed some code examples from the official document. I would not need to tune any parameters. As long as it is animated, it is great. The code (https://developers.google.com/speed/webp/docs/container-api) is like this:
WebPAnimEncoderOptions enc_options;
WebPAnimEncoderOptionsInit(&enc_options);
// Tune 'enc_options' as needed.
WebPAnimEncoder* enc = WebPAnimEncoderNew(width, height, &enc_options);
while(<there are more frames>) {
WebPConfig config;
WebPConfigInit(&config);
// Tune 'config' as needed.
WebPAnimEncoderAdd(enc, frame, timestamp_ms, &config);
}
WebPAnimEncoderAdd(enc, NULL, timestamp_ms, NULL);
WebPAnimEncoderAssemble(enc, webp_data);
WebPAnimEncoderDelete(enc);
However, even though the input frames are double-checked and time stamp increasing, in my output file only the first frame is encoded. By setting
enc_options.verbose = true;
I see that only the first time WebPAnimEncoderAdd() ran did the coder warn my on converting YUV to rgba with loss. Am I following the wrong example or what?
Much appreciated.