GithubHelp home page GithubHelp logo

azhaocn / live777 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from binbat/live777

0.0 0.0 0.0 805 KB

A very simple, high performance, edge WebRTC SFU

Home Page: https://live777.binbat.com

License: Mozilla Public License 2.0

JavaScript 25.28% Rust 65.48% HTML 9.24%

live777's Introduction

Live777
Live777

Rust GitHub release

   

Live777 is an SFU server for real-time video streaming for the WHIP/WHEP as first protocol.

Live777 media server is used with Gstreamer, FFmpeg, OBS Studio, VLC, WebRTC and other clients to provide the ability to receive and distribute streams, and is a typical publishing (pushing) and subscription (playing) server model.

Live777 supports the conversion of audio and video protocols widely used in the Internet, such as RTP to WHIP or WHEP and other protocols.

live777-arch live777-arch

Features

Live777 has the following characteristics:

  • 📚 Support WHIP/WHEP

    The WHIP/WHEP protocol is implemented to improve interoperability with other WebRTC application modules without the need for custom adaptations.

  • 🗃️ SFU architecture

    Only responsible for forwarding, do not do confluence, transcoding and other resource overhead of the media processing work, the encoding and decoding work are respectively placed on the sender and the receiver.

  • 🌐 Multiple platform support

    With rich multi-platform native support.

  • 🔍 Multiple audio and video encoding formats support

    Support a variety of video encoding and audio encoding formats, providing a wider range of compatibility to help enable adaptive streaming.

DataChannel Forward

NOTE: About createDataChannel()

  1. Live777 Don't support label, createDataChannel(label) this label is not used
  2. Live777 Don't support negotiated, { id: 42, negotiated: true } this don't support

live777-datachannel

Current support encode

protocol video codecs audio codecs
WHIP AV1, VP9, VP8, H264 Opus, G722
WHEP AV1, VP9, VP8, H264 Opus, G722

Quickstart

Run Live777 using docker:

docker run --name live777-server --rm --network host ghcr.io/binbat/live777-server:latest live777

Open your browser, enter the URL: http://localhost:7777/

Gstreamer WHIP/WHEP client

This WHIP/ WHEP plugins from gst-plugins-rs

You can use this docker images of Gstreamer

Video: AV1

WHIP:

docker run --name live777-client-whip --rm --network host \
ghcr.io/binbat/live777-client:latest \
gst-launch-1.0 videotestsrc ! av1enc usage-profile=realtime ! av1parse ! rtpav1pay ! whipsink whip-endpoint="http://localhost:7777/whip/777"

WHEP:

I don't know why av1 and whep error

But, you can:

cargo run --package=whepfrom -- -c av1 -u http://localhost:7777/whep/777 -t 127.0.0.1:5004
docker run --name live777-client-whep --rm --network host \
ghcr.io/binbat/live777-client:latest \
gst-launch-1.0 udpsrc port=5004 caps="application/x-rtp, media=(string)video, encoding-name=(string)AV1" ! rtpjitterbuffer ! rtpav1depay ! av1parse ! av1dec ! videoconvert ! aasink

Video: VP8

WHIP:

docker run --name live777-client-whip --rm --network host \
ghcr.io/binbat/live777-client:latest \
gst-launch-1.0 videotestsrc ! videoconvert ! vp8enc ! rtpvp8pay ! whipsink whip-endpoint="http://localhost:7777/whip/777"

WHEP:

docker run --name live777-client-whep --rm --network host \
ghcr.io/binbat/live777-client:latest \
gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=96,encoding-name=VP8,media=video,clock-rate=90000" ! rtpvp8depay ! vp8dec ! videoconvert ! aasink

Video: VP9

WHIP:

docker run --name live777-client --rm --network host \
ghcr.io/binbat/live777-client:latest \
gst-launch-1.0 videotestsrc ! videoconvert ! vp9enc ! rtpvp9pay ! whipsink whip-endpoint="http://localhost:7777/whip/777"

WHEP:

docker run --name live777-client-whep --rm --network host \
ghcr.io/binbat/live777-client:latest \
gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=98,encoding-name=VP9,media=video,clock-rate=90000" ! rtpvp9depay ! vp9dec ! videoconvert ! aasink

Video: H264

WHIP:

docker run --name live777-client --rm --network host \
ghcr.io/binbat/live777-client:latest \
gst-launch-1.0 videotestsrc ! videoconvert ! x264enc ! rtph264pay ! whipsink whip-endpoint="http://localhost:7777/whip/777"

WHEP:

