Log in

View Full Version : Resizing a 1080p video to 720p


Tschizzey
19th January 2023, 00:31
Hello!

I would like to downscale a video to 720p using MeGUI One-Click encoder.
Obviously I'm doing something wrong, because I'm getting error messages.

Here are my settings:

https://i.kek.sh/M9vBxqaikd6.png

https://i.kek.sh/axIh3RRTfNs.png

https://i.kek.sh/A48f6I5lkeN.png


What should I change?
What avisynth command should I use?

tebasuna51
19th January 2023, 11:43
Compress (zip or 7z) and attach the log (...\MeGUI\logs\*.log) file, we must know your install settings, the errors and file properties.

Tschizzey
19th January 2023, 21:19
Ok, I'll post them during the weekend, thanks.

Tschizzey
22nd January 2023, 20:19
Well I didn't change a single thing but it worked now. I don't know what was the problem.

Here is the log.

Are these settings OK? Is there any nonsense?

18297

tebasuna51
24th January 2023, 02:21
All seems fine now.

Tschizzey
24th January 2023, 12:44
Thanks!

Forteen88
25th January 2023, 11:04
Isn't it better to use z.lib resizer?

EDIT: Saiclabs wrote:
There is no reason to use the internal resizers instead of z_xxxResizers because:
- z_ works in 16-bit depth when input and output is 8-bit. Internal resizers work in 8-bit when input is 8-bit;
- z_ doesn't introduce any chroma shift like the internal resizers.

There is no reason to use the internal color conversions because they work in the input bit depth. If source is 8-bit yuv->rgb is done in 8-bit. On the other side z_ is doing any color conversion from any bit depth in float.

hello_hello
25th January 2023, 19:48
The screenshot of Tschizzey's Avisynth template bothers me because by default it looks like this:

<input>
<deinterlace>
<crop>
<resize>
<denoise>

You can change the order, remove lines or add other stuff, but as the resizing has been manually added and <resize> is still present...
The Avisynth script from the log file.

---[NoImage] LoadPlugin("G:\Programs\MeGUI\tools\dgindexnv\DGDecodeNV.dll")
---[NoImage] DGSource("C:\Users\Bernkastel\Downloads\3ckeukdb.pcc\test.dgi")
---[NoImage] ConvertBits(8)
---[NoImage] #crop
---[NoImage] Spline64Resize(1280,720) # Spline64 (Sharp)
---[NoImage] AssumeFPS("ntsc_film")
---[NoImage] Spline64Resize(1280,720)

Based on the GUI settings in the third screenshot it's not going to do any harm as long as the source is 16:9, but if it's not....

Isn't it better to use z.lib resizer?

Probably, but MeGUI only supports Avisynth's native resizers, however...

For anyone who does want to use AVSResize with MeGUI they can import the script below or put it in the Avisynth plugins folder for auto-loading. It has to be in the plugins folder of an installed version of Avisynth and not MeGUI's portable version for auto-loading, but MeGUI can still use the portable version.

