Extract luma, chroma info from video?

Peter Maersk-Moller pmaersk at gmail.com
Tue Jun 24 12:06:52 PDT 2014


Hi Jordan.

If you output video in the I420 format (or another YUV format) using
GStreamer, you can use

    gst-launch ....... ! fdsink fd=3 3>&1 1>&2 | SomeProgram

then you now (given the geometry WxH) for each frame have the first W*H
bytes are the luminance pixel by pixel and line by line. Then the next W/2
* H/2 = W*H/4 bytes are the Hue bytes and the next W*H/4 bytes are the
saturation or pehaps you have to interchange Hue and Saturation.

Anyway each Hue byte covers 4 pixels in the I420 format and the same
applies for the Saturation.

The first Hue byte covers pixel the four pixels row-0,col-0 and row-0,col-1
and row-1,col-0 and row-1,col-1 etc.

If that is too difficult, you can select I444 format, where you have W*H
bytes for Y (Luminance) and then W*H bytes for U and W*H bytes for V.

Your program "SomeProgram" can then extract the bytes you need for each
frame and write to a file or stdout. The I420 and the I444 are planar
formats meaning, first you have all the Y bytes, then the U bytes and then
the V bytes. Packed formats have YUV interleaved.

See also https://wiki.videolan.org/YUV/

Best regards
Peter




On Tue, Jun 24, 2014 at 8:39 PM, Jordan Johnson <jwllmjohnson at gmail.com>
wrote:

> I am working on an NTSC <https://en.wikipedia.org/wiki/CCIR_System_M>
> transmitter in gnuiradio, and somehow need to have theluma (monochrome)
> <https://en.wikipedia.org/wiki/Luma_%28video%29>, and chrominance (color
> difference) <https://en.wikipedia.org/wiki/Chrominance>. As single raw
> files. The chrominance must futher be split into hue and saturation
> channels, as they must be QAM modulated temperately to form the complete
> color signal. I have the radio portion in place, I simply need some input
> to test it,
>
>
> On Tue, Jun 24, 2014 at 2:08 AM, Tim Müller <tim at centricular.com> wrote:
>
>> On Mon, 2014-06-23 at 11:20 -0700, Jordan Johnson wrote:
>>
>> Hi Jordan,
>>
>> > I would like to use gstreamer to take a video, and extract the luma
>> > and chroma components from the video into raw files for editing. What
>> > is the best way to do this?
>>
>> Could you describe in some more detail what you want to do exactly?
>>
>> "Take a video" - from what source? Camera? What kind?
>>
>> When you say you want to "extract the luma and chroma components from
>> the video into raw files", does that mean you just want to save the raw
>> video frames to a file somehow, or do you want to access each frame in
>> your application directly and then poke at the pixels (luma/chroma
>> components) yourself? The appsink element might help with the latter.
>>
>> Cheers
>>  -Tim
>>
>> --
>> Tim Müller, Centricular Ltd - http://www.centricular.com
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140624/459e16c1/attachment.html>


More information about the gstreamer-devel mailing list