First: ESP32 is not binary compatible to ESP8266. Therefor firmwares build for ESP8266 do not work with ESP32, therefor make sure you have the correct firmware type for your device.
Invalid header:0xffffffff looks like a clean/empty flash memory of the device. Possible causes are: