Log in

View Full Version : A better script to use?


Amateur
9th November 2011, 23:30
Trying to encode a show. I have a pretty decent looking output so far but the compression doesn't seem to be very good. Wondering if anyone can give me a better script that gives same visual quality but more compression


here is my current script
LoadPlugin("C:\Program Files (x86)\MeGUI\tools\dgindex\DGDecode.dll"
DGDecode_mpeg2source("F:\earthworm\1\VTS_02_1.d2v", cpu=4, info=3)
LoadPlugin("C:\Program Files (x86)\MeGUI\tools\avisynth_plugin\ColorMatrix.dll"
ColorMatrix(hints=true, threads=0)
Load_Stdcall_Plugin("C:\Program Files (x86)\MeGUI\tools\yadif\yadif.dll"

Yadif(Mode=1)
SRestore()

dfmderainbow()

removegrain(mode=1)

crop( 12, 2, -10, -4)
LanczosResize(640,480)

dfttest()
FastLineDarken(strength=150,luma_cap=225,thinning=0)
lsfmod(strength=150)

maa()

source
http://img20.imageshack.us/img20/8868/30094147.png

result
http://img148.imageshack.us/img148/5849/27302767.png


here is a sample of the source (http://anonym.to/?http://www.mediafire.com/?9764g19v33ob1go)

my script only reduced the image from 429kb to 407kb. hoping for better

Asmodian
9th November 2011, 23:54
All the sharpening hurts compressibility.

What are you compressing to and how are you measuring compressibility?

That script looks to be designed to make the image look better and any improvements to compressibility are a side benefit of the denoising.

What are you trying to do? Just increase the crf value if you want a smaller video. :p

Amateur
10th November 2011, 00:34
Maybe I'm misunderstanding what exactly compressibility is. I thought compressibility was how large the resulting file size is of each frame compared to the original? (429 compressed by 5% is 407 so not much compressibility???) If the resulting image is nearly as large as the source, I would have to use much more bitrate for it to look as good. So if I increase the CRF, the video will be smaller file size but will also look worse. I want it to look as good as it can but also be a smaller size if possible.

also, what I forgot to ask in my first post is if I'm using yadif and srestore properly. The video source is a DVD from Australia so I'm assuming that's PAL. I live in United States so I'm trying to get 24fps. Did I accomplish this correctly given the source?

manono
10th November 2011, 10:34
Did I accomplish this correctly given the source?
Yes, it's a field-blended PAL DVD and using a bobber followed by SRestore to return it to 23.976 is the right way to handle it.

I think you did a good job on improving it. And as Asmodian said, because it looks sharper, it's also less compressible and negates some of the bitrate savings you got from taking the interlaced source and making it progressive and at the same time lowering the framerate a little bit.

If you want to make it more compressible, you could use QTGMC as the bobber. But it's real slow.

J_Darnley
10th November 2011, 14:33
Maybe I'm misunderstanding what exactly compressibility is. I thought compressibility was how large the resulting file size is of each frame compared to the original? (429 compressed by 5% is 407 so not much compressibility???) If the resulting image is nearly as large as the source, I would have to use much more bitrate for it to look as good. So if I increase the CRF, the video will be smaller file size but will also look worse. I want it to look as good as it can but also be a smaller size if possible.
You are quite right. How ever, this is one frame in which temporal information cannot be "measured". Removing temporal noise does aid compression still more. Another thing, you've used PNG to compress here (which is right for showing us images) but you cannot use it as any benchmark for how a frequency-transform format would compress the image. PNG is great with large areas of single colours, sharp lines and few colours (it is also lossless). Where as JPEG (and all common video formats) do better on soft lines, smooth transitions and motions.

If you want to test how x264 would perform, add a trim at the end of the script and then encode that short sample. Perhaps just the scene you've shown here.

But don't try and filter it to minimise file size (that's easy, bilinear resize to 16x16 or blur blur blur). Use filters to maximise visual quality then encode it as best you can to retain that.

Asmodian
10th November 2011, 20:59
Use filters to maximise visual quality then encode it as best you can to retain that.

While I agree with this in general there can be some options that look better out of avisynth but worse after compression with x264. I think sharpening runs into this sometimes, if you are bitrate limited it is sometimes better to reduce the strength of sharpening rather than have x264 drop details. This is all very subjective though. ;)

Amateur
11th November 2011, 23:51
After doing a test encode I noticed I had a similar problem that I had with some Garfield rips where the lines would look like they were crawling around (not dot crawl...just the black lines would have this effect). So I used a lot of my same script that I did with Garfield and my new result looks like this

http://img94.imageshack.us/img94/2819/61797977.png


And here is the script
Load_Stdcall_Plugin("C:\Program Files (x86)\MeGUI\tools\yadif\yadif.dll")

Yadif(mode=1)
SRestore()

dfmderainbow()

removegrain(mode=1)

crop( 12, 2, -10, -4)
LanczosResize(640,480)

fft3dfilter(bw=16, bh=16, ow=8, oh=8, bt=1, sigma=2, plane=0)
dfttest()

saa()
FastLineDarken()

Spline36Resize(1280,960)
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=10,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(4,0,-4,0)
FastLineDarken()
Spline36Resize(640,480)

lsfmod(strength=150)

maa()

any suggestions on better filters or is what I have good? This image is 370kb so it is a good deal smaller now (I know someone above mentioned that's not the only thing because it's just one frame).

Asmodian
12th November 2011, 02:28
This image is 370kb so it is a good deal smaller now (I know someone above mentioned that's not the only thing because it's just one frame).

At least use jpeg if you are going to use one image to gauge compressibility!

Too much warpsharp for me...

Amateur
13th November 2011, 02:24
I'm trying to upload the JPGs but I'm getting an error saying it's not a valid image file. The files are all under 50KBs so I don't know what the problem is.

Here are imageshack links though

Before (47.3kb)
http://img521.imageshack.us/img521/552/beforeki.jpg

After (46.2kb)
http://img14.imageshack.us/img14/4831/afterqp.jpg

The reason for all of the warp sharpening is because of the dancing lines like I described above. They appear static-like and it seemed the only way to get rid of it was with saa, line darkening, warp sharpening, more line darkening, and more warp sharpening.



Also, I see this a little bit throughout the episode
http://img198.imageshack.us/img198/2223/isthisfixable.jpg

Is this something that can be cured? Or no because of the source? Do I have to make this video 24fps using SRestore in order to view through my computer on my TV or can I just get rid of the interlacing and watch in (is it 25fps)?

manono
13th November 2011, 07:16
You could just deinterlace it, but that alone won't get rid of the blending. You need SRestore for that. You could use a better bobber, QTGMC, for example, as I suggested before. However, a lot of those artifacts are in your source and will always be there.

Amateur
13th November 2011, 17:55
Hmmm...tried qtgmc(preset="medium") but it's still nearly the same as above. I guess it looks like I'll be stuck with it. Oh well.

Other than the occasional weird looking frame, are my other filters good choices and implemented properly for a nice-looking result? No one has any different filters that they suggest? (other than QTGMC which I'm using now instead of Yadif).

manono
13th November 2011, 20:00
If you're asking me, I don't know as I don't mess with animations much anymore. Those more knowledgeable, such as Asmodian, can make suggestions. And he's already given one opinion. Anyway, what matters is how it looks to you, not us.

Amateur
13th November 2011, 20:20
no not you specifically, just anyone who may have tinkered with the provided clip. I never know how to adjust dfttest so I didn't know if that's a filter someone else uses they would have a suggesting for a setting that would work better with my clip. or maybe a different filter all together.

Thanks for all the help I've gotten though.

naoan
13th November 2011, 20:52
Umm how about something like this? http://www.mediafire.com/?vy57eg16tz118zq

Asmodian
14th November 2011, 05:45
Well it is very slow and I didn't optimize much but I got good results on your sample with:

QTGMC(Preset="Slower", MatchPreset="Slow", TR2=1, NoiseProcess=1, Sigma=1.5, Rep2=1, Sharpness=1.2, SLMode=1 )
SRestore(mode=-2, speed=12)
FastLineDarken()
Spline36Resize(640,480)


The SRestore settings seem to help with reducing those artifacts you were seeing.

I haven't optimized for speed or quality, just tuned until it looked ok to me. I think I personally dislike the look of warpsharp more than some so I am not sure you would prefer my version. I still see a couple errors/artifacts, maybe playing with SRestore or QTGMC settings would help. I am sure the speed could be improved. This is a nasty source, I think trying to get it perfect will make it look over filtered.

EDIT: you can add more sharpening if you want, of course. Warpsharp will actually improve the compressability unlike other sharpeners.

Amateur
15th November 2011, 02:09
hahaha...well maybe my computer isn't quite up to speed or there are some settings I can adjust but I tried to use your qtgmc and srestore specs in my script and after twenty minutes, it still hasn't begun to encode a single frame. seems like I can't use this unless I want to encode one episode per month?

edit: if I use ONLY your script above, the preview window will actually load. Then even if I add back some of the fast filters like removegrain, it slows down tremendously. Looks like I won't be able to combine your settings with my script without removing a lot of my script. I'll have to see how your attempt looks. Thanks

Asmodian
15th November 2011, 03:34
You can probably speed up QTGMC a lot, I didn't try faster presests (I just copied it from a different script).

I could run it with an added lsfmod(strength=150) single threaded at ~2.5fps. i7 920 @ 3.2Ghz