I have an AI Thinker ESP32-CAM and I've had issues uploading the CameraWebServer sketch, every time I hit upload it says "A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header" and I've tried everything that I can think of, I disconnected and reconnected all the connections on my FTDI board and I've done all sorts of button presses during the connection, I've switched the voltage and I've bought a whole new board and I don't know what the issue is or how to fix it.
ESP32 only works with 3.3 V serial do not switch the FTDL voltage to 5 V
Watch out for the serial connections too
If you mixed it up it won't work!
First of all you need to connect two pins only when uploading It is all ready fixed for you need to press the rest button when uploading and seeing these dots as below image.
- ESP32-CAM on-board RST button Press and hold until you see uploading
After a few seconds, the code should be successfully uploaded to your board.
I hope this helped for you!
You can reffer to this link for more info