Search code examples
node.jsopencvudph.264video-capture

Cant read UDP network stream in h264 from opencv4nodejs


i'm trying to get a video stream from a djy drone 'Tello' with nodejs. the UDP server is working because i can manually get the stream and show it on my mac with "ffplay udp://198.168.10.1:11111".

Anyway i cant make opencv4nodejs (porting of opencv) working while making const capture = new VideoCapture('udp://192.168.10.1:11111', cv.CAP_FFMPEG).

Construction of object 'capture' fails with this message: 'OpenCV: Couldn't read video stream from file "udp://192.168.10.1:11111"'

P.S: if I use const capture = new VideCapture(0), etc.. it does successfully construct everything using my Mac camera.

Any help would be great, thank you!


Solution

  • Solution: The issue was installing opencv4nodejs without having ffmpeg installed BEFORE. So i run again npm install and rebuild opencv that was now aware of FFMPEG and everything worked as was supposed to do. I can read from udp stream and forward video as i want to my front end