VideoHelp Forum




+ Reply to Thread
Results 1 to 26 of 26
  1. I need a lossless directshow codec that has support for grayscale encoding. Could someone help me?

    Thanks in advance.
    Quote Quote  
  2. Use an AviSynth script to feed into the encoder with either Greyscale() or Tweak(Sat=0,Coring=False) added in. But then I have only 2 lossless codecs installed (Lagarith and HuffYUV) and neither offers the option.
    Quote Quote  
  3. Member edDV's Avatar
    Join Date
    Mar 2004
    Location
    Northern California, USA
    Search Comp PM
    Source format?

    Grey scale at what bit depth, raster spec and frame rate?

    Codec to what export format?

    Compressed or uncompressed?
    Recommends: Kiva.org - Loans that change lives.
    http://www.kiva.org/about
    Quote Quote  
  4. Frame rate: 30fps

    Bit depth: 8-bit (256 grays).

    I'm looking for a codec, so compressed please.

    I'm not sure what you mean by source format, export format or raster spec. Sorry :/
    Quote Quote  
  5. Member yoda313's Avatar
    Join Date
    Jun 2004
    Location
    The Animus
    Search Comp PM
    For source format I believe eddv is asking what file type and original codec form (or lossless/lossy dv-avi).

    So is it from a video camera (what type - dv-avi, m2t, etc), is it hd or sd, is it from a bluray rip a dvd rip? That sort of thing. As for raster spec that is out of my league and I can't elaborate on that.

    Export format will be what you intend to do with the final video. Is it for dvd, bluray, or simply playback on a computer? That will affect all kinds of format decisions.
    Donatello - The Shredder? Michelangelo - Maybe all that hardware is for making coleslaw?
    Quote Quote  
  6. ffdshow includes a lossless JPG codec that will accept 8 bit grayscale (luminance only, Y8) from VirtualDub. It's not clear if it's really working in 8 bit grayscale internally. ffdshow won't output 8 bit grayscale directly -- it will be upsampled to YUY2, YV12, RGB, or some other common format. Similarly, the other codecs (x264 lossless, huffyuv, etc.) accept 8 bit input but may work as YV12 (or other) internally.

    Xvid has a grayscale encoding option but I believe it simply "zero out" the color channels before compressing with the usual YV12 subsampling. And again, it won't output 8 bit grayscale.
    Last edited by jagabo; 31st May 2010 at 09:26.
    Quote Quote  
  7. I'm using adobe after effects, and the source is in black-and-white. The final output format will be H.264/AVC, and I'll be using x264 as the encoder. It's intended for streaming on the internet.

    Thanks jagabo, I'll have a look at those. To be honest, I don't really need a codec that will encode in pure grayscale, but I'm assuming that there's a better chance that the colours will come out decent. When I tried HuffYUV, the whites came out discoloured. I need something like the Animation codec, which produces perfect results, and has a grayscale option. Unfortunately, I can't decode it using something like AviSynth.
    Quote Quote  
  8. You can export using x264vfw directly out of AE. New builds allow .mp4 output with wrapper function (instead of limited to AVI). It doesn't support true greyscale encoding

    If you have greyscale source, you can use --no-chroma-me in x264 for slight faster encoding

    Unfortunately, I can't decode it using something like AviSynth.
    You can read animation codec in .mov with avisynth, with qtinput, or ffms2
    Quote Quote  
  9. Originally Posted by roflwaffle View Post
    When I tried HuffYUV, the whites came out discoloured.
    Then they went in discolored.
    Quote Quote  
  10. Originally Posted by poisondeathray
    You can export using x264vfw directly out of AE. New builds allow .mp4 output with wrapper function (instead of limited to AVI). It doesn't support true greyscale encoding
    I know, but I'm exporting several sources and putting them together later, so I want to export them first using a lossless codec.

    Originally Posted by poisondeathray
    You can read animation codec in .mov with avisynth, with qtinput, or ffms2
    I tried QTInput and it didn't work :/ I'll have a look at ffms2.

    Originally Posted by poisondeathray
    Then they went in discolored.
    I didn't quite understand that. Edit: Nope, it's fine with Animation or even QT MPEG-4 ASP.
    Last edited by roflwaffle; 31st May 2010 at 11:50.
    Quote Quote  
  11. Originally Posted by roflwaffle View Post
    I tried QTInput and it didn't work :/ I'll have a look at ffms2.
    I thought it might be the greyscale screwing things up, but I just did a quick test and QTInput() works fine

    There is a slight levels difference between using QTInput() vs. FFMpegSource2() . It might have to do with the QT gamma shift bug

    What error message did you get with QTInput() ?


    I didn't quite understand that.
    He means that it's lossless, if you see a levels shift, it might be because of the input or colorspace conversion. In AE if your export is RGBA, and you use huffyuv in RGBA mode it should be the same levels. It can also be the decoding software. Not all applications treat huffyuv as lossless (they may interpret levels differently you might get gamma shifts). e.g. if you re-import it into PP, it will clamp levels to RGB 16-235, so it's not treated as true lossless. If you used something like avisynth, it would be treated as true lossless , and the decoded image bit for bit identical.
    Quote Quote  
  12. Originally Posted by poisondeathray
    What error message did you get with QTInput() ?
    Code:
    Script error: There is no function named "QTInput"
    Ok, I installed HuffYUV separately instead of using ffdshow's and it looked fine, but then when I re-encoded it using x264, it was discoloured. This doesn't happen when I use QuickTime's MPEG-4 ASP codec, so I'm guessing there is still a problem with colour conversion.
    Quote Quote  
  13. RGB source (all 256 shades of gray):
    Click image for larger version