Functions for resizing with AVSResize:
z_MeGUI.avsi (https://files.videohelp.com/u/210984/z_MeGUI.avsi)
And while I'm at it, functions for resizing with the HBD version of Resize8 (https://forum.doom9.org/showthread.php?t=183057):
R8MeGUI.avsi (https://files.videohelp.com/u/210984/R8MeGUI.avsi)

For AVSResize, create an Avisynth template for MeGUI like the one below, replacing the <resize> line.

<input>
<deinterlace>
<crop>
Eval("z_ConvertFormat("+z_MeGUI(Last,"<resize>")+",resample_filter="+"""KernelMeGUI("<resize>")"""+")")
<denoise>

It'll look like this in the script creator when MeGUI isn't resizing.

Eval("z_ConvertFormat("+z_MeGUI(Last,"#resize")+",resample_filter="+"""KernelMeGUI("#resize")"""+")")

It's gets even sillier when resizing is enabled, but it will use the resizing kernel specified in MeGUI's Avisynth Configuration or in the Script Creator's GUI.

Eval("z_ConvertFormat("+z_MeGUI(Last,"Spline64Resize(1280,720) # Spline64 (Sharp)")+",resample_filter="+"""KernelMeGUI("Spline64Resize(1280,720) # Spline64 (Sharp)")"""+")")

As resizers use different names for arguments and MeGUI changes "a" & "b" for BicubicResize, the functions won't work with another resizer. At least not when BicubicResize is selected.

A Resize8 template:

Eval("Resize8("+R8MeGUI(Last,"<resize>")+",kernel="+"""ResizerMeGUI("<resize>")"""+")")

Forteen88
25th January 2023, 21:30
Functions for resizing with AVSResize...
Thanks.

Tschizzey
27th January 2023, 21:30
The screenshot of Tschizzey's Avisynth template bothers me because by default it looks like this:

<input>
<deinterlace>
<crop>
<resize>
<denoise>

You can change the order, remove lines or add other stuff, but as the resizing has been manually added and <resize> is still present...
The Avisynth script from the log file.

---[NoImage] LoadPlugin("G:\Programs\MeGUI\tools\dgindexnv\DGDecodeNV.dll")
---[NoImage] DGSource("C:\Users\Bernkastel\Downloads\3ckeukdb.pcc\test.dgi")
---[NoImage] ConvertBits(8)
---[NoImage] #crop
---[NoImage] Spline64Resize(1280,720) # Spline64 (Sharp)
---[NoImage] AssumeFPS("ntsc_film")
---[NoImage] Spline64Resize(1280,720)

Based on the GUI settings in the third screenshot it's not going to do any harm as long as the source is 16:9, but if it's not....


Should I check this box and then add the "Spline64Resize(1280,720)" line manually? Will it work?

https://i.kek.sh/aBKhB4fsJIx.png

hello_hello
30th January 2023, 11:48
Should I check this box and then add the "Spline64Resize(1280,720)" line manually? Will it work?

https://i.kek.sh/aBKhB4fsJIx.png

Yes, but you shouldn't need to manually add the "Spline64Resize(1280,720)" line to the template, as you can see in your log file that MeGUI is adding it for you.

If the source video is 16:9, manually adding 16:9 resizing works fine, but if you happen to have a source file that's not 16:9, the manually added line will resize it incorrectly.

If this is the template

<input>
<crop>
<resize>

and the source isn't 16:9 (2:1 for example), MeGUI would add the following to the script, whereas your fixed resizing would stretch the height. If the source is 16:9, MeGUI will resize to 1280x720 instead, assuming cropping is disabled.

<input>
<crop>
Spline64Resize(1280,640) # Spline64 (Sharp)

You also have the "Use Nvidia crop and resize if possible" option checked, which would mean your chosen resizer wouldn't be used (I assume) but there's no Nvidia resizing in your script (you'll see Nvidia's resizing added to the script in the log file if it's being used).

FYI, if you do want the output to always be 1280x720, regardless of the source aspect ratio, try manually adding this resizing to the template instead while removing the <resize> line to prevent MeGUI adding it's resizing.

<input>
<crop>
CropResize(1280,720, Resizer="Spline64Resize")

CropResize (https://forum.doom9.org/showthread.php?t=176667) doesn't stretch the picture if the source and output aspect ratios don't match, as normal resizing would. By default it crops to prevent aspect error if necessary, so for 1280x720 output dimensions, any non 16:9 source will be cropped to 16:9 before being resized to 1280x720. It can crop a lot of picture though, depending on the source dimensions, so alternatively you can add borders instead.

CropResize(1280,720, Resizer="Spline64Resize", Borders=true)

Just a thought if you do need 1280x720 for some reason....

I also noticed you have the "color correct" option checked. It's not likely to cause an issue (it wasn't used according to your log file) as it appears to only support mpeg2 while indexing with DGIndex, but it was originally intended to ensure standard definition DVD encodes have SD colorimetry, so if you have a HD mpeg2 source and don't downscale to SD, the color correction could be applied unnecessarily.

When it's being added to the script by MeGUI is looks something like this:

DGDecode_mpeg2source("D:\video.d2v", info=3)
LoadPlugin("D:\Some Folder\ColorMatrix.dll")
ColorMatrix(hints=true, threads=0)

By default, ColorMatrix aims for the rec.601 SD colorimetry, so it's probably a good idea not to enable automatic color correction for HD encodes, just in case.....

Tschizzey
30th January 2023, 16:35
Wow, so much helpful information, thank you very much!