[FFmpeg-user] How to assessment the memory will use when motion interpolation on a 4k video?

Ted Park kumowoon1025 at gmail.com
Thu Mar 26 15:13:49 EET 2020


> Hi all
> I have a 4k video, resolution: 4320x2880, as a result form EDSR-pytorch

>  Duration: 00:00:03.00, start: 0.000000, bitrate: 9673 kb/s
>    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
> 4320x2880, 9669 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)

As far as bitrate goes, ballpark estimate, counting uncompressed y’uv 4:2:0 8 bpc as 3/2 bytes per pixel (luma is just 1 byte, for chroma, 1 byte over 4 pixels per channel => 1 + (1/4)*2 => around 3/2 bytes per pixel) you have around 4000 × 3000 = 12,000,000 pixels per frame, 12MP × 3/2 B = 18MB per frame, 25 fps input so 500MB/s or 4Gbps.

> I want to use motion interpolate it to 60fps, so command like this:
> ffmpeg -i test.mp4 -filter "minterpolate=fps=60" output.mp4

> It always failed with "Cannot allocate memory", so my question:
> How to assessment the memory usuage for that operation?

On the other hand interpolation involves making frames up by referencing other frames close by (time-wise) so with only 3 seconds input nearly all of them might be kept in memory, plus the interpolated frames to be encoded. And with the filtering/decoding/encoding all being multithreaded, I think it would take maybe 1.5×(# of cores) GB or some multiple of that from the start.

> ffprobe version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2007-2019 the FFmpeg
> developers

Could be something else though. Does the same command work on lower data rate movies? Try using a newer a newer build as well.

Ted Park

More information about the ffmpeg-user mailing list