#Sub-second screen-sharing between Linux machines.html
>an uninterrupted network connection will be required,
which in most cases will mean using a VPN
>${VIEWER_IP} stands for the IP of the watcher and is no typo
>with the srt protocol, the streamer is pushing data to an IP,
as opposed to say webhosting where the client contacts the server
>go ahead and choose ${PORT} at random {8697}
>NOTE: the observer latency was ~800ms routing from the eastern-block to the US;
however it has a tendency to degrade over time;
restarting it once in a while is recommended
{@begin=sh@
# Command to start listening
# NOTE: Must be ran before the stream starts!
# NOTE: Setting the bellow destination URL inside
# OBS should also yield a stream.
# It should and does on a Debian build,
# but silently fails on *my* Gentoo build.
mpv \
--profile=low-latency \
"srt://${VIEWER_IP}:${PORT}/?mode=listener"
@end=sh@}
{@begin=sh@
# Command to start streaming
# NOTE: Will fail if the listener is absent!
ffmpeg \
-hide_banner \
-loglevel error \
-fflags nobuffer \
-avioflags direct \
-use_wallclock_as_timestamps 1 \
-thread_queue_size 64 \
-probesize 32 \
-analyzeduration 0 \
-f x11grab \
-draw_mouse 0 \
-framerate 30 \
-video_size 1920x1080 \
-i :0.0+0,0 \
-fps_mode passthrough \
-c:v libx264 \
-preset ultrafast \
-tune zerolatency \
-g 30 \
-b:v 8M -maxrate 10M \
-bufsize 10M \
-pix_fmt yuv420p \
-bsf:v h264_mp4toannexb \
-flush_packets 1 \
-max_interleave_delta 0 \
-muxdelay 0 \
-muxpreload 0 \
-mpegts_flags resend_headers \
-flags +low_delay \
-f mpegts \
"srt://${VIEWER_IP}:${PORT}/?mode=caller"
@end=sh@}