Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jkuri/opencv-ffmpeg-rtmp-stream
OpenCV FFMpeg Live Video Stream over RTMP protocol.
https://github.com/jkuri/opencv-ffmpeg-rtmp-stream
Last synced: 1 day ago
JSON representation
OpenCV FFMpeg Live Video Stream over RTMP protocol.
- Host: GitHub
- URL: https://github.com/jkuri/opencv-ffmpeg-rtmp-stream
- Owner: jkuri
- License: mit
- Created: 2018-01-29T23:37:35.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-18T09:44:37.000Z (about 2 years ago)
- Last Synced: 2024-10-26T03:37:32.276Z (16 days ago)
- Language: C++
- Size: 50.8 KB
- Stars: 211
- Watchers: 12
- Forks: 59
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenCV FFMpeg RTMP Stream
Example of live video streaming over RTMP protocol using OpenCV and FFMpeg.
For streaming without using OpenCV check [ffmpeg-webcam-rtmp-stream](https://github.com/jkuri/ffmpeg-webcam-rtmp-stream) repository.
### Installation Guide
#### Install FFMpeg
On MacOS.
```sh
brew install ffmpeg
```On Ubuntu Linux.
```sh
sudo apt-get install ffmpeg libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavresample-dev libavdevice-dev -y
```#### Install OpenCV
For installing OpenCV there's a script inside `scripts/` folder:
```sh
./scripts/install-opencv.sh
```#### Run RTMP Server Docker image
```sh
docker run -it -p 1935:1935 -p 8080:8080 --name rtmp-server jkuri/urtmp
```Then open your browser at `http://localhost:8080` where you can watch your published streams.
### Compile & run
To compile source code just run:
```sh
mkdir -p build && cd build
cmake .. && make
```Run the program to start streaming:
```sh
./build/rtmp-stream
```To set up different options for stream, here is `./rtmp-stream -h` output
```sh
SYNOPSIS
./rtmp-stream [-c ] [-o ] [-f ] [-w ] [-h ] [-b ] [-p ] [-l ]OPTIONS
-c, --camera
camera ID (default: 0)-o, --output
output RTMP server (default: rtmp://localhost/live/stream)-f, --fps
frames-per-second (default: 30)-w, --width
video width (default: 800)-h, --height
video height (default: 640)-b, --bitrate
stream bitrate in kb/s (default: 300000)-p, --profile
H264 codec profile (baseline | high | high10 | high422 | high444 | main) (default: high444)-l, --log
print debug output (default: false)
```Use VLC or `ffplay` to connect to live video stream:
```sh
ffplay -sync ext rtmp://localhost/live/stream
```### LICENCE
MIT