ffmpeg: Backport c94305ae23318c8956a30485cd5642829f4f16a9 to fix #15085

This fixes: #15085

I hope I did not forget anything.