Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get videoStream from RTMP to opencv

I'm developing a python program to receive a live streaming video from android device via RTMP. I created a server and also I'm capable of transmitting a videoStream from android device. But the problem is I can't access that stream in opencv. Can anyone tell me a way to access it via opencv. It is better if you can post any python code snippets.

like image 781
Vajira Prabuddhaka Avatar asked Sep 01 '17 05:09

Vajira Prabuddhaka


People also ask

How do I view RTMP streams?

Video Test PlayersEnter your server IP address in Server, the application name in Application, and the streaming asset in Stream. Then click the tab for the stream format you want to use and click Start to play the asset.

Can OBS receive RTMP stream?

Live Streaming Using RTMP with OBSTo use OBS to stream to Accelevents simply select Accelevents as the Stream Provider and then select the RTMP option.


1 Answers

Just open the address instead of your cam :

myrtmp_addr = "rtmp://myip:1935/myapp/mystream" cap = cv2.VideoCapture(myrtmp_addr) frame,err = cap.read()

From there you can handle your frames like when you get it from your cam. if it still doesn't work, check if you have a valid version of ffmpeg linked with your opencv. You can check it with print(cv2.getBuildInformation())

Hope I could help

like image 189
Martin Faucheux Avatar answered Oct 31 '22 12:10

Martin Faucheux