Log in

View Full Version : MPEG1 upscale?


Pages : [1] 2 3

asarian
26th August 2014, 18:38
Hello,

I'm trying to find a good filter to smoothen out an old MPEG1 VCD I want to upscale. Like a blurry jpeg, it has these typical low-res blotches on it.

I was wondering whether someone can recommend a good filter for that kind of stuff. Most of the filters I have usually are meant for material that is already HD(-ish).

Thanks.

vid.user
26th August 2014, 18:43
By up-scaling you will only loose, never gain, why would you want that?

asarian
26th August 2014, 19:15
By up-scaling you will only loose, never gain, why would you want that?

Properly upscaling SD material can often do wonders for how it looks. :) Anyway, the upscaling (Lanczos4Resize) is only the post-process step: it's about getting rid of low-res blotches.

EDIT: I found filters like Blockbuster, but that seems to be doing something else (also useful, btw).

StainlessS
26th August 2014, 20:14
Might want to try nnedi3_rpow2 for upscale, also I would prefer Spline36Resize or Spline64Resize.


nnedi3_rpow2(int rfactor, int nsize, int nns, int qual, bool pscrn, string cshift, int fwidth,
int fheight, float ep0, float ep1, int threads, int opt, int fapprox)


No particular suggestion for the blotches, although temporal / spatio temporal can help if blotches vary frame to frame.
My favorite spacio/temp filter is FF3DFilter. (Favorite spacial only is VagueDenoise).
ExBlend() intended for (NTSC) 3/2 blend removal of eg SD converted for VCD via ReduceBy2.

EDIT: Other deblock filters I have on disk are FunkyDeblock, DeBlock_QED, and SmoothDeblock.
Only used SmoothDeblock which was very good for a particular clip (although slow I think).

creaothceann
26th August 2014, 21:46
Dither might help too.

asarian
27th August 2014, 05:23
Might want to try nnedi3_rpow2 for upscale, also I would prefer Spline36Resize or Spline64Resize.


nnedi3_rpow2(int rfactor, int nsize, int nns, int qual, bool pscrn, string cshift, int fwidth,
int fheight, float ep0, float ep1, int threads, int opt, int fapprox)


No particular suggestion for the blotches, although temporal / spatio temporal can help if blotches vary frame to frame.
My favorite spacio/temp filter is FF3DFilter. (Favorite spacial only is VagueDenoise).
ExBlend() intended for (NTSC) 3/2 blend removal of eg SD converted for VCD via ReduceBy2.

EDIT: Other deblock filters I have on disk are FunkyDeblock, DeBlock_QED, and SmoothDeblock.
Only used SmoothDeblock which was very good for a particular clip (although slow I think).


Thanks! :) I also found some good info on the process at:

How to upscale with Nnedi3? (http://forum.videohelp.com/threads/353535-How-to-upscale-with-Nnedi3)

I always thought Lanczos4Resize was the best, LOL.

Speaking of VCD, 352x288, that doesn't really look like true 4:3 to me (more like 4:3.2727). Should I just upscale to 1440x1080 (4:3) and call it the day?

feisty2
27th August 2014, 05:55
eedi3 is a smooth and high quality upscaler
nnedi3 is way too sharp for crappy clips

feisty2
27th August 2014, 06:01
use this script
http://pastebin.com/Zj4GMDxG

dither_convert_8_to_16 ()
ediresize16 (x,y,kernel_u="bicubic",noring=true,cplace="mpeg1") #x,y is your target resolution
ditherpost (mode=6)

the result is soft and artifacts free

asarian
27th August 2014, 06:21
use this script
http://pastebin.com/Zj4GMDxG

dither_convert_8_to_16 ()
ediresize16 (x,y,kernel_u="bicubic",noring=true,cplace="mpeg1") #x,y is your target resolution
ditherpost (mode=6)

the result is soft and artifacts free

Thank you kindly! :)

asarian
27th August 2014, 06:50
Btw, just to give you guys an idea of how very bad it really is:

https://www.dropbox.com/s/2u3gx0ffv8o7yw9/verybad.jpg?dl=0

LOL.

EDIT: Hmm, direct images to dropbox apparently don't work here.

asarian
27th August 2014, 07:29
use this script
http://pastebin.com/Zj4GMDxG

dither_convert_8_to_16 ()
ediresize16 (x,y,kernel_u="bicubic",noring=true,cplace="mpeg1") #x,y is your target resolution
ditherpost (mode=6)

the result is soft and artifacts free


Odd. I'm getting the following error all the time:

"There is no function named dither_convert_8_to_16"

feisty2
27th August 2014, 07:43
Odd. I'm getting the following error all the time:

"There is no function named dither_convert_8_to_16"

you need dither package

asarian
27th August 2014, 07:56
you need dither package

Doh. :o

Just my luck, though, Dither 1.26.1 download site seems gone now. :(

http://ldesoras.free.fr/src/avs/dither-1.26.1.zip

StainlessS
27th August 2014, 12:32
EDIT: Hmm, direct images to dropbox apparently don't work here.

Try PhotoBucket.com next time, images appear direct on forum post. (EDIT: Immediately)

asarian
27th August 2014, 13:20
you need dither package

Nearly there, I think :) Now I get:

"No function named UnDefined()" in your script, at:

sclip = Default (sclip, UnDefined())

feisty2
27th August 2014, 13:25
Nearly there, I think :) Now I get:

"No function named UnDefined()" in your script, at:

sclip = Default (sclip, UnDefined())

whats your avisynth version, the script requires avs 2.6 or avs+

asarian
27th August 2014, 13:54
whats your avisynth version, the script requires avs 2.6 or avs+

Oops, I'm still on 2.5.8. Is 2.6 downwards compatible? Don't want to ruin my entire setup.

feisty2
27th August 2014, 13:58
Oops, I'm still on 2.5.8. Is 2.6 downwards compatible? Don't want to ruin my entire setup.

2.6 is completely compatible with 2.5.8 scripts and plugins, and there are some new filters can only be called on 2.6 platform

asarian
27th August 2014, 13:59
2.6 is completely compatible with 2.5.8 scripts and plugins, and there are some new filters can only be called on 2.6 platform

Okay. :) Thanks for all your help!

feisty2
27th August 2014, 14:50
Okay. :) Thanks for all your help!

and you need eedi3mod here instead of eedi3
its much faster (at least 4x faster) and can be even faster if set mclip=true in ediresize16
https://www.doom9.org/showthread.php?p=1654880#476

asarian
27th August 2014, 15:40
2.6 is completely compatible with 2.5.8 scripts and plugins, and there are some new filters can only be called on 2.6 platform

Hhm, 2.6 may not be entirely as stable as my good old 2.5.8. After running for a few seconds:

Avisynth error at frame 5:
GetFrameBuffer: Returned a VFB with a 0 data pointer!
size=9596992, max=805306368, used=446743904
I think we have run out of memory folks!

