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

Ankit SINGHAL ankit.singhal at st.com
Thu Jul 21 14:01:14 CEST 2011

Hello all,

I don't know if I have explained my question properly but if anyone has understood and can respond, it would be a great help. Also let me know if it is the right forum to post queries related to ffmpeg.

Ankit Singhal

-----Original Message-----
From: Ankit SINGHAL
Sent: Monday, July 18, 2011 6:13 PM
To: 'libav-user at ffmpeg.org'
Subject: Issue with MAX_READ_SIZE in libavformat/utils.c

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