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

Simone Donadini Simone.Donadini at avolites.com
Fri Mar 15 13:16:54 EET 2019


Hi Carl,

Thanks for your reply. The main issue we are seeing is the huge memory footprint, directly allocated by FFMPEG.

I'm no expert in FFMPEG, but it looks like it is doing this to encode multiple frames at the same time. Is this correct and expected behaviour?

If this is correct, is there a way to limit the memory usage so that it doesn't go above 4GB. Would we be able to set a maximum amount of transcodeable frames at one time?

As previously stated, the app is built as a 32 bit windows application. Using the large address aware flag to allow for a maximum of 4GB of memory on a 64bit OS.

Do you have any advice on how to reduce the memory footprint of FFMPEG?

Kind Regards,

Simone Donadini
________________________________________
From: ffmpeg-devel [ffmpeg-devel-bounces at ffmpeg.org] on behalf of Carl Eugen Hoyos [ceffmpeg at gmail.com]
Sent: Thursday, March 14, 2019 11:36 PM
To: FFmpeg development discussions and patches
Subject: Re: [FFmpeg-devel] 32bit transcoding app running out of memory

2019-03-14 12:51 GMT+01:00, Simone Donadini <Simone.Donadini at avolites.com>:
>> 2019-03-14 11:28 GMT+01:00, Simone Donadini
>> <Simone.Donadini at avolites.com>:

>> > we are developing a transcoder using ffmpeg based on the
>> > transcoding example
>> > https://www.ffmpeg.org/doxygen/4.1/transcoding_8c-example.html
>> > and we are encountering some problem with memory usage
>> > transcoding files with large resolutions.
>> > When transcoding 4K files, the memory usage will go up to
>> > 3.4GB but then it will stay steady for the rest of the conversion,
>> > and clean every thing at the end.
>>
>> massif (or an equivalent application) can tell you where the memory
>> is allocated, some decoders absolutely need these allocations, apart
>> from that my guess is that (a part of) the allocation does not happen
>> in FFmpeg.
>
> ok, i will try with it. But i am not seeing any memory leak with smaller
> files, so i am not sure why there would be any when using a greater
> resolution.

massif does not detect memory leaks, so I don't understand your
comment.

>> > 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,

I forgot:
Of course it does.

>>> 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.

No, memory requirements can be >3G (You did not give enough
information about input video and encoder settings, "same
properties" are not valid settings).

Carl Eugen
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel at ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel




More information about the ffmpeg-devel mailing list