[x264-devel] Memory requirements

Jason Garrett-Glaser jason at x264.com
Thu Aug 18 20:51:03 CEST 2011


On Thu, Aug 18, 2011 at 10:49 AM, Dan Haddix <dan6992 at hotmail.com> wrote:
> I'm working on adding support for x264 encoding to a product which currently
> uses the MainConcept encoder. The code I use for both encoders is similar. I
> set the resolution, avg/max bitrate, frame rate, aspect (sar) and interlaced
> flag and I let the automatic logic of each encoder figure out the rest. One
> major difference I notice between the encoders is memory usage. When I
> encode using MC the memory used by my program jumps from about 90MB to about
> 175MB. But when I encode with x264 it jumps to 600MB. Is this typical? Is
> there anything I can do to curb the requirement a little? I've checked my
> code for leaks and I don't think it's coming from my end. Plus it jumps
> almost immediately and stays, which also seems to rule out a leak.
>
> Any advice you could give would be appreciated.
>
> Thanks,
> Dan

The memory requirements of x264 depend heavily on the encoding
settings used.  Extreme encoding settings (Lots of refs, MBAFF, 4:4:4,
lots of B-frames, large lookahead, lots of threads, etc) will
dramatically increase memory requirements.

The main culprit for memory usage at "ordinary" settings (e.g. preset
medium) is the lookahead: x264 typically needs to allocate about 50
fenc frames (source frames) for the lookahead, and 10-15 fdec frames
(reconstructed frames) for the main encode.

Jason


More information about the x264-devel mailing list