first of all you need to install some dependencies:
sudo pacman -S scrcpy dkms base-devel linux-headers v4l2loopback-dkms
then you need to load the module:
sudo modprobe v4l2loopback exclusive_caps=1
For using the front camera, first enable usb debugging in your phone, then connect your phone via cable and run this command in terminal:
scrcpy --video-source=camera --camera-size=1920x1080 --camera-facing=front --v4l2-sink=/dev/video0 --no-playback --no-window
For the back camera just change --camera-facing=front
to --camera-facing=back
.
just open obs, or run this command:
ffplay /dev/video0
For microphone you can run this command:
scrcpy --no-video --audio-source=mic --no-window
this would share your phone mic as system audio.