Quantcast
Channel: MediaSPIP
Viewing all articles
Browse latest Browse all 118079

Set Ratio for UDP Stream with VideoCapture in Opencv4nodejs

$
0
0

I currently try to analyse screenshots of a udp stream with opencv.

Currently I'm using a shell script with ffmpeg to generate an image and saving this to my disk with 1 fps then I read this with opencv4nodejs. But i think this is not the best pratice.

I'm using opencv4nodejs: https://github.com/justadudewhohacks/opencv4nodejs

Now I tired to use the VideoCapture function of opencv.

For debugging I currently open the stream, take a screenshot and save it to disk.

const cv = require('opencv4nodejs');
const vCap = new cv.VideoCapture('udp://239.1.1.1:6670'); let frame; class Streamer { streamTest () { frame = vCap.read(); cv.imwrite('./resources/output.png', frame); };
} module.exports = Streamer;

If I'm using the UDP stream the ration aspect is wrong and always set to 4:3 but the stream displays an 16:9 image.

I can resize the frame, but this isn't a suitable solution for this case cause I also getting 4:3 images within this stream.

How can I analyse the frames from the udp stream with right ratio?

btw. I also can't change the fps for the udp stream using

.set(cv.CAP_PROP_FPS, 1); 

This only works, if I'm using the stream of a connected webcam.

const vCap = new cv.VideoCapture(0);
-- https://github.com/justadudewhohacks/opencv4nodejs

Viewing all articles
Browse latest Browse all 118079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>