Name:	rgb.png
Views:	2892
Size:	5.0 KB
ID:	2073

    After HuffYUV 2.1.1 in RGB mode:
    Click image for larger version

Name:	rgb.png
Views:	2892
Size:	5.0 KB
ID:	2073

    After HuffYUV in RGB-->YUY2 mode:
    Click image for larger version

Name:	huff_yuv.png
Views:	2559
Size:	5.0 KB
ID:	2074

    Using a tool like CSamp shows there are no pixels where R=G=B isn't true. If you are getting discolorations it is happening elsewhere in your processing. Or whatever version of HuffYUV you have is broken.
    Quote Quote  
  14. With me, after using huffyuv and x264, ffffff becomes fdfdfd. The same thing happens when I don't use a codec (uncompressed). After using QT's MPEG-4 and x264, nothing changes.
    Quote Quote  
  15. Script error: There is no function named "QTInput"
    you need qtsource.dll , it's a separate plugin from regular avisynth install. ffms2 is separate as well


    With me, after using huffyuv and x264, ffffff becomes fdfdfd. The same thing happens when I don't use a codec (uncompressed). After using QT's MPEG-4 and x264, nothing changes.
    might be from the colorspace conversion. QT's MPEG-4 is already in YV12, as is x264. Exporting Huffyuv (YUY2 or RGB/A) then converting using x264 requires colorspace conversion
    Quote Quote  
  16. I've tested QTInput several times, and rendering comes out really weird (with the Animation codec at least).

    Is there something I can do with HuffYUV so that colour conversion is not necessary?
    Quote Quote  
  17. Originally Posted by roflwaffle View Post
    I've tested QTInput several times, and rendering comes out really weird (with the Animation codec at least).

    Is there something I can do with HuffYUV so that colour conversion is not necessary?

    Can you describe "weird" a little better ?

    If you used default settings, it will do a colorspace conversion to YUY2

    Try QTInput("video.mov", color=1) , which will give you RGBA . This output looks the same as the FFMS2 output




    Are you using color profiles or working color space profiles in AE? or just defaults?

    The problem is AE works in RGBA (4:4:4:4 sampling) color space, and your final format is YV12 (4:2:0) , so there will be a necessary colorspace conversion somewhere in your processing

    If you use huffyuv in RGBA mode , and use ConvertToYV12() in your script , the appearance should be very similar.
    Quote Quote  
  18. Originally Posted by poisondeathray View Post
    Originally Posted by roflwaffle View Post
    I've tested QTInput several times, and rendering comes out really weird (with the Animation codec at least).

    Is there something I can do with HuffYUV so that colour conversion is not necessary?

    Can you describe "weird" a little better ?

    If you used default settings, it will do a colorspace conversion to YUY2

    Try QTInput("video.mov", color=1) , which will give you RGBA . This output looks the same as the FFMS2 output




    Are you using color profiles or working color space profiles in AE? or just defaults?

    The problem is AE works in RGBA (4:4:4:4 sampling) color space, and your final format is YV12 (4:2:0) , so there will be a necessary colorspace conversion somewhere in your processing

    If you use huffyuv in RGBA mode , and use ConvertToYV12() in your script , the appearance should be very similar.
    It's hard to explain. It's as if it skips frames at the beginning, and then later, everything slows down :/ I've tried your suggestion and many other things.

    I think I'm using the defaults. I haven't changed anything at least. I'll try HuffYUV again then...
    Quote Quote  
  19. The output colorspace for QTInput() will not affect frame skipping or misordering; I would use FFMS2, which indexes your file and is frame accurate.
    Quote Quote  
  20. Member edDV's Avatar
    Join Date
    Mar 2004
    Location
    Northern California, USA
    Search Comp PM
    After Effects is most likely running in RGB colorspace. YCbCr (YUY2) keeps luminance separate. Conversion of monochrome YV12(source) to RGB, then processing in After Effects, then conversion back to YV12 has potential for generation of spurious color components (tint). You can simply null out the chroma components to force monochrome.
    Recommends: Kiva.org - Loans that change lives.
    http://www.kiva.org/about
    Quote Quote  
  21. How do I actually "null out the chroma components to force monochrome"? Sorry about this.
    Quote Quote  
  22. Originally Posted by roflwaffle View Post
    How do I actually "null out the chroma components to force monochrome"? Sorry about this.
    manono provided one option: greyscale() in avisynth . You shouldn't have to do this if your export from AE was done properly.

    the actual encoder, x264 and various decoders don't support true monochrome 4:0:0

    other encoders, like mainconcept reference, do support 4:0:0 encoding, but the flash decoder isn't compatible with it

    I don't see why you are having problems. Maybe you can provide a sample to illustrate

    How are you viewing the final result? What renderer? What decoder? What software? Maybe you have a TV/PC levels issue or playback issue.
    Quote Quote  
  23. I'm using windows media player and the decoder is ffdshow. I don't think it's an issue with my PC, because I took a screenshot and checked the colour. Also, I did a test upload on youtube.

    Samples (huffyuv vs huffyuv+x264): http://www.mediafire.com/?dwz02yzlnz3
    Quote Quote  
  24. Member edDV's Avatar
    Join Date
    Mar 2004
    Location
    Northern California, USA
    Search Comp PM
    Originally Posted by roflwaffle View Post
    How do I actually "null out the chroma components to force monochrome"? Sorry about this.
    AE and Premiere Pro have HSV/YUV filters Just turn chroma saturation parameters to zero (e.g. S,UV).
    Recommends: Kiva.org - Loans that change lives.
    http://www.kiva.org/about
    Quote Quote  
  25. Originally Posted by roflwaffle View Post
    I'm using windows media player and the decoder is ffdshow. I don't think it's an issue with my PC, because I took a screenshot and checked the colour. Also, I did a test upload on youtube.

    Samples (huffyuv vs huffyuv+x264): http://www.mediafire.com/?dwz02yzlnz3
    You can't take a screenshot from wmp, the levels will be washed out (it takes in VMR9(renderless) mode)

    Youtube adds another level of complexity, but your uploaded samples are nearly identical (except one is RGB32, one is YV12) when decoded properly. These screenshots were taken in AvsP (independent of renderer) , the YV12 video is converted to RGB with Rec.601 Matrix for purposes of the .png screenshot

    I think this is a configuration or playback issue on your end
    Image Attached Thumbnails Click image for larger version

