MCPcopy Index your code
hub / github.com/Eyevinn/srt-whep

github.com/Eyevinn/srt-whep @v3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.0 ↗ · + Follow
58 symbols 97 edges 17 files 3 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

SRT to WebRTC

This application ingests one MPEG-TS over SRT stream and outputs to WebRTC recvonly clients using WHEP as signaling protocol.

Build

OSX

Requirements: - XCode command line tools installed - Install GStreamer using Homebrew or from GStreamer's website - Install Rust using rustup

If you want nicely formatted output you need to install bunyan

cargo install bunyan

Verify your installation with

bunyan --help

Gstreamer install via brew


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

Run

To generate SRT stream, you need to set the GST_PLUGIN_PATH, GIO_EXTRA_MODULES and DYLD_LIBRARY_PATH environment variable to where you have the gstreamer plugins installed, e.g:

export PATH=/Library/Frameworks/GStreamer.framework/Versions/Current/bin:$PATH
export GST_PLUGIN_PATH=/Library/Frameworks/GStreamer.framework/Versions/Current/lib:$GST_PLUGIN_PATH
export GIO_EXTRA_MODULES=/Library/Frameworks/GStreamer.framework/Libraries/gio/modules/ 
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GST_PLUGIN_PATH

Example command for starting a srt stream with screen captured video and a constant tone as audio.

gst-launch-1.0 -v \
    avfvideosrc capture-screen=true ! video/x-raw,framerate=20/1 ! timeoverlay ! videoscale ! videoconvert ! x264enc tune=zerolatency ! video/x-h264, profile=main ! mux. \
    audiotestsrc ! audio/x-raw, format=S16LE, channels=2, rate=44100 ! audioconvert ! voaacenc ! aacparse ! mux. \
    mpegtsmux name=mux ! queue ! srtsink uri="srt://127.0.0.1:1234?mode=caller" wait-for-connection=false

We are setting the srt sink as 'caller' mode, so our application needs to be in 'listener' mode. If srt sink is in 'listener' mode, the application needs to be in 'caller' mode.

Then run the application.

cargo run -- -i 127.0.0.1:1234 -o 127.0.0.1:8888 -p 8000 -s listener

With pretty print

cargo run -- -i 127.0.0.1:1234 -o :8888 -p 8000 -s listener | bunyan

The whep server will be started on port 8000. You can then play it out using WHEP Player.

The pass-through SRT stream can be viewed using the following command:

gst-launch-1.0 -v playbin uri="srt://127.0.0.1:8888?mode=listener"

Example

Example

Plans

  • [x] Understand WHEP endpoint for WebRTC based streaming.
  • [x] Check available tools for SRT to WebRTC
  • [x] Build a prototype server for WHEP
  • [x] Build the HTTP server in Rust
  • [x] Add support for audio
  • [x] Check the format/codec of the SRT stream
  • [x] Write the pipeline in Rust
  • [x] Add optional pass-through to another SRT receiver
  • [x] Test with browser
  • [x] Add support for graceful shutdown
  • [x] Add support for multiple WebRTC clients
  • [x] Add support for different SRT stream modes (caller/listener)
  • [ ] Add support for different browsers
  • [ ] Improve the error handling & logging
  • [ ] Add support for cloud deployment

Sample Pipeline

Pipeline

Issues

All relevant discussions are tracked in the issues

Support

Join our community on Slack where you can post any questions regarding any of our open source projects. Eyevinn's consulting business can also offer you:

  • Further development of this component
  • Customization and integration of this component into your platform
  • Support and maintenance agreement

Contact sales@eyevinn.se if you are interested.

About Eyevinn Technology

Eyevinn Technology is an independent consultant firm specialized in video and streaming. Independent in a way that we are not commercially tied to any platform or technology vendor.

At Eyevinn, every software developer consultant has a dedicated budget reserved for open source development and contribution to the open source community. This give us room for innovation, team building and personal competence development. And also gives us as a company a way to contribute back to the open source community.

Want to know more about Eyevinn and how it is to work here. Contact us at work@eyevinn.se!

Core symbols most depended-on inside this repo

as_ref
called by 5
src/domain/session_description.rs
get_subscriber
called by 3
src/telemetry.rs
init_subscriber
called by 3
src/telemetry.rs
spawn_app
called by 3
tests/sdp_exchange.rs
close_pipeline
called by 2
src/pipeline.rs
run
called by 2
src/startup.rs
error_chain_fmt
called by 2
src/domain/errors.rs
remove_connection
called by 2
src/domain/app_state.rs

Shape

Method 25
Function 22
Class 8
Enum 3

Languages

Rust93%
Python7%

Modules by API surface

src/domain/session_description.rs12 symbols
src/pipeline.rs11 symbols
src/domain/app_state.rs11 symbols
src/domain/errors.rs5 symbols
tests/sdp_exchange.rs4 symbols
scripts/test_server.py4 symbols
src/routes/whep_handler.rs3 symbols
src/telemetry.rs2 symbols
src/startup.rs1 symbols
src/routes/whip_handler.rs1 symbols
src/routes/remove_connection.rs1 symbols
src/routes/list.rs1 symbols

For agents

$ claude mcp add srt-whep \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page