elsampsa / valkka-core

Valkka - Create video surveillance, management and analysis programs with PyQt
GNU Lesser General Public License v3.0
186 stars 35 forks source link

Any plans on supporting RTMP #19

Closed ogencoglu closed 3 years ago

ogencoglu commented 3 years ago

Moi,

Thanks for this work. Not necessarily an issue but is there any plans to support RTMP protocol? Or any pointers to libraries with similar functionalities in python for RTMP?

elsampsa commented 3 years ago

Not that familiar with RTMP. You wan't to stream to a web-browser? This was very recently added to libValkka and it works like a charm: sending fragmented-mp4 via websockets to a browser & everything can be orchestrated from python (updating the docs with more multiprocessing examples in the coming days). If you want to convince me about RTMP, please tell me some use cases & why it is important.

ogencoglu commented 3 years ago

Thank you for the swift reply. I am not familiar with neither RTMP or RTSP and I do not need streaming to a web-browser or GUIs but just streaming and management from multiple cameras that has connection formats of rtmp://your.server.net/app . Basically, some scalable way to retrieve frames into numpy arrays. Then we will plug our custom object detection, tracking models for various tasks. I guess this is a bit side-track for this project.

elsampsa commented 3 years ago

One could maybe include this one into libValkka: http://rtmpdump.mplayerhq.hu/librtmp.3.html and subclass a new thread therein "RTMPThread", etc. Your contribution is wellcome. :)

A quick'n'dirty solution might be using this: https://pythonhosted.org/python-librtmp/, then putting it into python multiprocess & then chain it's output to another multiprocess that is running ffmpeg.

Another quick (but slightly less dirty) solution would be to create two asyncio tasks: one using that python library to read the packets & putting the into asyncio.Queue and another asyncio task reading that queue and feeding them to ffmpeg.

Good luck! :)

eranpet commented 3 years ago

If you want to contract dasys for consulting, please contact me at support@dasys.fi

ogencoglu commented 3 years ago

Cheers! I will close this for now.