[Libav-user] Encoding a screenshot into a video using FFMPEG

Steffen Ebersbach ebersbac at hs-mittweida.de
Thu Apr 11 07:41:01 CEST 2013

> I'm wanting to grab the pixels from the screen, and encode that into a video.
> The screenshot will save fine to a bmp file, but when I try and cast it to
> work with encoding into a video, I get a swscale() src image error in my
> output and the video file is just a blank white/gray screen.  I made a topic
> on stackoverflow
> <http://stackoverflow.com/questions/15914012/encoding-a-screenshot-into-a-video-using-ffmpeg>  
> where you can see the source I'm using.

I mad this for a longer time and now it works. I will look at my code
later. But for the moment i think these two lines are wrong:

|avpicture_fill((AVPicture*)inpic, (uint8_t*)pPixels, PIX_FMT_BGR32, c->width, c->height);
av_image_alloc(inpic->data, inpic->linesize, c->width, c->height, c->pix_fmt, 1);|

you first copy the screenshot from pPixels to the AVpicture inpic, but
then allocat the AVpicture, so a empty frame gots to the encoder.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130411/c1a090b0/attachment.html>

More information about the Libav-user mailing list