Problem video recording

Hi, I have a problem with recording video from a mobile device via webRTC. When you change the screen orientation, the video is recorded with artifacts. Help me figure it out or recommend a module or codecs that can fix this.