Enable surface processing with VideoCapture.Builder.setSurfaceProcessingForceEnabled(). This will rotate the video from the back camera as well, but it's an internal CameraX API that is not guaranteed to maintain.
Use the Media3 Transformer API to rotate the saved video. Check out the demo application for guidance: https://developer.android.com/media/media3/transformer/demo-application