Hi all!
I need to solve the problem with memory usage by libavformat.
Let us have the file test.avi which contains video in mpeg-2 format and
audio in mp3 format.
I want to read only audio stream from that file. Now I can do it with
this code:
int audio_stream_id;
AVFormatContext *pFormatCtx;
//open format context and get audio_stream id number
//........
AVPacket packet;
while( 0 == av_read_packet(pFormatCtx, &packet) )
{
if (packet.stream_index == audio_stream_id)
{
//do something with audio packet ....
}
av_free_packet(&packet);
}
//close context
I don't need video stream data but av_read_packet allocates memory for
packet.data buffer which I need to deallocate by using av_free_packet.
This is very bad for performance. Does anybody have any idea how to skip
memory allocation for video stream buffer data?
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user