PDA

View Full Version : YUY2 vs YV12?


TMLewiss2
4th March 2005, 19:34
I have searched google and doom9 and read almost everything on the two formats. I know that they use dif. color spaces and that they are both based on YUV or whatever. I also know that YV12 uses 12 bits of info per pixel, and YUY2 uses 16 bits. But I still don't know which one is better. I know that one probably is not better than the other, so what are the advantages and disadvantages of each. The only reason I want to know is because I love the deinterlacer, SmoothDeinterlacer, but you can only use YUY2. Since I use d2v's, my videos are in YV12. I know I can just convert it with ".ConvertToYUY2", but I don't want to do that if there are more disadvantages to YUY2 than YV12. If anyone knows of a better deinterlaceing plugin that supports YV12, I am all ears :). Thanks in advance to anyone who replies to this post.

PS: I know I have posted alot lately, this is my last thread, I swear... lol

scharfis_brain
4th March 2005, 20:01
try TDeint and/or Leakkerneldeint
both also have a bobbing mode built in and do support YUY2 and YV12

TMLewiss2
4th March 2005, 20:11
Doesn't bob deinterlace change the framerate to 60 fps, then you have to manually change it back? Or am I wrong?

scharfis_brain
4th March 2005, 20:20
I thought you are using smoothdeinterlace for bobbing ?!?

But maybe I've not been precisely enough: the bobbing modes are optional

TMLewiss2
4th March 2005, 20:34
No I never use bobbing, causes to many sync issues (no interlacing though :) ). I have very, very, very few interlaced frames, maybe 10 in a whole 20 mins. of video. I like useing SmoothDeinterlace because I can set it to where it detects only those few. Every other deinterlacer I use, it doesn't even seem like they work at all. I also use decombs Telecide() before I deinterlace.

scharfis_brain
4th March 2005, 20:37
TDeint will satisfy all your needs

TMLewiss2
4th March 2005, 21:00
i have been expermenting with it, it doesn't do anything to my interlaced frames. Even if I set the threshold to 255, it does nothing...

stephanV
4th March 2005, 21:16
then you probably should lower the threshold..

neuron2
4th March 2005, 21:27
@TMLewiss2

Finding that all the deinterlacers seem to do nothing should have made you check your assumptions.

The threshold sets the sensitivity of the combing detection. The lower the threshold, the more sensitive, i.e., more picture areas will be seen as combed. If your threshold is too high, the deinterlacer will think the whole picture is progressive and will not do anything to it.

TMLewiss2
4th March 2005, 22:06
no no no, I am just tired, have not slept in 2 days, I have set my threshold fine, I was just saying. And smoothdeinterlace works well. But the others don't. I read the instructions on them, I know what they do, I am not implementing them wrong, trust me.

scharfis_brain
4th March 2005, 22:12
I am not implementing them wrong, trust me.

I doubt that.


EDIT: provide an unprocessed sample

TMLewiss2
4th March 2005, 22:22
no see I was doing it right, just I can't have decomb and tdeint in the same script, screws it up. I commented out Decomb and it worked. Thanks again. However I will admit I am a n00b at this stuff. My scripts are somewhat catotic. Any way you can think of improveing this?


LoadPlugin("C:\Custom\Programs\Audio\AviSynth 2.5.5\plugins\DGDecode.dll")
#LoadPlugin("C:\Custom\Programs\Audio\AviSynth 2.5.5\plugins\Decomb521.dll")
LoadPlugin("C:\Custom\Programs\Audio\AviSynth 2.5.5\plugins\tdeint.dll")

video = MPEG2Source("test.d2v",cpu=4,idct=4,ipp=false)
video = video.Trim(9665,13970)
video = video.TDeint(order=1)
video = video.Telecide(order=1,guide=0)
video = video.Crop(12, 4, -8, -4)
image1 = ImageSource("image1.jpg",0,201,Framerate( video)).FlipVertical().ConvertToYV12()
image2 = ImageSource("image2.jpg",0,201,Framerate( video)).FlipVertical().ConvertToYV12()
return image1 + image2 + video

neuron2
4th March 2005, 23:23
Doing TDeint() followed by Telecide() is silly. With all due respect, you are just groping, you don't *understand* what you are doing and why.

What is the nature of your input video: pure interlaced, 3:2 pulldown, or hybrid? That piece of information is crucial to make the correct decombing.

You're telling us all the other deinterlacers don't work, and we're supposed to trust you. Ummm, no.

TMLewiss2
4th March 2005, 23:41
I am pretty sure it is NTSC's 3:2 Pulldown. Is there a way I can check. As for the Telecide() after the TDeint(), I don't know why, but if I don't do it in that order, it does not work. I used map=2 to check if anything was even happening and I got nothing. I think it might be because I am haveing to do video.* with everything. Does it have to do with the clip2 parameter for TDeint()? I don't know anymore. I am such a stupid newbie.

I said they don't work because they didn't. I figured out that for some reason they only work if I do them before Telecide(). However SmoothDeinterlace works after. I know I am doing somthing worng, but thats what happened, so... they were not working. I know you can call me a moron. In fact, after I get this to work, I promise I will burn my modem so I can't post any more threads. I just wanted to make my videos nice :(. I sent you one of my caps neuron, remember the Futurama cap, it had blended fields. Same problems, I wish I could decimate too :(, but I gave up on that, now I am just shooting for quality.

neuron2
5th March 2005, 01:01
Relax, friend. We're just suggesting that with your level of expertise, you should be a little less sure of yourself and listen more closely to what we are saying. We're the tool developers and expert users here. We know what we are talking about and have decades of collective expertise. You certainly don't have to stop posting.

You have to treat each clip individually, because different clips can differ by so much. Is it the Futurama clip you are talking about here? Or is there a different one that you are applying this script to?

Let's find out why the deinterlacing isn't working. I can assure you it is *NOT* because the tools don't work. It is because you are making "pilot errors".

Everything can be real easy for all of us if you make the clip available. Again, if it is the Futurama one, I'll reply again right away. If not, please give us the clip. Then we can give you a tested script that you can try to see if you get the same results.

Yes, there are ways to tell if a clip is 3:2 pulled down. But the way depends on the source clip. Is it a VOB or other MPEG2 file, or is it an AVI? Your script above uses MPEG2Source, so your first clue is the FILM percentage at the bottom of the D2V file. Generally, if it has 95% FILM or more, it is 3:2. But, even if it says 100% NTSC, it might still be "hard" 3:2. To tell, serve the D2V with field operation NONE into VirtualDub, find a high motion area, and step through the frames. If you see 3 good followed by 2 combed, then it is 3:2. But if it is anime with lots of duplicates, that can complicate matters. There's a good sticky in the DVD2AVI/DGIndex forum all about IVTC that you should read and digest.

So please tell us about your current input clip that you are trying to process and upload it if it is not the Futurama one. We'll be happy to help you. That's why we're here.

Axed
5th March 2005, 11:30
TMLewiss2 - Dont stop posting, this place is an invaulable resource for your video encoding, and is populated by very nice people who use their valuable time to help us poor newbies! And hopefully, when we learn enough we'll be able to pass on some knoweldge also.

No-one will think your 'stupid' for making a scripting error, everyone makes mistakes no matter how experienced they are. If your having problems with avisynth, just remember to always post the script, and a description of the source. That way, people will be able to pick out the problem easier.

TMLewiss2
5th March 2005, 14:03
Lol I didn't stop posting. I just feel asleep. I told you I had not slept in almost 3 days. Ok neuron, I posted an avi file called "Avatar [original = mpeg].avi" on your ftp. Of course it was originally an mpeg2 capture, but I changed it to XviD @ 8000 kbps with no filters at all on it. You will notice that Telecide() does an extremely good job on the blended fields. However, when the characters talk, some of the mouths have interlace issues, not to mention some fast action sequences. Also, I would like to clean up the video as much as possible, no rapid color changes and/or artifcats. So if you can provide me with anything I can read on that, I would be grateful. I have to goto school now, I will be back in a few hours.

