[Libav-user] av_read_frame returns out of bounds data

John Bush compguy108 at yahoo.com
Fri Nov 25 21:08:52 CET 2011

Hey guys/gals,

So I'm trying to develop a program that reads in a raw video stream from a webcam, encodes it, and then saves it to a file. Simple right? Well here's the problem, I create an AVPacket and initialize it calling av_new_packet with the packet and a size of 1028. I open my input via avformat_open_input, passing the webcam as a file (/dev/video0) and the input format which is video4linux2. Out of the streams I get from this, I grab the first one that has a type AVMEDIA_TYPE_VIDEO. Everything goes smoothly up until I try running av_read_frame with all these variables initialized and set. Though it does not segfault or return an error immediately, I print the pointer to the data of the packet and it says that it is out of bounds. I've beat my head against the wall and hope somebody can point out something stupid I'm forgetting to do that explains why this won't work and why my data pointer is out of bounds. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111125/e43ad6d8/attachment.html>

More information about the Libav-user mailing list