Difference between MJPG and YUV formats?
12 views (last 30 days)
Show older comments
Hi all! I would like to know the difference between MJPG and YUV formats and also which one would be better if I am using stereoscopic vision to detect colored markers of Red,Green and Blue?
0 Comments
Accepted Answer
Dima Lisin
on 22 Jul 2014
These are two different things. MJPG is a video compression format, YUV is a color space.
0 Comments
More Answers (1)
Federico C.
ongeveer 7 uur ago
I think the OP was asking about the difference between MPJEG and YUV - to be understood as yuyv422 or other similar "raw" format - when retrieving video-frames from a digital camera (for instance a webcam):
- yuyv422 provides access to the "raw" pixel data from the camera (well not exactly because in the yuyv422 format, the U and V channels have both been subsampled wrt the Y luminance channel, meaing you get 8 values every 4 pixels, or 2 values per pixel - instead of 3 had there been so subsampling)
- mjpeg on the other hand provides access to compressed video frames
For instance, when using linux, one can use the following commands to discover the announced capabilities from a v4l2 compatible video source:
$ ffmpeg -f video4linux2 -list_formats all -i /dev/video0
[...]
[video4linux2,v4l2 @ 0x1fb7660] Raw : yuyv422 : YUV 4:2:2 (YUYV) : 640x480 160x120 176x144 320x176 320x240 352x288 432x240 544x288 640x360
[video4linux2,v4l2 @ 0x1fb7660] Compressed: mjpeg : MJPEG : 640x480 160x120 176x144 320x176 320x240 352x288 432x240 544x288 640x360
Sometimes, the full resolution is not available as yuyv422 because it would take up too much bandwidth and so only mjpeg output is available for a given resolution and framerate.
For instance, a yuyv422 video stream at 640x480 res, with 8bit/pixel and 30fps will consume 640*480*30*8*2 = 147456 kbit/s
... but for 1920*1080 res, it would require 995328 kbit/s ... which is not compatible with USB2.0 bandwith and so only an MJPEG output might be available at this resolution and framerate.
0 Comments
See Also
Categories
Find more on MATLAB Support Package for IP Cameras in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!