VideoHelp Forum
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. Member
    Join Date
    Aug 2007
    Location
    Germany
    Search Comp PM
    Hello,

    I test out some manual conversion techniques to understand why and when to do what.

    I have some high quality DIVX files (Full DVD resolution) in YV12 colorspace.

    Say I want to convert them into a Huffyuv-RGB32 avi file to filter it in VirtualDub later (maybe do some color correction and denoising). The final target should be MPEG2. I have some scenes (different files), which need some special filtering. Later I want to cut these in Sony Vegas.

    I've set up an Avisynth Script so far to frameserver that file to VD and save it out with Huffyuv compression in Fast recompress mode.

    This is my script:
    ----

    AVISource("c:\test.avi",pixel_type="YV12",fourCC=" divx")
    #ConvertToYV12()
    ColorYUV(levels="TV->PC")
    AssumeFPS(25,1,sync_audio=true)
    ConvertToRGB32(matrix="PC.601")

    ----

    If I open the original file in one instance of VirtualDub and the Avisynth script with another instance,
    the video output looks identical.

    1. If I comment out out the ColorYUV(...) function, the colors are washed out a bit in comparision with the original file. When and why should I use the ColorYUV() command? Should I use ColorYUV(levels="TV->PC") or ColorYUV(levels="PC->TV") if I want later convert to MPEG2?

    2. The ConvertToRGB32(matrix="PC.601") do the colorspace conversion and keeps the full RGB range [0,255]. Is the matrix okay or should I use "Rec601" to do some color correction and cut later in Vegas?
    Quote Quote  
  2. ColorYUV(levels="TV->PC") expands the luma range from 16-235 to 0-255.

    ConvertToRGB32(matrix="PC.601") converts to RGB without expanding the luma range again.

    Your script could just as well have read

    Code:
    AVISource("c:\test.avi") 
    ConvertToRGB32()
    and accomplished the same thing because ConvertToRGB32() automatically expands the luma range from 16-235 to 0-255.

    Further reducing your AVS script to:

    Code:
    AVISource("c:\test.avi")
    Would result in the same thing again because VirtualDub converts YV12 to RGB with the same luma expansion. Opening the AVI file directly in VirtualDub would do exactly the same thing.

    What you really want to do is open the AVI file with AviSynth, do all your filtering there (leaving it in YV12) then use VirtualDub in Fast Recompress mode (or your MPEG encoder) to save the results. This allows you to completely avoid the YUV->RGB->YUV conversion.

    If you want to do your filtering in VirtualDub and avoide losing blacker-than-black and whiter-than-white portions use:

    Code:
    AVISource("c:\test.avi") 
    ConvertToRGB32(matrix="PC.601")
    Be sure that when you convert to MPEG that the encoder knows your levels are already in the 16-235 range so it doesn't automatically compress the luma range.
    Quote Quote  
  3. Member
    Join Date
    Aug 2007
    Location
    Germany
    Search Comp PM
    Thank you jagabo for the explanations!

    Yes, I know colorspace conversions are not good and should be avoided.
    But I am a not so advanced user with Avisynth and VD gives me a "See-what-you-get" UI and I can test some filter-chains and see the results just there.
    I tried some Avisynth filters and I know some of them are faster and even better. There are so many out there and I don't know which to use when.

    If I want later cut all the scenes (various files) together in Vegas, I read Vegas works in RGB colorspace and it would be better to do colorspace conversions with Avisynth before.
    Is that right?

    Can I use YV12 files with Vegas without the internal conversion to RGB?
    Quote Quote  
  4. I don't use Vegas so I can't say what is best for it. But I believe Vegas defaults to NOT performing the luma expansion when converting YV12 to RGB.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!