Skip to content

talquor/webcam2rtsp

Repository files navigation

📡 webcam2rtsp

macOS Only MIT License

webcam2rtsp is a Python package for macOS that streams your webcam over RTSP using H.264 encoding and GStreamer.

🖥️ URL: rtsp://localhost:8851/webcam1


✅ Features

  • RTSP server accessible on localhost:8851
  • Streams using system webcam with H.264 encoding
  • Easy to install and run in a virtual environment
  • Compatible with GStreamer-enabled players (VLC, FFplay, etc.)

🚀 Getting Started (macOS only)

1. Install GStreamer (macOS)

brew install gstreamer gst-plugins-base gst-plugins-good gst-libav gst-plugins-bad gst-plugins-ugly pygobject3

2. Add Environment Variables Temporarily

In your terminal (in the project folder):

export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib
export GI_TYPELIB_PATH=/opt/homebrew/lib/girepository-1.0

3. (Optional) Add Environment Variables Permanently

Edit your ~/.zshrc (or ~/.bash_profile):

nano ~/.zshrc

And copy in the end of the .zshrc and .bash_profile at the end.

export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib
export GI_TYPELIB_PATH=/opt/homebrew/lib/girepository-1.0

Good luck saving the file using using nano editor!

4. Clone and run

git clone https://github.com/cosminmemetea/webcam2rtsp.git
cd webcam2rtsp
python3 -m venv venv
source venv/bin/activate
pip install -upgrade pip
pip install -r requirements.txt
pip install -e .
python -m webcam2rtsp

You can now open the stream at:

rtsp://localhost:8851/webcam1

With:

VLC → Open Network Stream

FFplay → ffplay rtsp://localhost:8851/webcam1

5. (Optional) Create a macOS .command launcher

Let’s automate this. Create a file named run_webcam2rtsp.command in your project folder:

touch run_webcam2rtsp.command
chmod +x run_webcam2rtsp.command

License

MIT – Permissive open-source license allowing free use, modification, and distribution for any purpose, with minimal restrictions.

Contributing

Contributions make this repo better! Whether fixing bugs, adding features, or improving docs, you're welcome. Let's have fun!

About

Python package for macOS that streams your webcam over RTSP using H.264 encoding and GStreamer.

Resources

License

Stars

Watchers

Forks

Packages

No packages published