Take the 2-minute tour ×

Any possibility to detect maximum packet (AVpacket) size that av_read_frame() can read?

share|improve this question
did you find the answer? –  jAckOdE Nov 19 '12 at 3:25

1 Answer 1

I was looking for the same recently. It appears that av_read_frame internally calls a codec specific read_packet function for each codec/format. This in turns allocate memory per packet and frees it depending on the maximum limits that the codec/format poses. So as long as you have memory to support the (in)valid stream you should be fine and the limits are specific to the codec/format decoders. [YOu can find the function defined in AVInputFormat for each format as .read_packet ].

share|improve this answer
Good point. I already asked developers of ffmpeg about limitation and they said it limited by: 1) MAX_INT bound 2) codec limitation (like you said) 3) even video file limitation in some cases –  DEgITx Aug 8 '12 at 12:00
how do you get maximum packet size with read_packet? –  jAckOdE Nov 19 '12 at 3:27
@jAckOdE, you cannot do it that way. You will have to go and check for the codec in the code. –  av501 Nov 24 '12 at 14:51
sorry, i'm kinda new to this, so bear with me. Can you be more specific? what properties should i check if i have the codec context and the codec? –  jAckOdE Nov 24 '12 at 17:40

Your Answer


