Can be used for streaming data (webcam or screen capture) from the Windows to WSL
Run from a WSL terminal
ip route list default | awk '{print $3}'
Start the simple rtsp server (in Windows) before running any of the ffmpeg commands
All of the ffmpeg commands should be executed within the Windows environment.
Add -hide_banner -loglevel error
to any ffmpeg command to hide the log messages
View available devices (wiki)
ffmpeg -list_devices true -f dshow -i dummy
View available resolutions
ffmpeg -list_options true -f dshow -i video="Integrated Camera"
Stream from one of the available video devices (replace Integrated Camera
with the video device name and <ip>
with the IP address from the commands above)
ffmpeg -f dshow -i video="Integrated Camera" -framerate 30 -video_size 640x480 -f rtsp -rtsp_transport udp rtsp://<ip>:8554/webcam.h264
This stream can be opened on Python OpenCV from WSL (replace <ip>
)
cv2.VideoCapture("rtsp://<ip>:8554/desktop.h264")
Replace <ip>
with the WSL IP
ffmpeg -f gdigrab -framerate 15 -i desktop -f h264 -f rtsp -rtsp_transport tcp rtsp://<ip>:8554/desktop.h264