> Please post your source code, if possible - the minimal crashing example.
> Make sure you use the latest version of fffmpeg libraries. What is your
> platform and compiler?
>
> BR,
> Alex
I have found what my problem was. As the following code sample would show, I
was using av_malloc to allocate an AVPacket on the heap. While I called
av_init_packet to initialize the fields of the AVPacket struct, that function
does not zero out the data or size field. Changing this to av_mallocz instead
fixed the issue I was running into.
AVFrame* testFrame;
AVCodecContext* context;
/*
I set up the frame and context in here.
*/
int validPacket = 0;
AVPacket* packet = reinterpret_cast<AVPacket*>(av_malloc(sizeof(AVPacket)));
av_init_packet(packet);
int error = avcodec_encode_video2(context, packet, testFrame, &validPacket);
if (validPacket)
{
// TODO: save out packet data.
av_free_packet(packet);
}
av_free(packet);
Thanks,
David
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user