[ffmpeg] - backport
https://github.com/FFmpeg/FFmpeg/commit/31a0ca9e75e4c91437c8681b9655a67f09b693dd