vasu gupta
vasu gupta

Reputation: 61

how to use a video stream as input in python/opencv programme

I am able to stream and receive webcam feed in two terminal via udp

command for streaming:

ffmpeg -i /dev/video0 -b 50k -r 20 -s 858x500 -f mpegts udp://127.0.0.1:2000  

command for recieving:

ffplay  udp://127.0.0.1:2000 

Now i have to use this received video stream as input in python/opencv how can i do that. I will be doing this using rtp and rstp as well. But in case of rtsp it is essential to initiate the receiving terminal, but if I do that then port will become busy and my program will not be able to take the feed.How could it be resolved. I am currently using opencv 2.4.13, python 2.7 in ubuntu 14.04

Upvotes: 0

Views: 5427

Answers (1)

Mohamed Moanis
Mohamed Moanis

Reputation: 507

Check this tutorial, and use cv2.VideoCapture("udp://127.0.0.1:2000"). You will need to build opencv with FFmpeg so that it works.

Upvotes: 1

Related Questions