docker run --name live777-client-whep --rm --network host \
ghcr.io/binbat/live777-client:latest \
gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264,media=video,clock-rate=90000" ! rtph264depay ! decodebin ! videoconvert ! aasink

Use libav

docker run --name live777-client-whep --rm --network host \
ghcr.io/binbat/live777-client:latest \
gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264 media=video,clock-rate=90000" ! rtph264depay ! avdec_h264 ! videoconvert ! aasink

Audio: Opus

WHIP:

docker run --name live777-client --rm --network host \
ghcr.io/binbat/live777-client:latest \
gst-launch-1.0 audiotestsrc ! audioconvert ! opusenc ! rtpopuspay ! whipsink whip-endpoint="http://localhost:7777/whip/777"

WHEP:

gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264,media=video,clock-rate=90000" ! rtpopusdepay ! opusdec ! audioconvert ! autoaudiosink

Maybe you can't play audio, we can audio to video display for ascii

gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264,media=video,clock-rate=90000" ! rtpopusdepay ! opusdec ! audioconvert ! wavescope ! videoconvert ! aasink

Audio: G722

GStreamer G722 need avenc_g722 in gstreamer-libav

docker run --name live777-client --rm --network host \
ghcr.io/binbat/live777-client:latest \
gst-launch-1.0 audiotestsrc ! audioconvert ! avenc_g722 ! rtpg722pay ! whipsink whip-endpoint="http://localhost:7777/whip/777

OBS Studio WHIP client

Note:

  1. OBS Studio version 30 or higher
  2. OBS WHIP Current only support H264 video codecs and Opus audio codecs

obs whip

Play stream

Tools

We have tools for support rtp -> whip/whep convert

live777-apps live777-apps

For Example:

ffmpeg -> whipinto -> live777 -> whepfrom -> ffplay
Application AV1 VP9 VP8 H264 OPUS G722
Browser whip
Browser whep
Gstreamer whip 📺 1
Gstreamer whep 📺 2
Gstreamer rtp-into 📺 1
Gstreamer rtp-from 📺 2
FFmpeg rtp-into 💩
FFmpeg rtp-from 💩
VLC rtp-into 💡 💡 💡
VLC rtp-from 💡 💡 💡
OBS Studio whip 📺 3 💩 💩 💩
  • ⭐ It's working
  • 💩 Don't support
  • 💡 I don't know, No testing
  • 📺 Note have some problem
    1. Working, But Browser can't player this video
    2. I don't know why av1 and whep error
    3. AV1 is now available, But not released

whipinto

This tool is rtp2whip

Build

cargo build --package=whipinto --release
whipinto -c vp8 -u http://localhost:7777/whip/777 --port 5003

Video Test Src

ffmpeg -re -f lavfi -i testsrc=size=640x480:rate=30 -vcodec libvpx -f rtp 'rtp://127.0.0.1:5003?pkt_size=1200'

So. We support parameter command, You can use this:

cargo run --package=whipinto -- -c vp8 -u http://localhost:7777/whip/777 --command \
"ffmpeg -re -f lavfi -i testsrc=size=640x480:rate=30 -vcodec libvpx -cpu-used 5 -deadline 1 -g 10 -error-resilient 1 -auto-alt-ref 1 -f rtp 'rtp://127.0.0.1:{port}?pkt_size=1200'"

VLC RTP stream

Note: VLC can't support all video codec

vlc -vvv <INPUT_FILE> --sout '#transcode{vcodec=h264}:rtp{dst=127.0.0.1,port=5003}'

whepfrom

This tool is whep2rtp

Build

cargo build --package=whepfrom --release

Use WHEP protocol pull stream convert rtp sender

whepfrom -c vp8 -u http://localhost:7777/whep/777 -t localhost:5004

For ffplay. You Need a sdp file

cat > stream.sdp << EOF
v=0
m=video 5004 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 VP8/90000
EOF

Use ffplay

ffplay -protocol_whitelist rtp,file,udp -i stream.sdp

So. You can use this

cargo run --package=whepfrom -- -c vp8 -u http://localhost:7777/whep/777 -t 127.0.0.1:5004 --command 'ffplay -protocol_whitelist rtp,file,udp -i stream.sdp'

Use VLC player

vlc stream.sdp

Sponsors

Xi'an Electrical Science and Technology University logo.
JetBrains Logo (Main) logo.
Hostker logo.

live777's People

Contributors

hongcha98 avatar a-wing avatar fastfeee avatar marsyew avatar cooperhash avatar dfasdfasddf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.