https://github.com/cs8425/ffmpeg-ws-relay
streaming video from ffmpeg by broadcasting image frames via websocket
https://github.com/cs8425/ffmpeg-ws-relay
canvas ffmpeg html5 html5-canvas video-streaming websocket
Last synced: 5 months ago
JSON representation
streaming video from ffmpeg by broadcasting image frames via websocket
- Host: GitHub
- URL: https://github.com/cs8425/ffmpeg-ws-relay
- Owner: cs8425
- License: mit
- Created: 2019-04-02T04:38:35.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-02T07:10:54.000Z (about 7 years ago)
- Last Synced: 2024-06-20T11:49:10.202Z (almost 2 years ago)
- Topics: canvas, ffmpeg, html5, html5-canvas, video-streaming, websocket
- Language: Go
- Size: 7.81 KB
- Stars: 16
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ffmpeg ws-relay
This is a simple example show up how to streaming video from ffmpeg by broadcasting image frames via websocket.
## Build
1. install go: [golang](https://golang.org/dl/)
2. clone this repo : `git clone https://github.com/cs8425/ffmpeg-ws-relay.git`
3. build: `go build -o ws-relay ws-relay.go`
4. run with ffmpeg, see [Usage example](#usage-example)
5. open browser to: [http://127.0.0.1:8080/](http://127.0.0.1:8080/)
## Usage example:
* transcode a file to websocket via png format:
* `ffmpeg -re -i v01.mp4 -c:v png -f image2pipe - | ./ws-relay -l :8080 -s png`
* transcode a file to websocket via jpg format:
* `ffmpeg -re -i v01.mp4 -s 1280x720 -c:v mjpeg -qscale:v 2 -f image2pipe - | ./ws-relay -l :8080`
* `-s 1280x720` : output size
* `-qscale:v 2` : jpeg quality, range 2~31, 31 is the worst quality