代码拉取完成,页面将自动刷新
Example of live video streaming over RTMP protocol using OpenCV and FFMpeg.
For streaming without using OpenCV check ffmpeg-webcam-rtmp-stream repository.
On MacOS.
brew install ffmpeg
On Ubuntu Linux.
sudo apt-get install ffmpeg libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavresample-dev libavdevice-dev -y
For installing OpenCV there's a script inside scripts/
folder:
./scripts/install-opencv.sh
docker run -it -p 1935:1935 --name rtmp-server jkuri/rtmp-server
To compile source code just run:
mkdir -p build && cd build
cmake .. && make
Run the program to start streaming:
./build/rtmp-stream
To set up different options for stream, here is ./rtmp-stream -h
output
SYNOPSIS
./rtmp-stream [-c <camera>] [-o <output>] [-f <fps>] [-w <width>] [-h <height>] [-b <bitrate>] [-p <profile>] [-l <log>]
OPTIONS
-c, --camera <camera>
camera ID (default: 0)
-o, --output <output>
output RTMP server (default: rtmp://localhost/live/stream)
-f, --fps <fps>
frames-per-second (default: 30)
-w, --width <width>
video width (default: 800)
-h, --height <height>
video height (default: 640)
-b, --bitrate <bitrate>
stream bitrate in kb/s (default: 300000)
-p, --profile <profile>
H264 codec profile (baseline | high | high10 | high422 | high444 | main) (default: high444)
-l, --log <log>
print debug output (default: false)
Use VLC or ffplay
to connect to live video stream:
ffplay -sync ext rtmp://localhost/live/stream
If everything worked you should see live-stream video.
MIT
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。