A rudimentary implementation of a livestreaming server in go. RTMP and SRT, and fmp4 HLS.
Find a file
2024-03-13 11:34:23 +05:00
http Removed client caching, fix for old video having mismatched codecs with new 2023-09-22 12:33:31 +05:00
rtmp RTMP handshake fix, ReadFull now only reads upto C0C1 instead of waiting on full sequence 2024-03-13 11:34:23 +05:00
srt fix for fix for ignoring shotgunned induction handshake 2024-02-27 14:43:39 +05:00
static to run with custom hls-player instead of hls.js 2023-08-24 15:20:30 +05:00
transcoder Moved transcoder command creation to separate package entirely 2023-09-08 14:56:21 +05:00
go.mod ack report with correct metadata 2023-09-21 12:40:16 +05:00
main.go parse options from cmd args 2023-10-25 15:04:59 +05:00
README.md updated README 2024-02-27 14:59:33 +05:00

stream-server

Extremely basic live stream server

Currently implements a degraded subset of RTMP and SRT for ingest. Encryption for SRT is implemented with AES-CTR with hardcoded passphrase "srttestpass". Only 16-byte keys have been tested, but nothing should stop the implementation from having problems in principle

Uses the std lib http server implementation for the http serving side.

Not intended for actual use. The stream key use is not secure and is used to handle directories without a user db system, than to provide auth. Same goes for the SRT passphrase. Also just accepts connections so will get DDOS'd immediately.

Update: main branch has been tested over a network. RTMP should now work fine, SRT "works" with a few modifications. The RTT ping log-buffer slice must be extended depending on network latency (try ~2x latency/10ms, could adjust automatically, but eh). Also will inevitably crash on poor connections due to the lack of DROPSEQ handling, but will work perfectly fine during the initial 3-10s you get.

Limits to a single stream at a time, mostly for the lack of db to handle connections and user information rather than concurrency problems.

Currently always transcodes to vp9 + opus, segments to fragmented mp4. Creates one segment playlist, no manifest. Uses ffmpeg

HTTP streaming relies on hls-player-js. Will be broken for standard hls players until I figure out how to modify the EXT-X-MAP:URI field to prepend a path prefix without changing directories. Or finish the transcoder project

Currently produces no logs nor debug info. Will just abandon a connection if there is a problem. Will not send any RTMP replies since flash server docs seem dead and abort messages are netStream commands.

Ports are hard-coded into main.go. Modify if needed

Run with go run main.go. Could also build if you prefer that instead.