WebRTC-Broadcast-Recording
所属分类:流媒体/Mpeg4/MP4
开发工具:GO
文件大小:34KB
下载次数:0
上传日期:2021-02-02 11:24:59
上 传 者:
sh-1993
说明: 以服务器为中心的WebRTC示例支持视频录制
(Server-centered WebRTC example supports video recoding)
文件列表:
Dockerfile (370, 2021-02-02)
bin (0, 2021-02-02)
certs (0, 2021-02-02)
docker-compose.yaml (239, 2021-02-02)
pkg (0, 2021-02-02)
src (0, 2021-02-02)
src\github.com (0, 2021-02-02)
src\github.com\bic4907 (0, 2021-02-02)
src\github.com\bic4907\webrtc (0, 2021-02-02)
src\github.com\bic4907\webrtc\common (0, 2021-02-02)
src\github.com\bic4907\webrtc\common\chunk.go (192, 2021-02-02)
src\github.com\bic4907\webrtc\go.mod (257, 2021-02-02)
src\github.com\bic4907\webrtc\go.sum (31994, 2021-02-02)
src\github.com\bic4907\webrtc\main.go (290, 2021-02-02)
src\github.com\bic4907\webrtc\videos (0, 2021-02-02)
src\github.com\bic4907\webrtc\web (0, 2021-02-02)
src\github.com\bic4907\webrtc\web\hub.go (4962, 2021-02-02)
src\github.com\bic4907\webrtc\web\service.go (5273, 2021-02-02)
src\github.com\bic4907\webrtc\web\src (0, 2021-02-02)
src\github.com\bic4907\webrtc\web\src\index.html (2234, 2021-02-02)
src\github.com\bic4907\webrtc\web\src\static (0, 2021-02-02)
src\github.com\bic4907\webrtc\web\src\static\script.js (12704, 2021-02-02)
src\github.com\bic4907\webrtc\web\src\static\style.css (1068, 2021-02-02)
src\github.com\bic4907\webrtc\web\util.go (165, 2021-02-02)
src\github.com\bic4907\webrtc\wrtc (0, 2021-02-02)
src\github.com\bic4907\webrtc\wrtc\broadcaster.go (3981, 2021-02-02)
src\github.com\bic4907\webrtc\wrtc\recorder.go (3719, 2021-02-02)
src\github.com\bic4907\webrtc\wrtc\subscriber.go (2456, 2021-02-02)
src\github.com\bic4907\webrtc\wrtc\util.go (546, 2021-02-02)
# WebRTC Broadcasting Recording
This repository is not a peer-to-peer example. The server totally cares signaling and broadcasting
## Features
- Multiple Broadcaster, multiple subscribers architecture (1:N SFU)
- Subscribers listen events `Broadcaster Connected`, `Broadcaster Disconnected`
- Recording Broadcaster's Tracks as `.mp4` using ffmpeg
- Go-lang SFU server, web-based demostration client
- Signaling (Offer, Answer) using gorilla websocket
## How To Run
### Dockerfile
You need to install Docker (Windows, Linux, MacOS) on your computer.
```
cd WebRTC-Broadcast-Recording
docker-compose up
```
You also change exposed port using docker-compose's port-forwarding option.
Our Dockerfile will automatically install go-lang and FFmpeg on docker image.
### Go compiling
If you didn't install FFmpeg, you need to install your own version of FFmpeg binaries.
On your command line, `ffmpeg` command should be available. FFmpeg is needed to record your video and audio track as a MPEG4 media file.
```
cd src/github.com/bic4907/webrtc
go run main.go
```
## Architecture
Our repository is Server (Go)-Client (Javascript) architecture.
WIP
### Hub Events
Some events regarding broadcasting service. Please check out [hub.go](https://github.com/src/github.com/bic4907/webrtc/web/hub.go) source code.
```Register```
A broadcaster event when a broadcaster joined to the server. The broadcaster offers to begin audio/video track and negotiate with server. When broadcaster begin to send RTC packet, `BroadcastBroadcasterEntered` method will be executed. This method will notify to users that already connected to server via a websocket event. Then, clients and server will re-negotiate to make new media track.
When the broadcaster starts to send RTC packets, the server will record video/audio using ffmpeg.
```Unregister```
A broadcaster event when a broadcaster exited from the server. This event will execute `BroadcastBroadcasterExited` method, and the server will make user to remove tracks from player.
```Subscribe```
A subscriber event when a receiver joined to the server. The hub will find whether the broadcaster is existing and offer video/audio tracks to user via websocket. If the broadcaster not joined yet, the server do not anything and the user will be wait for the broadcaster join.
```Unsubscribe```
A subscriber event when a receiver exited from the server. The hub will remove user from a room's user list.
```Broadcast```
A broadcaster event when a broadcaster sends a RTC packet. The hub publishes this packet to the users where the broadcaster have opened.
## Author
- [In-chang Baek](https://github.comhttps://github.com/bic4907)
### Special thanks
- [JooYoung Lim](https://github.comhttps://github.com/DevRockstarZ)
## References
- [pion/webrtc](https://github.comhttps://github.com/pion/webrtc)
- [pion/example-webrtc-applications](https://github.comhttps://github.com/pion/example-webrtc-applications)
- [gorilla/websocket](https://github.comhttps://github.com/gorilla/websocket)
Those are most useful materials for you understanding webrtc sigaling paradism.
Keep in your mind that websocket communication is just one of lots of signaling methods.
近期下载者:
相关文件:
收藏者: