node-v4l2camera icon indicating copy to clipboard operation
node-v4l2camera copied to clipboard

Data from device might not be in YUYV format

Open kolmodin opened this issue 10 years ago • 2 comments

The toYUYV() and toRGB() functions assume that the data from the device is in YUYV.

Webcams may give data in other formats too, like MPEG or H264.

Currently there is no way to get the "raw" data from the frame, using toYUYV on a MPEG frame returns garbage (i.e. the mpeg data padded with zeros to fill a whole "YUYV frame").

kolmodin avatar Apr 28 '14 06:04 kolmodin

I had the same question, my camera is MPEG, then my result is wrong. 1421023755072

rafaneri avatar Jan 12 '15 00:01 rafaneri

Added cam.frameRaw() to get raw frame data at ad1b1c94468e21c65ea49633325d935c665b3d1f . (It is published at 1.0.0 for node-4)

When MJPG format camera used, the returned data(as Uint8Array) is just JPEG compressed data. (Sorry I don't know how to handle MPEG frames, required more info for programming with MPEG)

bellbind avatar Oct 09 '15 13:10 bellbind