[FFmpeg-user] Some help/ideas
joolzg at btinternet.com
Fri Mar 14 11:20:10 CET 2014
I am working on some new infrasturcture which will allow the playing/overlaying of images on to the main video at predtermined times, i can already add/remove images, which was pretty simple, but what i want now is to be able to take an animated gif/png and play this into my system frame by frame so it looks correct when encoded to its final format.
My code for the single frame image looks like this
static int load_image(uint8_t **image_data, int *w, int *h, int
const char *filename, void *log_ctx)
enum AVPixelFormat pix_fmt;
uint8_t *src_data, *dst_data;
int src_linesize, dst_linesize;
/* load image from file */
if ((ret = ff_load_image(src_data, src_linesize, w, h, &pix_fmt, filename, log_ctx)) < 0)
if ((ret = ff_scale_image(dst_data, dst_linesize, *w, *h, PIXEL_FORMAT,
src_data, src_linesize, *w, *h,
log_ctx)) < 0)
*stride = dst_linesize;
/* copy image_data to a newly allocated array */
*image_data = av_malloc(*stride * *h);
ret = AVERROR(ENOMEM);
av_image_copy_plane(*image_data, *stride, dst_data, dst_linesize, *w*4, *h);
Now this returns a single frame of data containing the image. What i need is a way to load a multi frame gif/png and be able to play each frame individually
into the system, and my system gets called every frame to add the image onto the main video plane. So if I can load an animated, then have a call and get the next image then that would be perfect.
Any pointers as to how i can do this?
I dont want to add this onto the command line as a '-i' as this is going to dynamic.
More information about the ffmpeg-user