Made FFmpeg optional and fixed potential crashes