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

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

问题描述

我正在为一个需要使用相机流播放的项目进行研究.在经历了多次碰撞和跟踪之后,我还没有接近直接将ESP-32 Camera流流传输到我自己的RMTP服务器的解决方案.

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)我尝试用Raspberry pi对ESP-32-cam进行重新流传输,效果很好,但不是我想要的东西{已舍弃,因为不想使用Raspberrypi进行流传输}

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:带时间触发器的记录和FTP传输(未尝试过,但认为这不是一个好方法). {由于不实时而被丢弃

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尝试发送图像我已经尝试过使用HTTPClient将文件归档到php ,但是它仅适用于图像,其次,代码是在循环函数中执行的,因此由于保存和发布操作而导致了较长的延迟.

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.

请注意:我不是在考虑将ESP-32 cam用作流服务器,浏览器可以像这样连接的解决方案:

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

我已经尝试过了,并且效果很好,但不适用于涉及不重新流式传输到RTMP服务器的用例.

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

**

我要实现ESP-32 CAM可以直接将其发布/流式传输到RTMP 云托管服务器,从技术上讲这似乎是可能的,因为 ESP-32 cam支持连接到wifi并访问云 服务器

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

**

在Google上,我发现了一个类似的线程: https://forum.arduino. cc/index.php?topic = 634605.0 有解决方案的人对共享它不感兴趣.

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.

可能是下面的代码中可能需要的一些修改: https://github.com/espressif /esp32-camera

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

推荐答案

您应该阅读(并理解)已发布的链接.
有两个选项. rtsp库使用了一种,其中Arduino充当rtsp服务器,因此vlc之类的程序可以在桌面上解码流.
或以Esp32cam作为客户端和youtube等服务器的BnBe解决方案,可以接收流并对其进行解码.
在这种情况下,ESP通过连接到互联网的AP进行.可以使用浏览器组件对其进行配置.
在客户端服务器方案中,没有第三种解决方案(一个充当客户端,另一个充当服务器).仔细阅读BnBe解决方案的代码.如果您想对您的配置进行硬编码-容易做到.
您的评论qoute:涉及不流式传输到RTMP服务器的流的用例"很抱歉,我至少看不到在我所拥有的代码中发生的情况.
您的意思是,作者从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函数)

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天全站免登陆