cleanup
fix wrong cleanup when fail
fix init and deinit ffmpeg