PDA

View Full Version : Proper Sampling for DV processing with AviSynth - need help


ccfilms
19th May 2005, 05:03
Hey guys, I'm an indie filmmaker who has been using nothing but professional applications for my work. Well, I ran across AviSynth and Vdub in my attempts to compress my films to different formats and now im in love with the different filters.

However, something that has always bugged me is colorspace and chromasampling. I've read many articles and used the search function on this forum alot int eh past few days but can't seem to find what I'm looking for. Basically, the original DV is pretty balanced when it comes to contrast and brightness and such. However, I like to take my DV footage and convert it to 24p (just until I get a nicer camera like that new JVC GY-HD100U HD 24p cam). Currently, I'm using TMPEG for that converting, however, when I do that I lose a bit of color depth (i can correct this for the most part in Sony Vegas though, which is my NLE of choise).

Well, I just found out how to do different de-interlacing and 24p converting with avisynth and I was quite intrigued. Here's the script i used:

Avisource("c:\dv.avi")
ConverttoYUY2(true)
BlindPP(cpu2="ooxxox")
LeakKernelBob(0,10,false,true)
#dgbob(0,8)
Tomsmocomp(0,-1,0)
convert60ito24p(0,0)
Lanczos4Resize(872,480)
LimitedSharpen()

I was also messing around with dgbob as a deinterlacer. This current script was just a test I was trying. But my goal here isn't about deinterlacing as much as it is DV color sampling in Avisynth.

Notice my images below (scroll down to the bottom). The original source DV, the TMPEG render (with deinterlacing, IVTC (for 60ito24p converting), and sharpening applied) and then look at the avisynth render.

As you can see, teh TMPEG lacks a bit of the color depth of the original (like i said, it was actually even worse before i applied a Sony Vegas Contrast +0.13 function to it). I must say one thing though, props to Donald Graft! You rock man! your post processing in DGDecode.dll are insanely good! They really do work! Good job man! I owe yah!

Now, the Avisynth file has more color depth, but some of the details (like some tree branches) are washed out... almost as if a contrast filter was applied. This is actually inherent even without deinterlacing, so it's not the deinterlacing method (like i said, im trying to figure out color sampling methods).

How can I apply avisynth filters and have it keep the color and details the same as the original (im not talking about de-interlacing here, im talking about chroma sampling). Can anyone help me with this? It's been kinda bothersome to me for my last two films, how the color sampling is a bit off compared to the original DV.

Note: as you can see, the Avisynth is way better than the TMPEG render. Why didn't i discover avisynth before now?!?!? I'm hyped! You can actually make out the stubble on the guy's face now! Sadly, those are screenshots from my film Sinking Ships, of which I'm almost completed with, so I won't be able to totally overhaul it with this new high quality method. Oh well. Next movie though!