neuron2
5th March 2005, 15:23
@TMLewiss2

I'm not going to look at anything but the original source material. You throw away a lot of clues I need when you convert to AVI. It's not hard to cut an MPEG if it is too big.

TMLewiss2
5th March 2005, 16:17
Sending. It is the original, cut.

neuron2
5th March 2005, 16:23
Great, thank you.

neuron2
5th March 2005, 17:52
That's a very challenging clip. It's not field-blended. But it does have an unusual field pattern and some bad dot crawl/rainbow artifacts. I tackled just the decombing aspect. You can see my result here (right click and Save As):

http://neuron2.net/guest/avatar_by_don.avi

Before saying how I did that, I'd like to see other people's attempts with their favorite decombing tools. You know, kind of a shootout. :-)

tritical? Wanna have a go at this?

BTW, I did not use any manual overrides. :)

TMLewiss2
5th March 2005, 20:34
Cool, I am downloading it now. I want to see other peoples too :). I will update this post after I finish downloading and watching yours.

PS: This is an odd question, but is your avatar your cat, or just a cat. Because everytime I see it I think to myself, "My god that looks like Andromeda! (My sisters cat)." I know it isn't, but it looks like her!

Update: Got it, watched it. Pretty darn good. Got rid of the few pesky frames with bad mouth interlace issues. I am almost positive you used bob deinterlacing. I could be wrong, I only think that because of frame duplication. Its alot better than mine :). Umm, can you tell me what I have to read up on to clean up video. Like you said, it has alot of artifacts.

tritical
5th March 2005, 22:29
I made a lame attempt at it. Didn't use overrides though I probably tweaked two settings no one else would ever change :D. Also, I used one filter to do rainbow removal before doing field matching (that seems like a must to me before trying to decomb a video like this)... does that violate the rules? Anyways, just did field matching no decimation so it's still at 29.970. I can't host dls that big on my webspace so I uploaded to your ftp Donald hopefully that's alright. It's 17.7 MB's total... xvid const quant 2 with max 2 consecutive b-frames (bframes at q3).

TMLewiss2
5th March 2005, 23:16
About to watch it. Whenever I decimate an anime, it always messes up. And I use the mode where it removes the frame in the longest series of frames that are the same... that should work (I would think).

Update: Wow, you cleaned the heck out of it :). How did you get rid of all the rainbow artifacts? If you don't want to tell me till everyone tries thats fine, but wow. I only saw one frame at all the had jagged edges. GJ both of you.

TMLewiss2
7th March 2005, 14:33
Anyone else wanna take a crack at it?

Nematocyst
7th March 2005, 17:34
I've been following along, mostly so I can learn something.

I did take a crack at it, and surprised myself by coming up with something decent. Mine looks a lot like tritical's, only decimated. I'd post it, but his is better-- there are a couple of frames in mine that didn't match right.

One thing I will say is that all I used was the decomb package.

Alright, I finally hit the solution that eradicated the remaining
unmatched fields. I'm done now.

TMLewiss2
8th March 2005, 04:39
Cool thanks, yeah I use decomb too. :) I want to know how to clean the video. Hopefully we will begin to see some code releases soon :).

tritical
8th March 2005, 06:42
I'm just waiting for someone to call an end to the challenge :D. Though, anyone who was gonna try probably would have by now. I'll post what I used tommorrow... it's not exactly remarkable or original by any means.

Nematocyst
8th March 2005, 10:55
Here's my final script:

mpeg2source("d:\avatar.d2v")
Telecide(order=1,guide=0,post=2,nt=45,chroma=false,y0=0,y1=7)
Decimate(cycle=5,mode=2)

