It's possible to MLKit's segmentation features replace the video background, but it will require some work. There is one idea:
1. Use ImageAnalysis to send the ImageProxy to MLKit and get the mask. Note that the mask is in the ImageAnalysis' coordinate system, so it has to be transformed to the video output coordinate system before applying.
2. The CameraEffect
API is for adding special effects to CameraX output. You can use OpenGL to process the input. One example can be found here: link
3. Then, in your OpenGL shader, blend the mask, the input image, and the background image to replace the background.