Is it possible to go directly from dd-wrt to openwrt and back to dd-wrt?
Router Model Dlink DIR-878 A1
Firmware Version DD-WRT v3.0-r44863 std (11/24/20)
Kernel Version Linux 4.14.208 #597 SMP Tue Nov 24 17:54:59 +07 2020 mips
Q: Would I use factory or the other openwrt image?
follow dd-wrt's documentation specific to your device in order to revert back to the OEM firmware
follow OpenWrt's documentation specific to your device in order to install OpenWrt
Depending on device and exact version of the running 3rd party firmware, shortcuts may exist - or they may not. Answering this would require someone very familiar with dd-wrt, OpenWrt and your exact device, this cross-section of people tends to be somewhere between very low and non-existent. Therefore the only safe approach is to follow the (hopefully-) documented and tested procedures for either firmware, namely how to go back to the official OEM device firmware from dd-wrt, respectively installing OpenWrt on an 'untouched' OEM device running the OEM firmware. Straying from this official approach holds a huge danger of damaging or bricking your device permanently (unless you do know exactly what you're doing and are willing to take this very real risk).
Naturally the same would apply, should you decide to return to dd-wrt in the future - OpenWrt can only document how to install the OEM firmware, but not specific -but volatile in nature, due to changing requirements between even different build versions of the same 3rd party firmware- information about the installation of your preferred other 3rd party firmware.
--
It is generally strongly recommended to backup as much as possible (bootloader/ bootloader-env and wifi calibration data) before doing potentially risky operations like this.
just use the recover console with factory image
it's the same way to go back to dlink's firmware
you can do it twice once with dlink then openwrt but well no point
No. Direct mtd flashing is not recommended. Since the mtd layout is different on dd-wrt you would need specific instructions from dd-wrt to attempt it.
Instead, use the recovery method described here.
Use a "factory" OpenWrt or an unencrypted D-link firmware for this. It would not care what firmware is presently installed, since it doesn't boot the installed firmware at all.
I have not actually done this on that specific model. But it should be relatively safe.