Log in

View Full Version : DV video resize


mäger
23rd October 2015, 22:39
hi

i'm trying to resize a DV video(720x576) to double of its size, but it also has a 10 pixel black bar which i need to crop off first, so i was wondering if i should also set a custom resolution for it, to not lose any quality?
i'm also cropping off 72 pixels from the top and bottom to make it look nice and widescreen (16:9?).

but what i was thinking is that maybe the extra 10 pixel cropping from 1 side somehow lowers the quality a bit? (because i dont crop other sides in equal proportion? and what would be the proportion then...)

i'm using this script atm:
Load_Stdcall_Plugin("X:\megui\tools\avisynth_plugin\yadif.dll")
Yadif(mode=1, order=0)
crop(10, 72, 0, -72)
Spline64Resize(1280,720)


*edit
although now i noticed that it sets the fps to 50 for some reason? (but there is a line "AssumeFPS(25,1)")

hello_hello
24th October 2015, 00:05
The unequal cropping won't effect quality, but according to MeGUI's aspect error calculation, the cropping should be crop(10, 70, 0, -70) for minimum aspect error when resizing to 16:9 (or increase the side cropping).

In theory the maximum quality method would be to encode it at the original resolution after cropping (ie 710x436) and use anamorphic encoding to set the correct aspect ratio.
Next would be to leave the height untouched and resize the width for square pixel dimensions and the correct aspect ratio (ie 774x436). I do it that way using Spline36Resize for DVDs and it tends to have a slight sharpening effect, but mainly because a couple of players in this house ignore the aspect ratio in MKV/MP4 so resizing to square pixels means it'll always display correctly. Third best would be to resize both width and height. I'm not sure there's any quality advantage to upscaling to 720p before encoding, unless you're using a player/TV that doesn't upscale well.

If quality is important, you might want to try de-interlacing with QTGMC (http://forum.doom9.org/showthread.php?t=156028) rather than Yadif. It might take a bit of fiddling around to get it working the first time and it's fairly slow, but it's much better.

Someone may be able to confirm it, but I assume PAL DV would use standard definition colorimetry. Therefore if you do upscale to 720p it'd probably be an idea to convert the colours to high definition colorimetry. You can do it using the colormatrix plugin. It's in the "MeGUI\tools\avisynth_plugin" folder. Load the dll and add the following to the script, somewhere after the de-interlacing.

ColorMatrix(mode="Rec.601->Rec.709", clamp=0)

And if you do that, it might also be an idea to set the Color Matrix option to bt709 in MeGUI's x264 encoder configuration (under the Misc tab). That doesn't effect the way the video is encoded, it just tells the encoder to add the information to the video stream. If you don't upscale or convert the colours, bt470bg is the one to use for PAL.

mäger
24th October 2015, 01:05
ok thanks.

probably have to look into the qtgmc, but colormatrix already gave this error while trying to load it...: Not An Avisynth 2 C Plugin

hello_hello
24th October 2015, 01:32
I kind of remember a similar problem with another plugin at one stage. MeGUI tried to incorrectly load it as a C plugin, depending on the version of Avisynth being used, or maybe it depended on the Windows version too. It's probably a MeGUI bug. It's being loaded correctly via LoadPlugin for me when using both the installed Avisynth 2.6.0.6 and MeGUI's portable Avisynth. I'm running XP. Are you using an old MeGUI version?

If you have Avisynth installed, just copy colormatrix.dll to the installed Avisynth plugins folder and it should auto-load when Avisynth runs. If not, you can load it by manually adding it to the script. ie:

LoadPlugin("C:\Program Files\MeGUI\tools\avisynth_plugin\ColorMatrix.dll")
ColorMatrix(mode="Rec.709->Rec.601", clamp=0)

mäger
24th October 2015, 03:56
ok, i guess i should have tried that myself... i used the Load_Stdcall_Plugin() command like the yadif.dll has... it works without the _Stdcall_ part now.
but which way do the rec numbers go?:p

hello_hello
24th October 2015, 14:29
Sorry, I didn't notice I'd posted them the wrong way around the second time (I copied and pasted from something else). For upscaling:

ColorMatrix(mode="Rec.601->Rec.709", clamp=0)

*edit
although now i noticed that it sets the fps to 50 for some reason? (but there is a line "AssumeFPS(25,1)")

I just saw your question.

yadif(mode=1) de-interlaces to 50fps. Each frame should be unique and motion should look smoother (if every frame is repeated it's probably not interlaced).
Without mode=1 it de-interlaces to 25fps.

If you happen to try QTGMC, it also de-interlaces to 50fps. For a 25fp output you need to remove every second frame when it's done.

QTGMC()
SelectEven()

creaothceann
24th October 2015, 19:02
QTGMC(FPSDivisor=2)