made ffmpeg engines a little bit more thread-safe