[Libav-user] Issue with MAX_READ_SIZE in libavformat/utils.c

Ankit SINGHAL ankit.singhal at st.com
Mon Jul 18 14:42:55 CEST 2011

Hello All,

I am using a little older version of FFMPEG. I try to play a file with FFMPEG which is only 1 MB. Now when I try to play that file, it first tries to get the stream info and reaches the end of the file while extracting the stream info. This results in no audio/video during playback and when I seek to any earlier location, it plays well. There is a check for MAX_READ_SIZE in av_find_stream_info in libavformat/utils.c

if (read_size >= MAX_READ_SIZE) {
            ret = count;

The MAX_READ_SIZE is defined as 5000000 which is almost 5 times the file size I m trying to play. If I reduce this size by 10 times to just 500000, I am successfully able to play the file.
Can you please help me understand why this file size has been kept as around 5 MB and what should be the optimum size so that we can handle files like in my case? If I look at the newer versions of ffmpeg, this macro and the check has been removed.

Ankit Singhal

More information about the Libav-user mailing list