Would a Pi Zero W work for this, or do you need a full-size Pi 4? I would think that with the HDMI dongle doing the hardware MJPEG encoding, a Pi Zero might suffice. It'd be really neat to A) bring the cost down another $30 and B) be able to package everything into a tiny 3D printed case.
I think you might run into a lack of connectivity on the Pi Zero W. Since the only data USB port has to run in device mode, I would assume you can't connect the HDMI capture device.