[Libav-user] Encoding H263+ video
david.longest at apx-labs.com
Tue Jan 15 15:27:23 CET 2013
> 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?
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.
I set up the frame and context in here.
int validPacket = 0;
AVPacket* packet = reinterpret_cast<AVPacket*>(av_malloc(sizeof(AVPacket)));
int error = avcodec_encode_video2(context, packet, testFrame, &validPacket);
// TODO: save out packet data.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user