[Libav-user] invalid AVPacket size in av_read_frame usage.

Carl Eugen Hoyos cehoyos at ag.or.at
Sun Apr 26 23:10:10 CEST 2015

daggs <daggs at ...> writes:

> I'm writing a program that needs to sample the 
> screen in bgra format. the problem is what I try 
> to read an av frame, I get this error:
> [rawvideo  <at>  0x1403aa0] Invalid buffer size, 
> packet size 1228800 < expected frame_size 8294400

Where does the packet come from that you pass to 
the video decode function?
What is the resolution of the video that you 
want to decode?

I wonder why you need the rawvideo decode function 
at all if you want the libraries to encode bgra 
frames that your application provides.
I would have expected that you have your bgra frame 
in memory and either use an encoder that supports 
bgra and send the frame directly to the encoder 
function or call libswscale to get yuv420p frames 
for an encoder that does not support bgra.

Carl Eugen

More information about the Libav-user mailing list