[FFmpeg-trac] #8342(undetermined:new): FFmpeg kills machine with infinitely increasing memory usage at end of PSNR calculation

FFmpeg trac at avcodec.org
Tue Oct 29 19:03:34 EET 2019


#8342: FFmpeg kills machine with infinitely increasing memory usage at end of PSNR
calculation
-------------------------------------+-------------------------------------
             Reporter:  eero-t       |                     Type:  defect
               Status:  new          |                 Priority:  important
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 With some video inputs, FFmpeg starts taking rapidly increasing amounts of
 memory at the end of the quality metrics calculation, and if left running,
 it takes all memory and renders device unusable.

 Use-case example:
 1. Get 4K video:
 {{{
 $ wget
 http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_2160p_30fps_normal.mp4
 }}}

 2. Transcode it to HEVC with FFmpeg:
 {{{
 ffmpeg -y -hwaccel vaapi -vaapi_device /dev/dri/renderD128
 -hwaccel_output_format vaapi -i bbb_sunflower_2160p_30fps_normal.mp4 -c:v
 hevc_vaapi -frames 330 output.h265
 }}}

 3. Check the resulting quality difference:
 {{{
 ffmpeg -i bbb_sunflower_2160p_30fps_normal.mp4 -i output.h265
 -filter_complex psnr -frames 300 -f null -
 }}}

 Expected outcome:
 * FFmpeg decodes all frames and outputs PSNR value

 Actual outcome:
 * Around frame 287, FFmpeg resident memory usage starts to rocket up from
 megabytes to gigabytes
 * Unless FFmpeg is interrupted within few seconds, machine freezes [1]

 Note that same happens also when:
 * "-lavfi 'ssim;[0:v][1:v]psnr'" is used instead of "-filter_complex psnr"
 * Doing transcoding Ubuntu 18.04 FFmpeg & i965 VA-driver
 * Doing transcoding with latest Git version of FFmpeg and Intel iHD Media
 stack
 * Using QSV instead of VA-API
 * Doing metrics calculation with Ubuntu 18.04, or git version of FFmpeg

 I.e. this is an old issue, not some recent regression, as Ubuntu FFmpeg
 version is:
 https://packages.ubuntu.com/bionic-updates/ffmpeg

 I had no such issues when I used another, 4096x2160 10-bit HEVC video as
 input, instead of the above 3840x2160 8-bit AVC video.   I.e. issue isn't
 related to how large resolution the video has.

 [1] This is on Ubuntu 18.04 LTS with 8GB Kabylake machine not running
 anything else besides the desktop. Fmpeg not getting OOM-killed and
 machine freezing & not recovering is also a bug (in Linux 5.x / Ubuntu
 18.04), but not relevant for this.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8342>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list