node-v4l2camera
node-v4l2camera copied to clipboard
Data from device might not be in YUYV format
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").
I had the same question, my camera is MPEG, then my result is wrong.
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)