nanoshare
v0.2.1
Published
Local screen sharing over WebRTC with a Bun CLI.
Downloads
288
Readme
nanoshare – local screen sharing, as simple as it gets
you shouldn't have to mess with vnc, rdp or ssh to view your laptop's screen on your computer (or any other device on your network).
usage
run nanoshare using bun:
bunx nanosharemacos will ask for permission to access your screen, and you might have to restart your terminal before the permission is granted by the os.
this will obviously require bun.
requirements
- bun installed
ffmpeginstalled and available in yourPATH- host and viewer on the same network
- screen-recording permission granted to terminal (macos)
features
nanoshare runs on port 37777 by default, at 30fps with 14M video bitrate. you can change settings by passing flags when running bunx nanoshare.
--port <number>– change the port to listen on--fps <number>– change the framerate--video-bitrate <bitrate>– change the video bitrate--use-hwaccel– enable hardware acceleration on macOS--source <screen|testsrc>– use a test pattern or screen capture--rtp-port <number>– change the local port for ffmpeg → webrtc ingress--audio– enable system audio streaming (best effort)--audio-device <value>– override system audio input device (platform-specific)--audio-rtp-port <number>– change local audio RTP ingress (default5006)--pin <pin>– change the pin to require to access the live stream
quick examples
default:
bunx nanosharecustom port + pin:
bunx nanoshare --port 3000 --pin 123456use a test source (great for debugging without sharing your actual screen):
bunx nanoshare --source testsrcmacos hardware encoding:
bunx nanoshare --use-hwaccelstart with system audio enabled:
bunx nanoshare --audiostart with explicit audio device:
bunx nanoshare --audio --audio-device "BlackHole 2ch"environment variables
if you prefer env vars over cli flags:
NANOSHARE_PORT(default:37777)NANOSHARE_PIN(default: random 6-digit pin)NANOSHARE_FPS(default:30)NANOSHARE_VIDEO_BITRATE(default:14M)NANOSHARE_USE_HWACCEL=1to enable hw acceleration on macosNANOSHARE_SOURCE=screen|testsrc(default:screen)NANOSHARE_RTP_PORT(default:5004)NANOSHARE_AUDIO=1to enable system audio on startupNANOSHARE_AUDIO_DEVICE(optional platform-specific audio input device)NANOSHARE_AUDIO_RTP_PORT(default:5006)NANOSHARE_DISPLAY(linux only, optional override for X11 display)
example:
NANOSHARE_PORT=3000 NANOSHARE_FPS=60 NANOSHARE_VIDEO_BITRATE=8M bunx nanosharewhat you'll see
when nanoshare starts, it prints:
- local url (for same machine)
- lan url (for other devices on your network)
- a 6-digit pin
runtime controls:
Ctrl+Cto stop- press
ain the host terminal (tty mode) to toggle audio on/off; viewers auto-reconnect
open the url on another device, enter the pin once, and you're in.
troubleshooting
ffmpeg: command not found
install ffmpeg first (brew install ffmpeg,sudo apt install ffmpeg, etc). on windows, have it in yourPATH.- macos keeps denying capture
enable your terminal in system settings → privacy & security → screen recording, then fully restart your terminal. - viewer can't connect
make sure both devices are on the same lan and your firewall allows the selected port. if the port is in use, try passing a different one with--port <number>. - linux black screen
check thatNANOSHARE_DISPLAY(or systemDISPLAY) is set correctly (for example:0.0). - no audio on macos
system audio usually needs a loopback device (for example BlackHole/Loopback/Soundflower). install one and pass--audio-deviceif auto-detection doesn't find it. - no audio on windows/linux
pass an explicit--audio-deviceand verify ffmpeg can read it. nanoshare will continue in video-only mode if audio setup fails.
acknowledgements
built by exotic with gpt-5.3-codex in a couple hours. feel free to contribute if you want, or fork and improve.
