# Avisynth Script Help?

## Recommended Posts

Long story short, I paid 70 quid for a color correction script that currently doesn't work for me. Before I berate the guy who sold it to me, I'd like to see if perhaps I'm doing something wrong.

Basically, these are the original Blu-ray colors:

And the script is supposed to turn them into this:

Spoiler

imagesource("00000.m2ts")
converttoyv12()
tweak(hue=-5.3)
ColorMatrix(mode="Rec.709->Rec.601")
colormatrix().colormatrix()

#obviously, replace the first line with the appropriate sourcing function for your footage

Now when I load the script into MeGUI, it says "Can't convert if width isn't mod2."

I apologize to any script writers out there, but I'm new to this whole thing, what does that mean? What do I have to do to get it to work?

##### Share on other sites

The YV12 format requires your video width / height to be divisible by 2.

That's why your getting a error message.

Also looking at the video colors you just seem to want to convert the NTSC colors to PAL.

ColorMatrix(mode="Rec.709->Rec.601") does this.

You don't need the extra 2 colormatrix().colormatrix() calls.

It will only degrade the quality.

##### Share on other sites
1 minute ago, Goku22 said:

The YV12 format requires your video width / height to be divisible by 2.

That's why your getting a error message.

Okay, so do I just have to put in 1920x1080 or does something else need to be put in there?

2 minutes ago, Goku22 said:

Also looking at the video colors you just seem to want to convert the NTSC colors to PAL.

ColorMatrix(mode="Rec.709->Rec.601") does this.

Actually, I don't want to convert the video to PAL. How do I successfully change the colors without doing this?

##### Share on other sites
10 minutes ago, Arian said:

Okay, so do I just have to put in 1920x1080 or does something else need to be put in there?

Actually, I don't want to convert the video to PAL. How do I successfully change the colors without doing this?

Just make sure that both your horizontal and vertical image dimensions are an even number (i.e. mod 2).  Also, why are you converting to Rec601?  By HD specifications, all high def material should be Rec709 or else you're going to have unwanted color shifting when the media device decodes the image.  The tweak command is already shifting the colors and should be your main adjustment knob.

Posted (edited)

Edited by Goku22

##### Share on other sites
1 minute ago, SaurusX said:

Just make sure that both your horizontal and vertical image dimensions are an even number (i.e. mod 2).

Can you give me an example so I know how to write it properly?

2 minutes ago, SaurusX said:

Also, why are you converting to Rec601?  By HD specifications, all high def material should be Rec709 or else you're going to have unwanted color shifting when the media device decodes the image.  The tweak command is already shifting the colors and should be your main adjustment knob.

It was not at all by design. It was given to me this way. Needless to say, I regret trusting the person who gave this to me.

##### Share on other sites

If you're decoding a blu-ray file directly then it should already be 1920x1080, so I'm not sure how it's getting resized in your script.  What about using lsmash as the frame server?

##### Share on other sites

Wait. You paid for this? It's just 5 lines calling for various freely available filters.... Heck most of my avisynth+ scripts range from 15 to 500+ lines, and I certainly wouldn't pay someone to write it.

Is there a specific reason you wish for the video to look like the bottom image? Generally messing with hue, contrast, and brightness isn't very ideal as you typically run into an issue with crushed blacks, overly bright scenes or overly dark scenes looking poorly, etc.

In any case, you can read up more about the Tweak() filter here: http://avisynth.nl/index.php/Tweak

Lowering sat and contrast, while upping brightness slightly should get you the results you're looking for. If you need a bit of help adding this, let me know.

I'd recommend tossing pretty much the entirety of the script though and starting over. No need for ColorMatrix or ConvertToYV12 as it'll already be what you need.

As for the mod2 issue, you just need to resize back to a resolution divisible by 2. Though mod8/mod16 is better. 1920x1080 fills this position. I wonder why it's throwing that error considering none of your script you've shown is calling towards cropping or resizing. Unless you're not showing the full script?

Does the source have any halos, banding, aliasing, or noise/grain concerns?

Do you want to encode in 8-bit or 10-bit?

The next time you need an avisynth script, don't go pay for it, come to me.

• 1
• 1

##### Share on other sites
1 hour ago, Koby said:

Wait. You paid for this? It's just 5 lines calling for various freely available filters.... Heck most of my avisynth+ scripts range from 15 to 500+ lines, and I certainly wouldn't pay someone to write it.

I realized that pretty soon after I got it, I'd been tricked. I tried to call for my money back, but that's another story.

1 hour ago, Koby said:

Is there a specific reason you wish for the video to look like the bottom image? Generally messing with hue, contrast, and brightness isn't very ideal as you typically run into an issue with crushed blacks, overly bright scenes or overly dark scenes looking poorly, etc.

But if TL;DR, here's the jist of it:

Spoiler

Cinedigm’s Blu-ray plays very smoothly and would be fantastic if not for one glaring problem: the colors look way off. The reds in the picture aren’t red enough while the greens are much too green. The amount of blue seems to be okay. At first, I thought my computer wasn’t correctly calibrated to play BDs, but Cinedigm’s Bonds Beyond Time BD doesn’t suffer any color problems during playback. So what’s the deal here?

All 49 episodes of season 1 are now also available for download on several platforms, including Amazon, Google Play Movies & TV, iTunes, Microsoft Movies & TV, PlayStation Video, and VUDU. The HD download-to-own episodes are free of the color problems seen on the BDs.

And if you look at the screenshots she posted, you can clearly see where it all went wrong with the Blu-ray. So I'm actually looking to revert the video back to its original colors.

1 hour ago, Koby said:

In any case, you can read up more about the Tweak() filter here: http://avisynth.nl/index.php/Tweak

Lowering sat and contrast, while upping brightness slightly should get you the results you're looking for. If you need a bit of help adding this, let me know.

The article you linked me is empty. I could certainly use your help adding this stuff manually, at least for the first time. Maybe we can setup a tutoring session.

1 hour ago, Koby said:

I'd recommend tossing pretty much the entirety of the script though and starting over. No need for ColorMatrix or ConvertToYV12 as it'll already be what you need.

Well, that stinks. So the Tweak tool will be able to do all of this?

1 hour ago, Koby said:

As for the mod2 issue, you just need to resize back to a resolution divisible by 2. Though mod8/mod16 is better. 1920x1080 fills this position. I wonder why it's throwing that error considering none of your script you've shown is calling towards cropping or resizing. Unless you're not showing the full script?

I really don't know. I just loaded his script into my project.

1 hour ago, Koby said:

Does the source have any halos, banding, aliasing, or noise/grain concerns?

Not to my knowledge. As ravegrl said, the quality, outside of the color issues is pretty solid. If I can restore the original colors, it'll perfect.

1 hour ago, Koby said:

Do you want to encode in 8-bit or 10-bit? ﻿

That's a really good question. I guess 8-bit to be consistent with the rest of my sources.

1 hour ago, Koby said:

The next time you need an avisynth script, don't go pay for it, come to me. ﻿

Aww, you're so sweet. Again, if we can can setup a Discord chat or something so we can figure it out in real time, that'd be great.

##### Share on other sites
1 hour ago, Arian said:

Well, that stinks. So the Tweak tool will be able to do all of this?

I checked and it is possible to get the desired result using ColorMatrix, but I can't say if it is the best way to do it.

By default it uses "Rec.709->Rec.601" mode (see documentation), so it does not need to be specified and 2 calls of the function should get the colors as in bottom picture.

1 hour ago, Arian said:

I really don't know. I just loaded his script into my project.

The example uses imagesource, which will not work with m2ts file, so you will have to provide some additional information about which media file filter you are using.

Something like

LWLibavVideoSource("path\to\file\00000.m2ts")
ColorMatrix().ColorMatrix()

could do the trick (links to filters can be found in http://avisynth.nl/index.php/External_filters)

##### Share on other sites

@Hark0n, that is something I didn't consider.  The blu-ray authoring process might have been flawed and the incorrect color matrix used.  It's not the first time that's happened.  It's very tricky to determine what the colors should be unless you're sure you have a correct reference.  In this case, I guess @Arian does.

##### Share on other sites

Pro tip (for everyone else) - please don't buy scripts. They are nothing more than a scam. It's not like they are inventing the filter to do this magic for you. Some developers might ask for a donation,  which is fair enough. As for the end user,  asking and receiving advice is always free.

• 1

##### Share on other sites
On 6/7/2018 at 4:16 PM, Arian said:

setup a Discord chat

you do realize kametsu has a discord right? if you want to chat in private, just right click the user and hit message.

##### Share on other sites

Why not use colormatrix? I think it would be difficult to do this with some kind of tweak, and what would be the final difference between both, colormatrix generates some problem that tweak would not have?

Edited by Karyuuni

## Create an account

Register a new account