Last active
July 28, 2022 16:47
-
-
Save jdmichaud/54094bac558fdb6341fc513674d221c7 to your computer and use it in GitHub Desktop.
Create a virtual monitor and stream it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Transmit a x264 compressed low latency feed using udp | |
server: gst-launch-1.0 videotestsrc is-live=true ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency byte-stream=true threads=1 key-int-max=15 intra-refresh=true ! rtph264pay ! udpsink host=%d port=9002 | |
client: gst-launch-1.0 udpsrc port=9002 caps='application/x-rtp' ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false async=false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# xrand and gstreamer needed. | |
# https://bbs.archlinux.org/viewtopic.php?id=180904 | |
# Using xrandr and gstreamer, you can stream a virtual monitor. | |
# Use xrandr to see the available "mode" | |
$ xrandr | |
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384 | |
HDMI-0 disconnected primary (normal left inverted right x axis y axis) | |
DVI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 287mm | |
1920x1080 60.00*+ | |
1280x1024 75.02 60.02 | |
1152x864 75.00 | |
1024x768 75.03 60.00 | |
800x600 75.00 60.32 | |
640x480 75.00 59.94 | |
720x400 70.08 | |
VGA-0 disconnected (normal left inverted right x axis y axis) | |
DisplayPort-1-0 disconnected (normal left inverted right x axis y axis) | |
HDMI-A-1-1 disconnected (normal left inverted right x axis y axis) | |
DVI-D-1-1 disconnected (normal left inverted right x axis y axis) | |
# HDMI-O seems available, create a new mode: | |
$ xrandr --addmode HDMI-0 1920x1080 | |
$ xrandr | |
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384 | |
HDMI-0 disconnected primary (normal left inverted right x axis y axis) | |
1024x768 75.03 | |
DVI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 287mm | |
1920x1080 60.00*+ | |
1280x1024 75.02 60.02 | |
1152x864 75.00 | |
1024x768 75.03 60.00 | |
800x600 75.00 60.32 | |
640x480 75.00 59.94 | |
720x400 70.08 | |
VGA-0 disconnected (normal left inverted right x axis y axis) | |
DisplayPort-1-0 disconnected (normal left inverted right x axis y axis) | |
HDMI-A-1-1 disconnected (normal left inverted right x axis y axis) | |
DVI-D-1-1 disconnected (normal left inverted right x axis y axis) | |
# Now output a workspace to that new virtual monitor | |
$ xrandr --output HDMI-0 --mode 1920 x 1080 --right-of DVI-0 | |
# You will see a star (*) affixed to your new mode. | |
$ xrandr | |
Screen 0: minimum 320 x 200, current 2944 x 1080, maximum 16384 x 16384 | |
HDMI-0 disconnected primary 1024x768+1920+0 (normal left inverted right x axis y axis) 0mm x 0mm | |
1024x768 75.03* | |
DVI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 287mm | |
1920x1080 60.00*+ | |
1280x1024 75.02 60.02 | |
1152x864 75.00 | |
1024x768 75.03 60.00 | |
800x600 75.00 60.32 | |
640x480 75.00 59.94 | |
720x400 70.08 | |
VGA-0 disconnected (normal left inverted right x axis y axis) | |
DisplayPort-1-0 disconnected (normal left inverted right x axis y axis) | |
HDMI-A-1-1 disconnected (normal left inverted right x axis y axis) | |
DVI-D-1-1 disconnected (normal left inverted right x axis y axis) | |
# If you try to move your mouse to the right side of your screen, it will now disappear. It's on the new monitor. | |
# https://stackoverflow.com/questions/33747500/using-gstreamer-to-capture-screen-and-show-it-in-a-window | |
# You can then stream that monitor somewhere. We will stream it to a new window but you can stream it to a network device. | |
$ gst-launch-1.0 ximagesrc startx=1920 use-damage=0 ! video/x-raw,framerate=30/1 ! videoscale method=0 ! video/x-raw,width=1280,height=960 ! ximagesink |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment