Log in

View Full Version : MeGUI + DGDecodeNV: Resize & Crop


Shevek
5th August 2010, 16:16
I am using MeGUI with DGDecodeNV to encode 1080p source to 720p.

Before I got my Nvidia card and DGDecodeNV I would use the Auto Crop and Suggest Resolution functions in the AviSynth script creator.

An example Auto Crop gives a 22 top crop and 20 bottom crop and Suggest Resolution gives me a 1280 x 688 final output.

I want to use the Nvidia Resize function to offload this effort onto the GPU so have been doing this:

Resize to 1280 x 720 using Nvidia Resizer and set the crop as (rounded to nearest even):

Top: 720 / 1080 * 22 = 14
Bottom: 720 / 1080 * 20 = 14

This will result in a final output size of 1280 x 692 (which is almost exactly 1.85:1)

Is this the correct way to do it?

Example script:

LoadPlugin("C:\Program Files\MeGUI\tools\dgindexnv\DGDecodeNV.dll")
DGSource("H:\Video.dgi",fieldop=0, resize_w=1280, resize_h=720)
crop( 0, 14, 0, -14)

Shevek
5th August 2010, 16:26
Another Example:

Auto Crop and Suggest Resolution gives me 140 top and bottom crop and 1280x528 output

Using Nvidia Resizer to 1280x720 and my crop calculations (720 / 1080 * 140):

94 top and bottom crop and 1280x532 output (2.4:1)

Sample Script:

LoadPlugin("C:\Program Files\MeGUI\tools\dgindexnv\DGDecodeNV.dll")
DGSource("H:\Video2.dgi",fieldop=0, resize_w=1280, resize_h=720)
crop( 0, 94, 0, -94)

Shevek
16th August 2010, 11:16
I found a better way to do it:

Load the dgi into AVS Script Creator and set the resize using NVidia Resizer

Save this as first AVS file

Load the first AVS file into AVS Script Creator and do the crop etc

Save this as second AVS file

Encode using the second one!

Simples :)

Sample scripts:

Resize script (Video3_Resize.avs):

LoadPlugin("C:\Program Files\MeGUI\tools\dgindexnv\DGDecodeNV.dll")
DGSource("H:\Video3.dgi",fieldop=0, resize_w=1280, resize_h=720)

Crop script (Video3_Crop.avs):

Import("H:\Video3_Resize.avs")
crop( 0, 88, 0, -88)

J_Darnley
16th August 2010, 11:38
I found a better way to do it:

Load the dgi into AVS Script Creator and set the resize using NVidia Resizer

Save this as first AVS file

Load the first AVS file into AVS Script Creator and do the crop etc

Save this as second AVS file

Encode using the second one!

Simples :)

Simple? This is clearly a more complicated way of doing it

Shevek
16th August 2010, 11:40
Simple? This is clearly a more complicated way of doing it

how so?

this way there is no need to calculate the crops based on the original and resized height

stax76
16th August 2010, 12:19
Are you sure it's a good idea to crop after resize? If MeGUI don't support Cuda cropping then you can use the Crop dialog in DGIndexNV or edit the dgi file.

StaxRip would just ask if crop values should be moved to the dgi file, you would:


Open crop dialog and crop
When closing the crop dialog you will be asked if crop values should be moved to the dgi file for Cuda cropping
You would resize using the slider, this will enable a resize filter which will be removed later
Double click the source filter and change the resize parameters in code, alternatively right click the source filter and choose a source filter profile that includes resize parameters, there are some default source filter profiles, 'Advanced | DGSource 720p' for instance
Disable or remove the resize filter that was enabled previously

7ekno
16th August 2010, 12:27
Crop when indexing, Resize in source filter = both done on GPU ;)

Tek

Shevek
16th August 2010, 12:29
is it possible to crop in DGDecNV then?

how do I do that?

Guest
16th August 2010, 12:31
is it possible to crop in DGDecNV then? Use DGIndexNV's Video/Cropping Filter.

Don't you read documentation?

Shevek
16th August 2010, 12:35
Use DGIndexNV's Video/Cropping Filter.

Don't you read documentation?

I had read DGDecodeNVManual.html but not DGIndexNVManual.html as I was letting MeGUI do the Indexing - I now know better

Thanks all for your input everyone, sorry to have troubled you!

Shevek
16th August 2010, 13:23
OMG :eek::eek::eek:

That's just doubled my FPS

Is there a face palm smiley anywhere?

J_Darnley
16th August 2010, 17:47
how so?

this way there is no need to calculate the crops based on the original and resized height

Because you have two scripts and I still don't get what you're doing. One crops visually based on the pixels one wants to remove.

Shevek
16th August 2010, 21:08
Because you have two scripts and I still don't get what you're doing. One crops visually based on the pixels one wants to remove.

Its all about the order that the AVS script creator is working - Crop then Resize versus Resize then Crop.

When using NVidia Resizer the script creator doesn't know about it so it crops and previews based on the original height - so you end up with an over-crop.

However, I have now discovered the crop functionality in DGIndexNV (see previous posts in this thread) so the point is now moot - I was doing it wrong whichever way you look at it :)

J_Darnley
17th August 2010, 00:19
How does that work? The source plugin creates a clip in avisynth at the size you get it to scale to, the crop filter then works on this clip with the options you give it from looking at it. You should never see the original size.

Lyle_JP
17th August 2010, 01:57
You may find the NVidia re-sizer a bit too soft for your tastes after using it a bit. I did, and I'm back to using Spline64.

Shevek
17th August 2010, 07:36
How does that work? The source plugin creates a clip in avisynth at the size you get it to scale to, the crop filter then works on this clip with the options you give it from looking at it. You should never see the original size.

Thats not how it is working for me...

This is the behaviour that I was seeing:-

My original workflow:

Index a 1080p source using MeGUI DGIndex, load into AVS Script creator, auto crop (say 132 top and bottom for a 2.35:1 OAR), resize to 1280 wide and let Suggest Resolution give me the height.

So I have a Crop (script) to 1920x816 then Resize (script) to 1280x544.

When I first started using DGDecNV I was following the same flow but using the NVidia Resizer. The resize now happens on the source so before the crop.

But the Auto Crop function still acts on the 1080p size, not the resized 720p so it still gives 132 top and bottom - thats the important bit and the cause of this post originally.

I end up with a Resize to 1280x720 then Crop to 1280x456 - an over crop of 44px top and bottom

Hence I was manually calculating the crop as Auto Crop * Resized Height / Original Height = 132 * 720 / 1080 = 88

This then gives the correct output of 1280x544 and is Resize (source) then Crop (script)

I then posted yesterday that I had discovered if you do a resize only script and save that, then reload that script into the creator THEN it sees the resized source correctly and Auto Crop indeed gives 88 top and bottom - and is still Resize (source) then Crop (script)

And then, everyone kindly pointed me in the direction of the Crop function in DGIndexNV and I'm now back to Crop (index) then Resize (source) again.

Does that all make sense? As I said, I was doing it wrong either way before :rolleyes: :)

Zathor
17th August 2010, 11:42
The crop functionality of DGIndexNV is not implemented yet in MeGUI therefore if using it manually it may lead to problems. If you want to have a GUI for this task I suggest using Staxrip. I do not know for sure but I think Stax has this feature implemented.

It will be implemented in MeGUI, too. But at the moment it is not on the top of the list.

Shevek
17th August 2010, 11:50
The crop functionality of DGIndexNV is not implemented yet in MeGUI therefore if using it manually it may lead to problems. If you want to have a GUI for this task I suggest using Staxrip. I do not know for sure but I think Stax has this feature implemented.

It will be implemented in MeGUI, too. But at the moment it is not on the top of the list.

Excellent! I'm happy to index in DGIndexNV for now... Maybe I'll give StaxRip a try

qupfer
14th December 2011, 09:17
Sorry for restart this topic, but i think my question is too unimportend for a new one :D

Is it normal, that then in crop directly in DGDecodeNV that megui can't calculate the correct high for a resize?

I'm not sure you understood my "language" so i will try to explain what i mean ;)

I start the DGDecodeNV Tool directly and add a 1080P File to it. Then i configure the cropping Filter and Crop some lines at the top and bottom and create the project. The "new" Resolution is 1920x800.
Now, i load the *.dgi File in Megui AVS Script Creator. If i activate Resize and set the width to 1280 it Suggest a high of 720...and this is a bit to high.
Anybody know, what i do wrong or is this "normal" and i have to calculate the new size manually?

Shevek
14th December 2011, 13:24
Sorry for restart this topic, but i think my question is too unimportend for a new one :D

Is it normal, that then in crop directly in DGDecodeNV that megui can't calculate the correct high for a resize?

I'm not sure you understood my "language" so i will try to explain what i mean ;)

I start the DGDecodeNV Tool directly and add a 1080P File to it. Then i configure the cropping Filter and Crop some lines at the top and bottom and create the project. The "new" Resolution is 1920x800.
Now, i load the *.dgi File in Megui AVS Script Creator. If i activate Resize and set the width to 1280 it Suggest a high of 720...and this is a bit to high.
Anybody know, what i do wrong or is this "normal" and i have to calculate the new size manually?

This is something I also do and it took me a while to figure out how to do it!

The AVS script Creator will automatically detect the original Aspect Ratio of the 1920x1080 video (i.e. 16:9). You need to manually calculate the new aspect ratio that you cropped to in DGIndex and put that in the Custom Ratio from the drop down.

e.g. you cropped 1920x1080 to 1920x800 in DGIndex

1920 / 800 = 2.4

Put 2.4 in custom aspect ratio and then AVS Script creator will correctly calculate the correct height for your resize - 1280x528

HTH