Originally, I had to use a 'nt' value of 55. But when I thought to exclude lines 0-7, I was able to reduce this to 45. As I messed with this parameter, I realized that if it got too high, (80 was sufficient), it started causing more problems than it solved.

I messed with GuavaComb(), but it either didn't help, or I'm just too much of a newbie to pick good values for it. Anyway, I learned a lot from this little exercise. I look forward to seeing the other scripts, and also to working on cleaning it up.

TMLewiss2
8th March 2005, 14:57
yeah, I have direct tv, and that stupid fuzz appears at the top of all my TVs connected. I should call them and have them fix that.

TMLewiss2
9th March 2005, 16:28
Originally posted by neuron2
Before saying how I did that, I'd like to see other people's attempts with their favorite decombing tools. You know, kind of a shootout. :-)


Will you and tritical post your code now? Or is it still to early?

neuron2
9th March 2005, 16:41
I just did Telecide(order=1,post=0) and then served it into VirtualDub, where I applied my most recent SmartDeinterlacer as a postprocessor, with settings field differencing, motion map denoising, threshold 40, EDI interpolation. I had to use SD because FD doesn't have EDI.

TMLewiss2
9th March 2005, 17:20
Originally posted by tritical
I used one filter to do rainbow removal before doing field matching (that seems like a must to me before trying to decomb a video like this)... What filter?

tritical
9th March 2005, 19:33
I used:

mpeg2source("c:\avatar.d2v")
tcomb()
tfm(mode=4,MI=80)

considering no one has tcomb but me, you should get something similar by replacing tcomb() with guavacomb() like this (they both only filter in static parts of the image):

mpeg2source("c:\avatar.d2v", upConv=true)
# or you could use a separate yv12->yuy2 conversion
GuavaComb(Mode = "NTSC", Recall = 82, MaxVariation = 22, Activation = 70)
converttoyv12(interlaced=false) #optional, could convert later
tfm(mode=4,MI=80)

tweak guavacomb's settings to meet your needs. Of course there are lots of other rainbow removers out there, both script based and actual filters (some that work only temporally, some that work spatially, some that do both) that you should probably try. Just search for "rainbow", it will bring up lots of stuff.

TMLewiss2
9th March 2005, 23:12
Ok I got my video to around 100000000 times better than I used to. Thanks all of you. LOL Tritical, almost every filter I am useing is yours :). The only problem I am running into still is the rainbowing. At list I think this is called rainbow. Here is a pic:

http://img16.paintedover.com/uploads/16/rainbow.jpg

Notice around the arms edges the colors are bright orange and yellow. I think that is what rainbowing is right? I used guavacomb on the settings you proveded and also at max settings, nothing. Any suggestions.

PS: I know this is because I am a n00b, watch it is going to be something stupid and easy.

Anyone know what computer component speeds up encodeing the most... I would think the processor and RAM would have the most to do with it... my RAM is crap... lol with these settings I only get 3 fps when encodeing... but it looks good!

TMLewiss2
10th March 2005, 16:16
I have used Rainbow Killer, Deen, Guavacomb, and mfRainbow. None of them fix this, well... I can't get them too.

Wilbert
10th March 2005, 17:35
Perhaps Cnr2 can help a bit?

TMLewiss2
11th March 2005, 00:39
I will try it thanks, I can actually get guavacomb to work if I set recall to 0, but then it does everything all the time... also to get rid of the rainbows I have to set the MaxVariation to 80+ and then it looks like crapola.

hartford
11th March 2005, 05:52
you might try this to diminish rainbows:

loadplugin("dgdecode.dll")
loadplugin("BiFrost.dll")
Loadplugin("Mipsmooth.dll")
Loadplugin("MSharpen.dll")
Loadplugin("MaskTools-1.5.6.dll")

Import("DeRainbow2.avsi")

mpeg2source("avatar.d2v")

BiFrost(interlaced=true,scenelumathresh=1.5,variation=2)

DeRainbow2(8)


==

I modified Derainbow2 in order to limit bleeding of red: blur
set to 1.47 rather than 1.58