DOWNLOAD THE EXAMPLE SCREENSHOTS HERE: JPG (337KB) (http://www.ccfilms.com/source.jpg) PNG (1.7MB) (http://www.ccfilms.com/source.png)

neuron2
19th May 2005, 05:14
Originally posted by ccfilms
I must say one thing though, props to Donald Graft! You rock man! your post processing in DGDecode.dll are insanely good! They really do work! Good job man! I owe yah! Thanks for the props but for the record, I did not implement the postprocessing. BlindPP() was made by MarcFD.

Studying the remainder of your post...

Welcome to the forum.

ccfilms
19th May 2005, 05:18
Not exactly sure. Are you talking about the DGbob or the tomsmocomp. It was more a test. To see what it would do to set that to -1... But I probably won't be doing it that way. I was messing around with alot of stuff. I think I used a number of combos of those settings earlier. I like the kernal one alot though. But those settings aren't final. I was just tweaking and messing around to find a killer setting that provides maximum clarity. lol.

My main thing is is the color sampling that is going on and how contrasted and washed out some colors are getting compared to the DV. Actually, washed out isn't the proper term. It's just more "contrasted" than the DV. And I like to apply all my color corrections in Sony Vegas, not have them done for me. :(

edit: About BlindPP, yeah, im wrong. :P It's still rocks though. people can see it's effect here in this animated gif (blue channel only):

http://thebrbforums.com/uploads/post-9-1116269048.gif

neuron2
19th May 2005, 05:22
Oops, edits crossed. I had asked why TMC after bobbing, but then deleted the comment until I could look up what the -1 is doing.

Wilbert
19th May 2005, 11:22
My main thing is is the color sampling that is going on and how contrasted and washed out some colors are getting compared to the DV. Actually, washed out isn't the proper term. It's just more "contrasted" than the DV.

It can be that the dv decodes to RGB [16,235]. In that case try

Avisource("c:\dv.avi")
ConvertToYUY2(matrix="PC.601", interlaced=true)
...

to get YUY2 [16,235].

ccfilms
19th May 2005, 15:52
OK, now i need to install Avisynth 2.56

I was having some trouble with that version before. :( But I'll try it and see what i come up with. It does make sense though what your saying. :)




EDIT: OK, I tried it, and it's ideed worse than before, so that setting doesn't work. It's worse than a straight up "converttoYUY2". It's far to contrasted. So that's not it. What else can it be?




EDIT2: It's actually got something to do with the way that AviSynth is reading the input file. I think Sony Vegas is using it's own "Sony DV" codec (which is really quite nice, very little generation loss, but I like using HuffyUV for my renders. lol) Anyways, Avisynth is using, i think, the Panasonic DV codec where as Vegas is usin it's sony codec (just my speculation).

And I don't even think it's avisynth thing, cuz when I open the DV file straight up in Windows media player (as oposed to frameserving it through Avisynth) it still does the same thing. It's more contrasted than the way Vegas decodes it. (look at my screenshots in the top post....as you can see, avisynth is reading it more contrasted than vegas, of which the source screenshot is taken from. Notice the guy's shirt and the tree branches. Some of the details are gone.)

Wilbert
19th May 2005, 16:43
EDIT: OK, I tried it, and it's ideed worse than before, so that setting doesn't work. It's worse than a straight up "converttoYUY2". It's far to contrasted.
Hmm. Do you know the fourCC of the sony dv codec? Or can it only be used in Vegas itself?

ccfilms
19th May 2005, 16:56
I think it's just the way Vegas is reading it. Cuz i think it's only being used in Vegas (cuz when i open a DV file in WMP, the colors are just like they are running it through Avisynth). I'm just wondering what SonyDV is doing to decode the footage (of which, was captured off a Sony MiniDV camera. lol)


EDIT: That said, the fourCC of the file im using right now (in my tests) is DVSD

Wilbert
19th May 2005, 17:01
Try

Avisource("c:\dv.avi", fourCC="DVSD")

Does that work?

ccfilms
19th May 2005, 17:05
Nope. Same as before.



EDIT: On interesting fact is, Vegas also decodes MPEG-2 data (from it's own encoder) in a brighter fashion than DGDecode.dll does. Cuz I was converting a DVD cut of one of my movies to MPEG-4 and I imported the VOB into Vegas and it was like alot brighter (and looked alot sicker) than how DG-decode and DGindex made it look. It might be a bug with Vegas rather than a bug with avisynth. :P

But how do we explain there being more detail in the DV that Vegas decodes rather than the Avisynth decoded file having more detail. Cuz that's just not the case. This is quite a paradox, I'd have to say.

Wilbert
19th May 2005, 17:12
Last attempt :)

Avisource("c:\dv.avi", pixel_type="RGB", fourCC="DVSD")

Could you check which color format is returned with the following script

Avisource("c:\dv.avi", fourCC="DVSD")
Info()

edit:

EDIT: On interesting fact is, Vegas also decodes MPEG-2 data (from it's own encoder) in a brighter fashion than DGDecode.dll does. Cuz I was converting a DVD cut of one of my movies to MPEG-4 and I imported the VOB into Vegas and it was like alot brighter (and looked alot sicker) than how DG-decode and DGindex made it look.
Could you post screenshots showing the difference in brightness?

ccfilms
19th May 2005, 17:20
The color format is RGB24

And that little tag, setting the pixel type also didn't do it (I also tried setting it to pixeltype RGB24 and it didn't work either.




One thing I have to note as well, Adobe After Effects opens the DV file the same way Avisynth is (more contrasted). I seem to remeber (i can find it and test it in a flash) someone posting a link to a DirctShow version of the sonyDV codec for decoding. I'm gonna test that and see if it works.

It is interesting that Vegas is the only app that opens the DV in the way it does, and all other apps open it more contrasted. Very interesting.

ccfilms
19th May 2005, 17:50
Could you post screenshots showing the difference in brightness?

As requested:


(it's JPEG compressed, but you get the point).


EDIT: The attachment didn't work. Here it is:

http://www.ccfilms.com/dgindex-vegas-compare.jpg



I looked at this images and I think vegas might have a funkish bug with reading chroma info (or it un-contrasts all imported footage and brightens it). This should be researched (i'm gonna try to right now).