This is not good. :(

feisty2
27th August 2014, 15:49
Hhm, 2.6 may not be entirely as stable as my good old 2.5.8. After running for a few seconds:

Avisynth error at frame 5:
GetFrameBuffer: Returned a VFB with a 0 data pointer!
size=9596992, max=805306368, used=446743904
I think we have run out of memory folks!

This is not good. :(

how large is your ram? I guess the script you are encoding is wicked complex so the ram got french fried
you can add "setmemorymax (512)" at the top of the script

Groucho2004
27th August 2014, 15:58
you can add "setmemorymax (512)" at the top of the script
That's already the default. No need to set that value.

asarian
27th August 2014, 15:58
how large is your ram? I guess the script you are encoding is wicked complex so the ram got french fried
you can add "setmemorymax (512)" at the top of the script

Nah. I have 12G of ram, and the script is very easy:

LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\extra\avss.dll")

SetMemoryMax(768)

SetMTMode(5,4)

DSS2("f:\jobs\video.mpeg").ConvertToYV12()

SetMTMode(3)

QTGMC(InputType=1, Preset="Slow", EdiThreads=2, TR2=3)
MCTemporalDenoise(settings="low", stabilize=true)

crop(0, 2, -2, -2)
Dither_Convert_8_to_16()
ediresize16 (1444, 1080, kernel_u="bicubic", noring=true, cplace="mpeg1")
ditherpost (mode=6)

GradFun3 ()

AddBorders(238, 0, 238, 0)

QTGMC causes the horrible crash. And it's the ediresize16 line that makes the output 100x as slow! (ETA 300 hours). Something is very very wrong.

feisty2
27th August 2014, 16:04
oh my lord, you are calling 3 FREAKING SLOW filters (qtgmc,mctemporaldenoise,ediresize16) altogether within one script, I guess the script exceeds the 4GB ram limit of 32bit program limit, my advice would be, doing them step by step, first qtgmc, encode it to a fast lossless format, then load the encoded file then call mctemporaldenoise, encode again, then ediresize16

Groucho2004
27th August 2014, 16:06
You're running out of memory. Reduce the number of threads.
Check how much memory your script needs with this (http://forum.doom9.org/showthread.php?t=165528) tool.

If you're on a 64 Bit OS, maximize available memory for the frame serving and encoding by using a pipe tool that has the "LARGEADDRESSAWARE" linker flag set and pipe the output to the encoder. This way the frame server can allocate almost 4 GB.

Groucho2004
27th August 2014, 16:07
I guess the script exceeds the 4GB ram limit of 32bit program limit
Sorry to bark again, the user process memory limit for a 32 Bit process is 2 GB. ;)
However, this can be increased to about 4 GB in a 64 Bit OS with a "hack".

asarian
27th August 2014, 16:08
oh my lord, you are calling 3 FREAKING SLOW filters (qtgmc,mctemporaldenoise,ediresize16) altogether within one script, I guess the script exceeds the 4GB ram limit of 32bit program limit, my advice would be, doing them step by step, first qtgmc, encode it to a fast lossless format, the load the encoded file then mctemporaldenoise, encode again, then ediresize16

Keep in mind that I have done *many* movies like that on 2.5 (except for ediresize). And QTGMC never crashed like that before.

And even with QTGMC and MCTemporalDenoise commented out, the ediresize16 still causes a 300 hours ETA to finish!

asarian
27th August 2014, 16:11
You're running out of memory. Reduce the number of threads.
Check how much memory your script needs with this (http://forum.doom9.org/showthread.php?t=165528) tool.

If you're on a 64 Bit OS, maximize available memory for the frame serving and encoding by using a pipe tool that has the "LARGEADDRESSAWARE" linker flag set and pipe the output to the encoder. This way the frame server can allocate almost 4 GB.

I have done entire Blu-Rays like this with MCTemporalDenoise and QTGMC. Never an issue. I install AviSyn 2.6, an now it runs horribly out of memory on a 352x288 lowly VDC source!? That don't make much sense.

Groucho2004
27th August 2014, 16:12
I have done entire Blu-Rays like this with MCTemporalDenoise and QTGMC. Never an issue. I install AviSyn 2.6, an now it runs horribly out of memory on a 352x288 lowly VDC source!? That don't make much sense.
Did you use the MT version of 2.58?

feisty2
27th August 2014, 16:13
Sorry to bark again, the user process memory limit for a 32 Bit process is 2 GB. ;)
However, this can be increased to about 4 GB in a 64 Bit OS with a "hack".

thx, I didn't know windows limits the max ram 2GB to 32bit programs before

asarian
27th August 2014, 16:14
Did you use the MT version of 2.58?

No, I got this MT 2.6 version today:

http://forum.doom9.org/showthread.php?t=148782

feisty2
27th August 2014, 16:16
I have done entire Blu-Rays like this with MCTemporalDenoise and QTGMC. Never an issue. I install AviSyn 2.6, an now it runs horribly out of memory on a 352x288 lowly VDC source!? That don't make much sense.

upscaling 352x288 to 1444x1080 would call eedi3 (dh=true) 9 times inside the ediresize16 script, and we all know how slow eedi3 is, even with the moded version
EDIT: its actually 9 times, not 20 times, I was out of my mind

Groucho2004
27th August 2014, 16:18
No, I got this MT 2.6 version today:

http://forum.doom9.org/showthread.php?t=148782
You're using a multi-threaded version of Avisynth (and not correctly, I may add). The additional threads use a lot more memory than your old, single-threaded 2.5.8. Remove all "setmtmode()" calls and try again.

asarian
27th August 2014, 16:23
You're using a multi-threaded version of Avisynth (and not correctly, I may add). The additional threads use a lot more memory than your old, single-threaded 2.5.8. Remove all "setmtmode()" calls and try again.

What do you mean, not correctly?! Ony DSS2 needs to be in MTMODE 5, the rest can run safely in 3.

And I *always* encode my blu-rays like that. Without the setmt_mode calls, MCTemporalDenoise et. all fails almost instantly.

asarian
27th August 2014, 16:33
And now I can't go back to 2.5.8 any more either, as SEt has removed 2.5.8 MT. :(

feisty2
27th August 2014, 16:40
What do you mean, not correctly?! Ony DSS2 needs to be in MTMODE 5, the rest can run safely in 3.

And I *always* encode my blu-rays like that. Without the setmt_mode calls, MCTemporalDenoise et. all fails almost instantly.

my apologies for all the inconveniences, but like I said, vcd to 1080p is a LARGE factor of upscaling, it might cause memory issues along with other slow plugins, please just split your script into 2 parts, first part with qtgmc+mctd, second part with single ediresize16, the problem should be gone

StainlessS
27th August 2014, 16:42
If you do decide and manage to go back to v2.58, rt_stats has a rt_undefined() func.

asarian
27th August 2014, 16:47
my apologies for all the inconveniences, but like I said, vcd to 1080p is a LARGE factor of upscaling, it might cause memory issues along with other slow plugins, please just split your script into 2 parts, first part with qtgmc+mctd, second part with single ediresize16, the problem should be gone

Upon closer examination, it's really ediresize16 that causes the crash (together with the rest). Both QTGMC and TemporalDenoise run fine when ediresize16 is not running. It's the combination that makes it crash.

At least that means my AVS install isn't totally hosed. :) I shall try a multi-pass. Thanks yet again.

asarian
27th August 2014, 16:50
If you do decide and manage to go back to v2.58, rt_stats has a rt_undefined() func.

Nah, I decided to stick with 2.6 for a while. :) If anything, feisty2's script has taught me that I can no longer really postpone the upgrade; eventually I had to anyway.

StainlessS
27th August 2014, 16:55
V2.6 is generally more stable but I am not totally happy with the cache mods that have been implemented since v2.58.
Edit: since v2.6a3.

Groucho2004
27th August 2014, 16:56
What do you mean, not correctly?! Ony DSS2 needs to be in MTMODE 5, the rest can run safely in 3.
Mode 3 or 5 are modes for source filters. For the following filters, you should use mode 2 for optimum efficiency.

Groucho2004
27th August 2014, 16:58
Without the setmt_mode calls, MCTemporalDenoise et. all fails almost instantly.
That makes no sense. Without the calls, Avisynth MT will use much less memory and will be more stable, although slower.

asarian
27th August 2014, 17:04
That makes no sense. Without the calls, Avisynth MT will use much less memory and will be more stable, although slower.

The problem is DSS2. It absolutely needs to be threaded the way I do, surrounded my SetMTMode calls. If I don't, frame seeking on MCTemporalDenoise fails horribly (and will soon crash).

Groucho2004
27th August 2014, 17:07
The problem is DSS2. It absolutely needs to be threaded the way I do, surrounded my SetMTMode calls. If I don't, frame seeking on MCTemporalDenoise fails horribly (and will soon crash).
Use FFVideoSource or LWLibavVideoSource.

asarian
28th August 2014, 05:21
That makes no sense. Without the calls, Avisynth MT will use much less memory and will be more stable, although slower.

Doing it like this now, for the second pass:


SetMemoryMax(768)

SetMTMode(5,4)

FFVideoSource("f:\jobs\zenon1.mkv")

SetMTMode(3)

Dither_Convert_8_to_16()
ediresize16 (1444, 1080, kernel_u="bicubic", noring=true, cplace="mpeg1")
ditherpost (mode=6)
# GradFun3 ()

AddBorders(238, 0, 238, 0)



SetMTMode(2), btw, immediately makes eedi3 crash ("malloc error").

On my i7 980X (6 cores), at 0.55fps, this is going to take me ~72 hours! Ediresize16 really better be a lot better than Lanczos4Resize! :p (I'll soon find out, once I got a partial clip done).

EDIT: zenon1.mkv, btw, is the lossless output of first pass, using QTGMC and MCTemporalDenoise.

feisty2
28th August 2014, 05:26
Doing it like this now, for the

remove all setmtmode stuff, malloc error of eedi3 means you ran out of memory, yet again

feisty2
28th August 2014, 05:39
if you are looking for a magic upscale filter, there's no such thing yet, ediresize16 won't offer you HD level delicate details, it just produces less artifacts than other resizers, a quick comparison.
lanczos4 2x upscale
http://thumbnails110.imagebam.com/34782/d555ff347813381.jpg (http://www.imagebam.com/image/d555ff347813381)
ediresize16 2x upscale
http://thumbnails110.imagebam.com/34782/cce2ee347813349.jpg (http://www.imagebam.com/image/cce2ee347813349)
ediresize16 2x upscale with aggressive edi kernel
http://thumbnails109.imagebam.com/34782/837402347813316.jpg (http://www.imagebam.com/image/837402347813316)

asarian
28th August 2014, 05:43
remove all setmtmode stuff, malloc error of eedi3 means you ran out of memory, yet again

Didn't run out of memory with SetMTMode(3), though. :)

Just for the heck of it, I removed all SetMTMode() calls. Surprisingly, it seems to make no discernable difference at all: about an equal amount of memory is being used, and CPU usage is at ca 100% too. The latter is actually what surprises me the most, as I don't get how AviSynth still uses all my cores in what is supposed to be a single-threaded process now.

asarian
28th August 2014, 05:45
if you are looking for a magic upscale filter, there's no such thing yet, ediresize16 won't offer you HD level delicate details, it just produces less artifacts than other resizers, a quick comparison.
lanczos4 2x upscale
[

No magic is required, or expected. :) As long as it's better than Lanczos4Resize(). :)