Name:	huffyuv rgb32.png
Views:	3092
Size:	6.7 KB
ID:	2077  

    Click image for larger version

Name:	x264.png
Views:	1995
Size:	7.9 KB
ID:	2078  

    Quote Quote  
  26. Originally Posted by roflwaffle View Post
    With me, after using huffyuv and x264, ffffff becomes fdfdfd. The same thing happens when I don't use a codec (uncompressed).
    That's not a discoloration (fdfdfd is still a gray shade), it's a levels issue. RGB uses 256 levels of gray, YUV normally uses 220. So 256 levels have to become 220 when converted to YUV. So with 8 bit YUV samples there is no way for every one of the 256 gray levels in RGB to be retained after a RGB to YUV to RGB conversion (you can see this in my YUY2 sample image). Different programs use slightly different methods to perform the conversions and will give slightly different levels.

    https://forum.videohelp.com/threads/296961-TV-Safe-Colors?p=1812482&viewfull=1#post1812482

    You can use AviSynth to convert to YUV with 256 gray levels:

    ConvertToYUY2(matrix="PC.601")

    and then you have to use the same matrix to convert back to RGB with:

    ConvertToRGB(matrix="PC.601")

    Your TEST.AVI file is encoded by HuffYUV in RGB mode with black=0, white=255. Your TEST.MKV is encoded as YV12 h.264. Black is at Y=16, white at Y=235. This is normally converted to RGB black=0 and white = 255 for display. Your problems are not caused by HuffYUV. They are elsewhere in your processing.
    Last edited by jagabo; 31st May 2010 at 17:56.
    Quote Quote  



Similar Threads

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