[FFmpeg-devel] libavcodec memory usage

Ronald S. Bultje rsbultje at gmail.com
Tue Jan 3 18:09:06 EET 2017


Hi,

On Tue, Jan 3, 2017 at 10:58 AM, Matthieu Beghin <
matthieu.beghin at garagecube.com> wrote:

> Hi,
>
> My application is using libavcodec etc. to playback movies. Everything is
> ok with our 64 bits app. But I have a 32 bits app and there when playing a
> 8k we reach 3 GB memory usage, so when adding another 4k or a few HD
> movies, the app crashes.
>
> I haven’t found a way to reduce memory usage. The library stores lots of
> frames or data. I tried reducing thread_count to 1 to test, but it does not
> help and performances are not acceptable.
>
> Is there a way to limit the size of buffered data / number of buffered
> frames ?
> I’m using FFMPEG 2.8.7 (libavcodec.56.60.100 / libavformat.56.40.101).


I'm assuming that you're talking about 8K H264 with pixfmt=yuv420p10? 8K
yuv420p10 frames are 100MB, H264 can have up to 16 refs/field, for
interlaced content this means 32 plus delayed output and current_pic gives
H264_MAX_PICTURE_COUNT = 36 without threading: 36*100=3.6GB.

There's not much you can do about this in the decoder side. You can tell
your encoder to use less references and discard references earlier. How to
do this depends on which encoder you're using.

Or maybe consider ditching 32bit support?

Ronald


More information about the ffmpeg-devel mailing list