VideoHelp.com Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Member
    Join Date: May 2007
    Location: United Kingdom
    Hi guys my 1st post.
    Would any of you know how to convert YUY2 to YV12 format.

    Currently I have a byte array which contains YUY2 data.
    The resolution should be 704x576.
    The byte array is of size - 811008. Should 704x576 not be 45504.

    Is there any code samples or an algorithm to do this?

    Many thanks...
    Al.
    Quote Quote  

  2. Member
    Join Date: Dec 2005
    Location: none
    I think you meant to type 405504 but YUY2 is two bytes per pixel. 704*576*2 = 811008.

    YUY2 to YV12 is pretty simple. You should be able to figure it out from information at fourcc.org:

    http://fourcc.org/yuv.php

    Be sure to take into account interlacing if your output will be interlaced YV12.
    Quote Quote  

  3. Member
    Join Date: May 2007
    Location: United Kingdom
    Ok so if I have these YUY2 bytes - YUYV YUYV
    If I convert them to YV12 bytes should I have YYYYVU?
    Quote Quote  

  4. Member
    Join Date: Dec 2005
    Location: none
    Not exactly. YV12 is a planar format. You'll end up with three arrays, one of Y at the full resolution, followed by one of the V at half (both dimensions) resolution, and one of the U at half resolution.

    four YUY2 pixels (2x2 array):

    Code:
    Y(0,0) U(0,0) Y(0,1) V(0,0)
    Y(1,0) U(1,0) Y(1,1) V(1,0)
    to four YV12 pixels (2x2 array + 1x1 array + 1x1 array):

    Code:
    Y(0,0) Y(0,1)
    Y(1,0) Y(1,1)
    
    (V(0,0) + V(1,0)) / 2
    
    (U(0,0) + U(1,0)) / 2
    Additional infor for interlaced YV12:

    http://avisynth.org/mediawiki/Sampling
    Quote Quote  

  5. Member
    Join Date: May 2007
    Location: United Kingdom
    Should the last line read (U(0,0) + U(1,0)) / 2?
    Quote Quote  

  6. Member
    Join Date: Dec 2005
    Location: none
    Yes, typo. Fixed it.
    Quote Quote  

  7. Member
    Join Date: May 2007
    Location: United Kingdom
    Would I be correct in assuming that after the conversion using the above resolution of 704*576 I will have these array sizes

    Y - 405504 bytes
    V - 101376 bytes
    U - 101376 bytes
    Quote Quote  

  8. Member
    Join Date: Dec 2005
    Location: none
    Originally Posted by allyli2007
    Would I be correct in assuming that after the conversion using the above resolution of 704*576 I will have these array sizes

    Y - 405504 bytes
    V - 101376 bytes
    U - 101376 bytes
    Yes.
    Quote Quote  

  9. Afternoon allyli2007,

    Some time ago, I did some demonstrations** of the layout and posted some raw yuv
    images of those that I engineered into the tool. It was designed only to spit out the yuv
    images in binary format. And to open or import them in video editor like AVIsynth required
    one of their plugins. It was this method that I used to test our my tool's success not to
    mention, my understanding and correct coding, etc.

    I also wrote a tiny calculator to help me understand the Luma/Chroma placement, but at
    some point, I bOrked it and haven't found the energy to fix it. Maybe I should. Hmm.. I
    remember starting out with just a simple calculation (resoution based) and got the chroma
    size, and then the chroma playcement, and then.. Well, maybe later. Anyway.

    Here's an example of something that I posted two years ago from the last response I made
    on the subject (before other things bogged me down and I went onto other things) here.

    ** The point I'm making with the image you see below is to help suggest an
    idea for you to visualize the layout using a guide. This helped me to understand what I
    was learning.

    Explanation of the illustration-- The partial (though crude) image you see below is a basic
    representation of how the YUY2 layout can look. And in this pictured view, I had
    incorporated Color Coded Cells, Numerical Position, and the Color Values used. Its
    purpose was to aid in the actual format and look, and it helped me to verify my
    progress. I had a i420 and YV12 pic too, but I can't seem to find it, though those
    two never did make it to my last post on that thread. I was so close to releasing a
    utility (that spits out the layout like the one below) but my personal life got the
    better of me.

    -vhelp 4291


    VHELP's - Sample Clips [last: 12.29.06],
    my YouTube videos
    Quote Quote  




Similar Threads

  1. WMV File with YUY2 Raw Video Format
    By toreachdeepak in forum Video Conversion
    Replies: 3
    Last Post: 24th Feb 2011, 09:43
  2. Capturing YUY2 or YV12 interlaced?
    By rmdeboer82 in forum Capturing
    Replies: 5
    Last Post: 15th Dec 2010, 09:10
  3. Help with captured AVI: Vdub / HCenc / RGB / YUY2 / YV12
    By Rinsin in forum Video Conversion
    Replies: 2
    Last Post: 13th May 2009, 18:57
  4. Converting raw DV format into a quicktime or MPEG format
    By Maiden in forum Camcorders (DV/HDV/AVCHD)
    Replies: 80
    Last Post: 27th Apr 2009, 20:00
  5. What is Native DV(PAL) colorspace? YV12 or YUY2
    By Josip in forum Newbie / General discussions
    Replies: 7
    Last Post: 13th Nov 2008, 23:25
Search   Contact us   About   Advertise   Forum   RSS Feeds   Statistics   Tools