# Micro-RTSP
This is a small library which can be used to serve up RTSP streams from
resource constrained MCUs. It lets you trivially make a $10 open source
RTSP video stream camera.
# Usage
This library works for ESP32/arduino targets but also for most any posixish platform.
## Example arduino/ESP32 usage
This library will work standalone, but it is _super_ easy to use if your app is platform.io based.
Just "pio lib install Micro-RTSP" to pull the latest version from their library server. If you want to use the OV2640
camera support you'll need to be targeting the espressif32 platform in your project.
See the [example platform.io app](/examples). It should build and run on virtually any of the $10
ESP32-CAM boards (such as M5CAM). The relevant bit of the code is included below. In short:
1. Listen for a TCP connection on the RTSP port with accept()
2. When a connection comes in, create a CRtspSession and OV2640Streamer camera streamer objects.
3. While the connection remains, call session->handleRequests(0) to handle any incoming client requests.
4. Every 100ms or so call session->broadcastCurrentFrame() to send new frames to any clients.
```
void loop()
{
uint32_t msecPerFrame = 100;
static uint32_t lastimage = millis();
// If we have an active client connection, just service that until gone
// (FIXME - support multiple simultaneous clients)
if(session) {
session->handleRequests(0); // we don't use a timeout here,
// instead we send only if we have new enough frames
uint32_t now = millis();
if(now > lastimage + msecPerFrame || now < lastimage) { // handle clock rollover
session->broadcastCurrentFrame(now);
lastimage = now;
// check if we are overrunning our max frame rate
now = millis();
if(now > lastimage + msecPerFrame)
printf("warning exceeding max frame rate of %d ms\n", now - lastimage);
}
if(session->m_stopped) {
delete session;
delete streamer;
session = NULL;
streamer = NULL;
}
}
else {
client = rtspServer.accept();
if(client) {
//streamer = new SimStreamer(&client, true); // our streamer for UDP/TCP based RTP transport
streamer = new OV2640Streamer(&client, cam); // our streamer for UDP/TCP based RTP transport
session = new CRtspSession(&client, streamer); // our threads RTSP session and state
}
}
}
```
## Example posix/linux usage
There is a small standalone example [here](/test/RTSPTestServer.cpp). You can build it by following [these](/test/README.md) directions. The usage of the two key classes (CRtspSession and SimStreamer) are very similar to to the ESP32 usage.
## Supporting new camera devices
Supporting new camera devices is quite simple. See OV2640Streamer for an example and implement streamImage()
by reading a frame from your camera.
# Structure and design notes
# Issues and sending pull requests
Please report issues and send pull requests. I'll happily reply. ;-)
# Credits
The server code was initially based on a great 2013 [tutorial](https://www.medialan.de/usecase0001.html) by Medialan.
# License
Copyright 2018 S. Kevin Hester-Chow, kevinh@geeksville.com (MIT License)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
没有合适的资源?快使用搜索试试~ 我知道了~
ESP32CAM-RTSP
共63个文件
h:12个
cpp:12个
md:4个
需积分: 0 3 下载量 82 浏览量
2023-03-21
19:59:01
上传
评论
收藏 11.57MB ZIP 举报
温馨提示
整理GITHUB所需檔案
资源推荐
资源详情
资源评论
收起资源包目录
ESP32-RTSP-master.zip (63个子文件)
ESP32-RTSP-master
lib
Micro-RTSP
.library.json 918B
src
JPEGSamples.h 235B
CRtspSession.cpp 13KB
OV2640Streamer.cpp 459B
OV2640.cpp 4KB
CStreamer.cpp 12KB
CStreamer.h 2KB
platglue-esp32.h 2KB
platglue-posix.h 3KB
JPEGSamples.cpp 246KB
OV2640Streamer.h 252B
SimStreamer.h 262B
platglue.h 109B
SimStreamer.cpp 559B
OV2640.h 910B
CRtspSession.h 2KB
library.json 498B
LICENSE 1KB
examples
wifikeys_template.h 182B
ESP32-devcam.ino 5KB
platformio.ini 490B
.gitignore 32B
library.properties 290B
TODO.md 959B
test
rfccode.cpp 3KB
devvlc.sh 56B
Makefile 199B
RTSPTestServer.cpp 2KB
runvlc.sh 51B
README.md 604B
.gitignore 20B
README.md 4KB
.vscode
settings.json 53B
extensions.json 190B
3D
ESP32-CAM-Back.stl 24KB
ESP32-CAM-Front.stl 547KB
Case+Stand.PNG 30KB
ESP32-CAM-Foot.stl 106KB
ESP32-CAM-Case.f3z 1.84MB
.travis.yml 2KB
src
rtsp.cpp 3KB
ota.cpp 2KB
wifikeys.h 219B
main.cpp 3KB
main.h 739B
src.ino 37B
webstream.cpp 3KB
customparts.csv 260B
Docs
Breadboard.jpg 2.68MB
esp32-cam-development-board.jpg 175KB
ESP32-CAM.mp4 151KB
VLC-Windows-1.PNG 19KB
20200309_131750.mp4 4.84MB
ESP32-CAM.avi 366KB
ESP32-CAM.mkv 149KB
VLC-Windows.PNG 8KB
Breadboard-s.jpg 1023KB
ArduinoIDE
Micro-RTSP.zip 80KB
platformio.ini 745B
HW
ESP32-CAM-schematic.png 199KB
ESP32-CAM-Breadboard.fzz 99KB
.gitignore 94B
README.md 781B
共 63 条
- 1
资源评论
luckhy2882
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功