将 esp-32 摄像头流式传输到 YouTube 等 RTMP 服务器 [英] Stream esp-32 camera to RTMP server like YouTube

查看:155
本文介绍了将 esp-32 摄像头流式传输到 YouTube 等 RTMP 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一个需要使用相机流的项目.在多次命中和跟踪和谷歌搜索之后,我什至没有接近将 ESP-32 相机流直接流式传输到我自己的 RMTP 服务器的解决方案.

已经尝试过的解决方案:

1) 我尝试过使用 Raspberry pi 重新流式传输 ESP-32-cam,效果很好,但不是我正在寻找的{丢弃,因为不想使用 Raspberrypi 进行重新流式传输}

2) ESP-32-cam:使用时间触发器进行记录和 FTP 传输(未尝试但认为这不是一个好方法).{被丢弃,因为它不是实时的}

3)

我已经尝试过了,它运行良好,但不适用于涉及流式传输到 RTMP 服务器而无需重新流式传输的用例.

**

<块引用>

我想实现ESP-32 CAM可以直接post/stream到RTMP云托管服务器,从技术上讲似乎是可能的,因为ESP-32 cam 支持连接 wifi 和访问云端服务器

**

在谷歌上,我发现了一个类似的帖子:https://forum.arduino.cc/index.php?topic=634605.0 提供解决方案的人没有兴趣分享.

可能需要在下面的代码中进行一些修改可以参考:https://github.com/espressif/esp32-camera

解决方案

您应该阅读(并理解)您发布的链接.
有两个选项.一个由 rtsp 库使用,其中 Arduino 充当 rtsp 服务器,因此像 vlc 这样的程序可以解码桌面上的流.
或者 BnBe 解决方案,其中 Esp32cam 作为客户端,youtube 等服务器可以接收流并对其进行解码.
ESP 在这种情况下通过 AP 连接到互联网.浏览器组件可用于对其进行配置.
恕我直言,在客户端服务器场景中没有第三种解决方案(一个充当客户端,另一个充当服务器).仔细阅读BnBe解决方案的代码.如果你想对你的配置进行硬编码 - 简单可行.
您的评论qoute:用例涉及流式传输到RTMP服务器而不重新流式传输"抱歉,至少在我拥有的代码中我看不到这种情况
您的意思是perhabs是作者从cam(方法esp_camera_fb_get()) 这不是重新流式传输",这是由于 espressif 的闭源是访问准备好的相机流的唯一方法.如果您不喜欢这样,则必须投资其他硬件.
您使用图形编辑了您的问题.这就是 BnBe 解决方案的作用!所以没有重新流式传输.
OP 想将 espressif 函数 esp_camera_fb_get() 的结果直接发送到 rtmp 云服务.这在技术上是不可能的,因为 API 只允许获取编码为 mpeg 的帧缓冲区(基本上是单个 jpg 粘在一起).因此,您必须将帧缓冲区转换为有效的 rtmp 流.即使您查看 OV2640 的数据表,您也会看到源代码已关闭,并且只能通过 API 访问固件.因此,除了逆向工程之外,没有任何可能性.
使用 BnBe 解决方案,它可以工作并为您节省 1/2 年的开发时间,如果您是一名优秀的编码员,您可以改进它,但忘记了多个流 ESP32 CPU 大麦处理一个!
->特别查看CRtspSession.h和CRtspSession.cpp以及OV2640.h和OV2640.cpp的代码(里面有cam模块的所有API函数)

I am doing research for a project in which I need to play with camera streams. After multiple hit and trails and googling I am not getting even close to the solution for streaming ESP-32 Camera stream to my own RMTP server directly.

Already tried solutions:

1) I have tried re-streaming of ESP-32-cam with Raspberry pi, that works well but not something I am looking for {discarded because do not want to use Raspberrypi for restreaming purposes}

2) ESP-32-cam: Record and FTP transfer with time triggers (Not tried but believed that it is not a good approach). {discarded because it is not realtime}

3) ESP32 Try to send image file to php with HTTPClient I have tried but it works for images only and secondly the code is executed in loop function so ther is a long delay due to saving and posting operations.

Please note: I am not looking at the solution in which ESP-32 cam acts as stream server and browser can connect to it like : https://www.hackster.io/BnBe_Club/9-rtsp-video-streamer-using-the-esp32-cam-board-8832b4

I have already tried it and it works well but not for the usecase which involves streaming to RTMP server without restreaming.

**

I want to achieve ESP-32 CAM can post / stream directly to the RTMP cloud hosted server, technically it seems to be possible because ESP-32 cam has support for connecting to wifi and access the cloud server

**

On google, I found a similar thread : https://forum.arduino.cc/index.php?topic=634605.0 The guy with solution is not interested in sharing it.

may be some modification required in below code MAY BE ref: https://github.com/espressif/esp32-camera

解决方案

You should read (and understand) your posted links.
There are two options. One is used by the rtsp library where the Arduino acts as rtsp server so programs like vlc can decode the stream on the desktop.
Or the BnBe solution where the Esp32cam acts as client and servers like youtube can receive the stream and decode it.
The ESP is in this scenario via AP connected to the internet. The browser component may be used to configure it.
Imho there is no third solution in a client server scenario (One acts as client the other is server). Read the code of the BnBe solution carefully. If you want to hardcode your config - easy doable.
Your remark qoute: "usecase which involves streaming to RTMP server without restreaming" sorry I cannot see that happening at least in the code I have
What you mean perhabs is that the authors get the stream from the cam (method esp_camera_fb_get()) thats not "restreaming" thats due to the closed source by espressif the only way to access the prepared camera stream. If you do not like this you have to invest into other hardware.
You edited your question with the graphic. This is what the BnBe solution does! So NO restreaming.
The OP wants to send the result of the espressif function esp_camera_fb_get() directly to the rtmp cloud service. This is technically not possible, because the API only gives access to grab a frame buffer encoded as mpeg (bassically single jpgs glued together). So you have to have your frame buffer converted to a valid rtmp stream. Even if you look into the datasheet of the OV2640 you will see the source is closed and only API access to the firmware is possible. So except for reverse engeniering there is no possibility.
Use the BnBe solution, it works and saves you 1/2 year of development you can improve it if you are a good coder but forget about muliple streams The ESP32 CPU barley handles one!
-> look especially into the code of CRtspSession.h and CRtspSession.cpp as well as OV2640.h and OV2640.cpp (there you'll find all API functions of the cam module)

这篇关于将 esp-32 摄像头流式传输到 YouTube 等 RTMP 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