Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreanobile/opencv_ffmpeg_streaming
rtmp streaming from opencv with ffmpeg / avcodec using C++ or Python
https://github.com/andreanobile/opencv_ffmpeg_streaming
avcodec ffmpeg h264 h265 opencv opencv-ffmpeg-streaming python rtmp rtmp-stream streaming video-streaming
Last synced: about 1 month ago
JSON representation
rtmp streaming from opencv with ffmpeg / avcodec using C++ or Python
- Host: GitHub
- URL: https://github.com/andreanobile/opencv_ffmpeg_streaming
- Owner: andreanobile
- License: mit
- Created: 2018-10-25T20:31:40.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-11T19:16:55.000Z (over 1 year ago)
- Last Synced: 2024-06-24T01:39:42.703Z (3 months ago)
- Topics: avcodec, ffmpeg, h264, h265, opencv, opencv-ffmpeg-streaming, python, rtmp, rtmp-stream, streaming, video-streaming
- Language: C++
- Homepage:
- Size: 68.4 KB
- Stars: 161
- Watchers: 6
- Forks: 43
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# opencv_ffmpeg_streaming
rtmp streaming from opencv with ffmpeg / avcodecUsing ffmpeg libraries from C/C++ is tricky and I could not easily find easy examples without memory leaks or bad crashes that used OpenCV as input or for image processing.
This is an example for using the ffmpeg and opencv libraries from C++ for rtmp streaming.
The input is from the OpenCV VideoCapture class.
To build Release:
```
$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make
```To build Debug:
```
$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ make
```
In main.cpp the stream url is defined as "rtmp://localhost/live/mystream" and must be adapted to your rtmp server settingsRun the program on a video:
```
$ ./build/simple_opencv_streaming
```
From camera
```
$ ./build/simple_opencv_streaming 0
```To convert the rtmp stream to HLS and publish the stream to a browser I have written a tutorial on a blog post