While using a one-shot timer circuit will work, I think an easier solution can be used. Take a look at this circuit.
For clarification, "VBAT" is a 12V source that is always on as long as the battery is connected. However, "ACC" is a 12V source that is only on when the ignition is on or the key is set to "accessory." Rather than using a 5V relay just to control the power to the RPi, why not use a standard 12V auto relay as shown. This way, there is no wasted power (except for the coil current while the power is on) because everything will be disconnected from the battery.
One side of the coil is always connected to 12V. The opposite side is connected to ground (chassis) through an N-Channel FET (Q1). While a MOSFET is used in the diagram, any FET capable of sinking the coil current can be used. When "ACC" is powered ON, Q1 will switch ON, connecting the coil to ground and actuating the switch. This will in turn power whatever 5V regulation circuit you plan to use (a simple 7805 regulator with heat sink, a switching DC-DC converter, the USB supplies mentioned, etc).
The diode D2 is there to ensure the capacitor can only discharge into Q1 and can be regular or Shottky. Other methods should probably be used for over voltage and current protection from the battery.
The "ACC" voltage can be put through a voltage divider to create a 3.3V signal for the RPi. Be careful with this voltage level, considering a 12V auto battery can really be more like 14V DC. As long as this signal is HI, the RPi knows that the power is on. Obviously, this GPIO pin should be set as an input with any internal pullups disabled. When "ACC" is turned off, the RPi should see the LO signal on the pin and begin its shutdown.
When the "ACC" voltage is turned off, the capacitor C1 will retain the charge for so long, discharging through the resistor R1. Once the capacitor voltage drops below the gate threshold of Q1, it will switch OFF, disconnecting the relay coil from ground and removing power from the peripheral circuit. If a "logic level MOSFET" is used for Q1, it will remain switched ON until C1 voltage is fairly low. I tested this circuit using an NTD4960 (Datasheet), and it remained on for around 15 seconds - until C1 was around 2V. To increase the time, increase the capacitance value.
The LED has a voltage drop of 2v and a runs well on about 10-15ma, but how do I handle the capacitor in parallel?
The capacitor won't have any effect on the LED current after the circuit has been "on" for a few microseconds, so you don't need to worry about it when calculating the resistor value.
do I need a resistor between the optocoupler and B as the video would suggest?
You don't need a resistor.
You don't need to limit current through the optocoupler --- it won't draw any more current than what's stimulated as photocurrent by its LED (driven by the 15 V AC)
You aren't using the signal at the optocoupler's 'C' pin as a logic signal, so you don't need it to pull to a low voltage when the opto is active.
A current path into the 'B' pin could speed up the operation of the phototransistor, but for this kind of application, you don't need nanosecond response times.
It looks like there's a pathway, when the optocoupler is closed and the transistor is allowing current from E to C, that directly connects the 3.3v source to the GPIO pin without a resistor on the route (via the transistor) - is that a problem? Wouldn't it cause too much current to the GPIO pin?
Assuming you have the GPIO configured as an input (and this should be the power-up default), it will have a high input impedance, and won't allow more than a few microamps to flow into it.
A few k-ohm resistor would likely not change the behavior any and would protect you from overcurrent in the event you accidentally program the GPIO as an output and the driven value conflicts with the value generated by this doorbell circuit.
Best Answer
Yes, the reason is RPi's GPIO output voltage is 3.3v, and your mosfet is not designed for 3.3V logic level driving.
Replace the mosfet with one that has a vgs on of under 3.3V, replace it with a NPN transistor so you can use current instead of voltage to turn it on, or use a mosfet driver cricuit, like a 2n3904 npn to turn on and off the mosfet from your RPi with a higher voltage.