-2

My cam gives me jpeg with chroma sub-sampling 4:2:2, but I need 4:2:0.

  • Can I change MJPEG default chroma sub-sampling with v4l2?
Filip Roséen - refp
  • 62,493
  • 20
  • 150
  • 196
Grotrek
  • 3
  • 1
  • Question is rather clear if you know what [v4l2](http://en.wikipedia.org/wiki/Video4Linux#Version_2) is, and what [the asked chroma sub-sampling](http://en.wikipedia.org/wiki/Chroma_subsampling#4:2:0) is. Downvotes, or at least close votes are unwarranted in my opinion. – hyde Mar 03 '15 at 20:52
  • Possible source for answer/solution: http://linuxtv.org/downloads/v4l-dvb-apis/V4L2-PIX-FMT-M420.html – hyde Mar 03 '15 at 20:55
  • 1
    @Grotrek It's generally a good idea to add a piece of code to a question like this. Otherwise there will be people who don't understand the question and downvote/vote to close (and I don't really blame them). – hyde Mar 03 '15 at 20:57
  • my cam support only 2 formats: MJPEG and YUYV(YUV422). MJpeg gives my packed image with chroma sub-sampling 4:2:2 and YUV422 gives unpacked image with chroma sub-sampling 4:2:2 too. I need to convert one of them to packed jpeg image with chroma 4:2:0. Convertion from raw 422 image to 420 image and then packing it is very slow, so I wan't to change MJPEG chroma sub-sampling to 4:2:0 – Grotrek Mar 03 '15 at 21:08
  • You **have to** do : MJPEGIN -> 422 -> 420 > MJPEGOUT. – UmNyobe Mar 03 '15 at 22:51

1 Answers1

1

v4l2 itself provides a very thin layer around the actual video data that is transferred: it will simply give you the formats that the camera (the hardware!!) delivers.

so if your hardware offers two distinct formats, then there is no way that v4l2 will offer you anything else.

you might want to checkout out libv4l2 library that does some basic colorspace conversion: in general it will have conversion from most exotic hardware formats to a handful of "standard" formats, so your application does not need to support all formats any hardware manufacturer can come up with. however, it is not very likely that these standard formats include a very specific (compressed) format, like the one you need.

umläute
  • 28,885
  • 9
  • 68
  • 122