ffmpeg: Fix deallocating input threads with partly failed file allocation