I capture analog at 640x480; perhaps that's the difference.
Even so, the above seems to be effective.

..

DeRainbow2

# === by Lothar
#
# Requires MaskTools 1.5.6, MSharpen, Mipsmooth
#

function DeRainbow2(clip org, int "thresh")
{

#Based on DeRainbow by Sh0dan

assert(org.isYV12(),"DeRainbow2() requires YV12 input!")
thresh = default(thresh, 10)

org_u = utoy(org)
org_v = vtoy(org)

msharpen(org, threshold = thresh, mask=true)
reduceby2()
greyscale()
uv = blur(1.5).levels(0,2.0,255,0,255, coring=false).levels(50,2.0,255,0,255, coring=false)

filtered_u = org_u.mipsmooth(spatial=255, temporal=255, scenechange=3, show=false, method="strong", scalefactor=0.5)

filtered_v = org_v.mipsmooth(spatial=255, temporal=255, scenechange=3, show=false, method="strong", scalefactor=0.5)


u_final = MaskedMerge(org_u, filtered_u, uv)
v_final = MaskedMerge(org_v, filtered_v, uv)

derainbowed = ytouv(u_final, v_final, org)

#edgem = org.Edgemask(type = "cartoon", thy1=6 , thy2=6, thc1=6, thc2=6).expand().blur(1.58).FitY2UV()
edgem = org.Edgemask(type = "cartoon", thy1=6 , thy2=6, thc1=6, thc2=6).expand().blur(1.47).FitY2UV()

return MaskedMerge(org, derainbowed, edgem, Y=1, U=3, V=3)

}
#

..

Seemed to work.

TMLewiss2
11th March 2005, 15:54
hartford you OWN, that worked perfectly... so perfect how... I don't get a single rainbow my intire film. GJ!

TMLewiss2
11th March 2005, 17:02
Ok I got everything working, thanks again to everyone. The video looks great. It better look great, I only convert at 2 fps lol, and I have a good pc too lol.

ppera2
11th March 2005, 17:35
Originally posted by TMLewiss2
I have searched google and doom9 and read almost everything on the two formats. I know that they use dif. color spaces and that they are both based on YUV or whatever. I also know that YV12 uses 12 bits of info per pixel, and YUY2 uses 16 bits. But I still don't know which one is better....

Hmmm... nobody tried to answer it.
I guess that: more bits - more quality :)

TMLewiss2
11th March 2005, 18:24
I guess so, lol I like your avatar.

hartford
16th March 2005, 02:52
Which one is better? Neither.

YUY2 is "closer" to "real" because it uses more bits than YV12.

Most of the concern is related to conversion between colorspaces due to errors. There was a particularly informative discussion here but I can't find the thread.

This (http://www.hometheaterhifi.com/volume_8_2/dvd-benchmark-special-report-chroma-bug-4-2001.html) might give you a bit more info.

Don't convert unless it is necessary; DVD standard uses yv12; try to keep it that way.

mpucoder
16th March 2005, 03:55
Originally posted by hartford
DVD standard uses yv12
I read that a lot and wonder why people think that. YV12, as I understand it, closely matches YCbCr 4:2:0, but is not exact. The mpeg standards call for 9-bit values at the input to the DCT, not 8-bit. So using YV12 loses half the depth of all three components.

hartford
16th March 2005, 04:51
I bow to you.

I was trying to present a simplified version of "what is going on."

Perhaps you will expand and/or correct my explanation? :)

- Best

mpucoder
16th March 2005, 05:22
As far as I can see from all the fourcc codes, YV12 is the closest to the 4:2:0 used by mpeg-2. And mpeg-1/2 is what the DVD standard calls for. So it looks like a good choice for handling video prior to encoding.

But, it does lack the ninth bit of precision called for in the mpeg specs.

Personally I prefer to do processing at a greater precision than the encoder can use to minimize the accumulation of rounding errors (both audio and video).