user3705497
user3705497

Reputation: 63

How to capture video from UDP using openvino's opencv

Setup

OpenVINO 2021.2 
Python 3.7
Windows 10

Problem

I can do face detection from video file (webm) and laptop camera (0) but not from a UDP stream.

import cv2
cap = cv2.VideoCapture('udp://0.0.0.0:12345')

Error Message:

MFX: Unsupported extension: udp://0.0.0.0:12345

Does anyone know how to fix this? e.g. manual compilation steps of opencv or other methods.

Upvotes: 1

Views: 971

Answers (1)

CopyrightC
CopyrightC

Reputation: 863

The problem is in this line :

cap = cv2.VideoCapture('udp://0.0.0.0:12345')

You need to add a @ symbol here. It means listen to address.

It should look like :

import cv2
cap = cv2.VideoCapture('udp://@0.0.0.0:12345') #Notice the @

Upvotes: 2

Related Questions