Log in

View Full Version : Need advice on BT.709 to BT.601 conversion


Avisynth_challenged
1st August 2009, 20:25
Hi all,

I'm converting a 1080i HD .ts file into a 480p SD DVD. I just learned that the conversion from HD to SD requires a colorimetry conversion from BT.709 to BT.601.

So I need to revise my script. Where in the following script should I do the colorimetry conversion?


############
############
# These lines call the scripts required for IVTC
Import("C:\program files\avisynth 2.5\plugins\jdl_util.avs")
Import("C:\program files\avisynth 2.5\plugins\jdl_telecine.avs")

LoadPlugin("C:\program files\avisynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\program files\avisynth 2.5\plugins\deblock.dll")
############

# This line loads the MPEG source
MPEG2Source("mpeg2source.d2v")
############

# IVTC Section:
# If source has perfect 3:2 pulldown pattern, choose JDL_IVTCPattern
# Otherwise, choose telecide().decimate()
# Use only one, comment out the other!

JDL_IVTCPattern(2, false) #3:2 pulldown removal for this clip
#telecide().decimate()
############

# This line removes macroblocking
deblock(35,0,0)
############

# This line converts from MPEG2 YV12 to YUY2
converttoyuy2()
############

spline36resize(720,480)
############

sharpen(0.20)
############
############


If you see anything else that's wrong in the above, please let me know about it as well. Thanks :thanks:

TheRyuu
1st August 2009, 20:44
You can either put it post source with interlaced=true or post telecide with interlaced=false (I put it post telecide).

People have claimed that there are issues (artifacts?) with interlaced=true, I've never had a problem with it though.

Also, lets stop using telecide().decimate()
Lets enter the 21st century with TIVTC.

Edit:
Or you could just do nothing and flag it in the encoder.

manono
2nd August 2009, 05:06
Also, lets stop using telecide().decimate()
Lets enter the 21st century with TIVTC
I find that remark insulting to the developer of Decomb and many other great filters and applications, without whose work we would be virtually hamstrung in our video encoding hobby. I could be wrong about this, but I believe Decomb to be the most commonly used AviSynth IVTC, as it's used in so many popular all-in-one programs. It's also well known that many of the ideas used in TIVTC were first developed for Decomb.

Use what you like, but if I were you I wouldn't be throwing around gratuitous insults in a forum moderated by that same developer. Instead I think you should be thanking him for his work for the AviSynth-using community.

Mug Funky
5th August 2009, 04:45
any reason you're finishing in yuy2? you could probably dick that line.

as far as neatness and "flow" are concerned, i'd want to put the colorimetry change just after the resize to SD land. reason is just because it should be considered part of a HD to SD downconvert, and placing it immediately after the resize rather than before it just means it's processing less pixels and giving you a little more speed.

@ manono: hear, hear. a majority of the time decomb and TIVTC give identical results. it's only when video is wacky that there's any difference, and even then it's more down to user preference than technical advancement to determine what to choose.

writing an IVTC procedure is exceedingly difficult, too. there's always many exceptions to any assumptions you can make about 3:2 patterns. my solution is to work with PAL as much as possible, and it's a very good solution :). having access to telecine and digital intermediate equipment helps a lot too :)

thewebchat
5th August 2009, 05:33
Or you could stop being in the 20th century and only work with progressive material. Every time I see an interlaced DVD, I just put it into the rubbish.

Mug Funky
5th August 2009, 07:41
@ thewebchat:

omg, you best be trollin'

please bear in mind this thread is actually about converting between 709 and 601 colourspaces.

that's gonna work well for you:
"why are you returning this DVD? does it not work?"
"no, it works perfectly. it's just that... you know... it's... interlaced..."
*blank stare from shop assistant*

[edit]
i love how some people around here talk as if they invented moving pictures, and someone came along and just perverted it by adding interlace. why do people take it personally or even religiously that interlace is evil just because their computer screen can't deal with it properly? i wonder if people never ever saw the combing effect on a progressive screen, would they even care that the picture is in fact 2 pulses of half the lines rather than 1 pulse with all the lines?

Blue_MiSfit
5th August 2009, 07:50
I'd convert the colorimetry after IVTC (right?). I'd use use something like this:


MPEG2Source("movie.d2v")

# IVTC Section:
# If source has perfect 3:2 pulldown pattern, choose JDL_IVTCPattern
# Otherwise, choose telecide().decimate()
# Use only one, comment out the other!

JDL_IVTCPattern(2, false) #3:2 pulldown removal for this clip
#telecide().decimate()
#Your method should work fine.. I personally prefer TFM.TDecimate, but that's just me!

Deblock(35,0,0)
#I'd probably use something like DeblockQED() for this.
#It's definitely source dependent!

ColorMatrix(mode="Rec.709->Rec.601")
#This should do the trick...

ConvertToYUY2()
#YU2 for CCE? Otherwise, avoid.

spline36resize(720,480)

# sharpen(0.20)
# I'd say this is a little harsh, especially when downsizing.
# Also, recall that if you're targeting a CRT SDTV, you should almost blur vertically!

Blue_MiSfit
5th August 2009, 07:55
aren't all DVDs that aren't created from 30p interlaced?


Not necessarily. DVDs can come from almost any source. For example, I can output 23.976fps progressive video from Premiere CS4, and encode that using HC into 23.976fps MPEG-2, with "soft" pulldown enabled, to make it DVD compliant.

~MiSfit

shoopdabloop
5th August 2009, 08:04
oh, i thought dvds had to fit progressive content into 50/60i when burning.

Blue_MiSfit
5th August 2009, 09:04
That's true. You still have to soft telecine a 24p stream to 50i or 60i when targeting DVD. However, this is trivial compared to hard telecine.

~MiSfit

TheFluff
5th August 2009, 14:27
i love how some people around here talk as if they invented moving pictures, and someone came along and just perverted it by adding interlace. why do people take it personally or even religiously that interlace is evil just because their computer screen can't deal with it properly? i wonder if people never ever saw the combing effect on a progressive screen, would they even care that the picture is in fact 2 pulses of half the lines rather than 1 pulse with all the lines?
are you denying that an interlaced stream effectively has half the resolution of a non-interlaced one if there is any motion at all?

Guest
5th August 2009, 14:29
Please get back on topic and not start a war about interlacing.

Revgen
5th August 2009, 14:42
I always add it at the end. I'd rather my filters work with the original colors first. But either at the beginning or the end is fine. Just be sure that if your material is interlaced that the colorimetry filter always has interlaced=true if you are loading the colorimetry filter at the beginning. If you've deinterlaced your material than putting the colorimetry filter at the end doesn't require you specify anything about interlacing.

Beginning if interlaced:

Colormatrix( sourcecolorimetry->changedcolorimetry, interlaced=true)

End if deinterlaced or IVTC'd:

Colormatrix(sourcecolorimetry->changedcolorimetry)