[FFmpeg-devel] 32bit transcoding app running out of memory

Ronald S. Bultje rsbultje at gmail.com
Fri Mar 15 13:24:50 EET 2019


Hi,

On Thu, Mar 14, 2019 at 7:52 AM Simone Donadini <
Simone.Donadini at avolites.com> wrote:

> > 2019-03-14 11:28 GMT+01:00, Simone Donadini <
> Simone.Donadini at avolites.com>:
> > > While transcoding video files with larger resolution (8K) the app,
> > > which is 32bit, will run out of memory (>4GB).
> > > It does not look like a memory leak, as memory usage will grow as long
> as
> > > transcoding a certain amount of frames and then it will stay steady. It
> > > looks like the amount of memory usage depends on the resolution of the
> >
> > > frame, but even with a 8K frame using >4GB is not expected.
> >
> > Why do you think so?
>
> With our codec one encoded frame 7680x4320 should be ~100MB.
>

Am I right in interpreting this as that you're not actually using an
existing FFMpeg encoder, but rather your own codec's encoder wrapped into
FFmpeg by yourself?

> h264 8K @60fps

I think several dozen frame allocations in the decoder (b/c of frame
threading) can happen, depending on the machine. 8*4*1.5*2=96MB/frame
(assuming 10bits 8K, you didn't mention), so for 3 dozen (assuming
n_threads=20-30), we're talking 3.6GB. To limit, use ffmpeg -thread_type
none -i .. or ffmpeg -threads $n -i .. where $n is a smaller number (e.g. 2
or 4) than the default (which is system-dependent).

Ronald


More information about the ffmpeg-devel mailing list