Skip to content

Instantly share code, notes, and snippets.

@cbarraco
Last active December 24, 2023 09:46
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cbarraco/f6cb40e3f5eb1f2733b5 to your computer and use it in GitHub Desktop.
Save cbarraco/f6cb40e3f5eb1f2733b5 to your computer and use it in GitHub Desktop.
The poor man's VNC. If you have ffmpeg and netcat you can stream your screen across your network with two one-liners
# If the server has ffmpeg:
## For the server:
ffmpeg -f fbdev -i /dev/fb0 -f avi pipe:1 | nc -l -p 1234
## For the viewer:
nc 127.0.0.1 1234 | ffplay -i pipe:0
# If the server doesn't have ffmpeg:
## For the server:
sudo cat /dev/fb0 | nc -l -p 1234
## For the viewer (replace 1920x1080 with the server's resolution):
nc 127.0.0.1 1234 | ffplay -f rawvideo -vcodec rawvideo -pixel_format bgra -video_size 1920x1080 -i pipe:0
@Xeddius
Copy link

Xeddius commented Jun 11, 2017

Version that doesn't require root.
Server:
ffmpeg -video_size 1600x900 -framerate 25 -f x11grab -i :0 -f avi - | nc -l -p 1234

change 1600x900 to screen size, and framerate to whichever you desire.

Client:
nc 127.0.0.1 1234 | ffplay -i -

change 127.0.0.1 to the IP of the Server.

Tested on Ubuntu 14.04, Ubuntu 16.04, and Linux Mint 18.
ffmpeg 2.8.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment