View Full Version : Script for upscaling 480i to 1080 i/p
PurpleMan
11th November 2009, 09:49
Hello.
I have a 480i NTSC video source on DVD (true NTSC 29.97 interlaced, not telecined so can't be ivtced to progressive).
I want to perform some sort of upscaling to somewhat improve viewing quality, and possibly burn the result on a blu-ray disc. I have some questions for the experts:
1) When upscalaing, would you recommend keeping it interlaced (blu-ray standard does support interlaced video) or deinterlace it to achieve progressive output? If you recommend on deinterlacing it, could you recommend a method of doing it (hopefully one that will result in the least possible amount of artifacts)?
2) Could anyone offer a basic script for the upscale I'm trying to achieve? There are many filters for each task (deblocking, sharpening, deinterlacing, resizing), so I guess my question is - in general, what script would YOU use for the task?
(One that includes all the above, that is. Deinterlacing (if you think it's right to do so), slight deblocking, sharpening and finally resizing (If you think more steps should be involved to clean the image, please feel free to recommend those too).
Notes:
* Processing time isn't important, filters can be slow.
* I'm not looking for the best possible results, I know that requires alot of tweaking and trial-and-error. I'm looking for something general that would produce a decent result.
* The quality of the source video is fairly good, we're not looking at a VHS source here.
Thanks in advance! :-)
-PurpleMan
Ghitulescu
11th November 2009, 11:47
I would keep the DVD as it is. Because:
1a. interlaced videos should never be deinterlaced, unless there's a sound reason.
1b. a pure interlaced image (I assume live studio recordings) can always be hardware deinterlaced - if you don't know how to do it (have a little bit of experience with these filters) you might risk degrading the image. And it has to be, as consumer HDTV TVs are progressive. You should rely on software deinterlacers only if the hardware fails to provide you a better quality.
2. you can't achieve a better quality than the source, however you can achieve a better quality using one algorithm than using another. And the algorithms depend on the source.
3. BDRs are still costly, at least in EU.
If I want to see a DVD in a better quality I simply drop it into my Pio BD player and let it do both the upscaling and (if necessary) deinterlacing. Otherwise I'll watch it in a Pio DVD and let the TV do these things, which it does extremely good, but not as good as the BD.
PurpleMan
11th November 2009, 14:24
I would keep the DVD as it is. Because:
1a. interlaced videos should never be deinterlaced, unless there's a sound reason.
A sound reason would also be for the purposes of upscaling.
2. you can't achieve a better quality than the source
Not true. You can't add any new detail, but you can definitely enhance the way it looks (sharpening, smoothing, deblocking).
3. BDRs are still costly, at least in EU.
Doesn't really relate to my question, but anyhow you can get them as cheap as 2.5$ per disc. Doing 1 disc, that's not an issue.
If I want to see a DVD in a better quality I simply drop it into my Pio BD player and let it do both the upscaling and (if necessary) deinterlacing.
Kind of contradicting yourself there. Because you agree that you CAN make the viewing quality better. You're just saying that you let the pioneer player do the upscale, while I want to do the same thing and just have it already encoded upscaled with similar kind of processing that your pioneer does.
Don't forget, even "hardware" filters are still software inside, there is no magic.
Anyways, I don't want to start a discussion on whether or not a source should be kept. If anyone has a script for the job, I'd love taking a shot at it.
Thank you! :)
-PurpleMan
2Bdecided
11th November 2009, 14:49
Here's everything you could ever want to know...
http://forum.doom9.org/showthread.php?t=145314
Long thread - some great scripts.
Hope this helps.
Cheers,
David.
EuropeanMan
11th November 2009, 15:15
it still boggles my mind why people would take 480i/p material to USPCALE to 1080i/p THINKING they are improving quality.
you mention deblocking, deinterlacing, sharpening & denoising...on a larger framing, those problems get exacerbated...and you think avisynth filters will magically take care of it all? impossible.
you wanna fix the source? do it, and leave it at that...burn the dvd, then POP that into your BD player and let IT handle the upscalin since IT would do it better than any of us users.
-------
Farooq
PurpleMan
11th November 2009, 15:19
you wanna fix the source? do it, and leave it at that...burn the dvd, then POP that into your BD player and let IT handle the upscalin since IT would do it better than any of us users.
Once again, need I remind you that the BD player uses filters as well? most of the time, ones less sophisticated than those available for avisynth usage.
As for why upscale? Well, you do finer sharpening ability and block removal if you got more pixels to work with. That's just trivial.
Inspector.Gadget
11th November 2009, 15:39
Edit: If you're going to upscale 480i content, definitely BOB it first with something high-quality like TGMC or else you're going to magnify the problems of blending, etc. BD doesn't do 1080p60 but you could very well put such a file on Blu-ray disc. Otherwise you might want to look at combining some of the *EDI functions to deinterlace and upscale...
PurpleMan
11th November 2009, 16:31
Edit: If you're going to upscale 480i content, definitely BOB it first with something high-quality like TGMC or else you're going to magnify the problems of blending, etc. BD doesn't do 1080p60 but you could very well put such a file on Blu-ray disc. Otherwise you might want to look at combining some of the *EDI functions to deinterlace and upscale...
Unfortunately, I'm looking for a bd-standard disc. Since decimating to 24fps (in any way) is probably a bad idea, maybe it's best keeping it 1080i 59.94
Only question is, what else should be done? (deblocking, sharpening, resizing, etc).
Inspector.Gadget
11th November 2009, 16:37
Since decimating to 24fps (in any way) is probably a bad idea, maybe it's best keeping it 1080i 59.94
Bobbing would make it 60p (versus 60i), and you MUST make the video progressive before upscaling anyway to avoid destroying the corresponding fields while still ending up with combing artifacts. You can always reinterlace later in the script.
What I'm getting at is if you're not going to play the encoded file with a Blu-ray player, but merely need the 25/50G storage capacity, then the sky's the limit as far as video features. If you are making a Blu-ray structure, then you're stuck with 480i->480 or 1080p60->1080i60 or 1080p30. (There's always 720p60, but that doesn't satisfy your parameters).
PurpleMan
11th November 2009, 16:42
Bobbing would make it 60p (versus 60i), and you MUST make the video progressive before upscaling anyway to avoid destroying the corresponding fields while still ending up with combing artifacts. You can always reinterlace later in the script.
What I'm getting at is if you're not going to play the encoded file with a Blu-ray player, but merely need the 25/50G storage capacity, then the sky's the limit as far as video features. If you are making a Blu-ray structure, then you're stuck with 480i->480 or 1080p60->1080i60 or 1080p30. (There's always 720p60, but that doesn't satisfy your parameters).
Yes, I meant I don't want to encode the bobbed video to end up with 1080p60, so better reinterlace.
Anyways, I'm not very familiar with TGMC, can you please outline a script for me to play with (assume that I'm starting the script with directshowsource(...)).
Thanks a bunch!
Inspector.Gadget
11th November 2009, 16:50
TGMC's defaults give excellent visual quality but are very slow. You can make it slower and even more "stable" in terms of detail retention, but I think those are truly marginal improvements you won't see while watching.
Also, for DVDs, don't use DirectShowSource. Use neuron2's excellent DGIndex/DGSource(), which is guaranteed to be frame accurate.
Tritical's *EDI tools generally give excellent results when upscaling an image 2x, but read up and take care that you're not in effect bobbing the source again.
I don't do upscaling, so I don't have a script sitting around; I mainly use these tools for repair of crappy DVD sources.
2Bdecided
12th November 2009, 13:47
it still boggles my mind why people would take 480i/p material to USPCALE to 1080i/p THINKING they are improving quality.If you have a 1080 display, then unless you want to watch an anamorphically squeezed postage stamp in the middle of the screen(!), you have to upscale somewhere.
I think it's fair to say that doing this carefully in AVIsynth may improve the quality compared with doing it in the player or TV.
Or it may not. Worth a try though.
Cheers,
David.
PurpleMan
12th November 2009, 15:44
TGMC's defaults give excellent visual quality but are very slow. You can make it slower and even more "stable" in terms of detail retention, but I think those are truly marginal improvements you won't see while watching.
Also, for DVDs, don't use DirectShowSource. Use neuron2's excellent DGIndex/DGSource(), which is guaranteed to be frame accurate.
Tritical's *EDI tools generally give excellent results when upscaling an image 2x, but read up and take care that you're not in effect bobbing the source again.
I don't do upscaling, so I don't have a script sitting around; I mainly use these tools for repair of crappy DVD sources.
Thank you so much! Brilliant results!
I applied TGMC for bobbing, resized to 1920x540, and weaved back together to reinterlace.
The result is simply stunning! Stable and clean image, smooth motion!
Didée
12th November 2009, 16:22
I applied TGMC for bobbing, resized to 1920x540, and weaved back together to reinterlace.
That sounds incorrect. You have to resize to 1080 vertically, then separate fields, then weave. Just resizing to 540 + weave will result in slight vertical shiver (though it might not be too obvious at that resolution.)
This principal script I had typed yesterday, but somehow I closed the browser before posting it:
Source()
TGMC()
NNEDI2_rpow2(rfactor=2,cshift="spline36resize",fwidth=1920,fheight=1080)
SeparateFields().SelectEvery(4,0,3).Weave()
Ghitulescu
13th November 2009, 10:13
Kind of contradicting yourself there. Because you agree that you CAN make the viewing quality better. You're just saying that you let the pioneer player do the upscale, while I want to do the same thing and just have it already encoded upscaled with similar kind of processing that your pioneer does.
....
Don't forget, even "hardware" filters are still software inside, there is no magic.
...
1a. interlaced videos should never be deinterlaced, unless there's a sound reason.
A sound reason would also be for the purposes of upscaling.
you can't achieve a better quality than the source, however you can achieve a better quality using one algorithm than using another. And the algorithms depend on the source.
...
If I want to see a DVD in a better quality I simply drop it into my Pio BD player and let it do both the upscaling and (if necessary) deinterlacing. Otherwise I'll watch it in a Pio DVD and let the TV do these things, which it does extremely good, but not as good as the BD.
No, I'm not. I just said that what you see is always the compared result of 2 upscaling algoritms, one being better than the other. You'll always have an upscaling somewhere when the source does not match the viewing device. Your problem is actually that you're disappointed by the upscaling properties of your A/V gear (typical for more than 99% of the sold units). So in your case, you do the upscaling in avisynth and send the result bit-per-bit to a [hopefully] FullHD TV. In my case I rely on the upscaling algorithm of my Pio which is on par with a medium priced DVDO upscaler (which BTW custom taylored the solution for Pio), which is probably better than what I can obtain with my limited knowledge in avisynth (I know some 10 filters, each having their strengths for various types of movies, sport, anime etc. - learning all of them and spending hours for something I have anyway is not my choice). I agree, avisynth is better than the majority of TVs and DVDs with HDMI I've seen: I see immediately whether it's a DVD or a BD playing.
The hardware upscalers do not cost some 2000-10000€ (maybe more) for nothing. If Snell&Wilcox wants to remain in business and to ask that incredible amount of money, they have to be superior to any avisynth filter that nowadays runs also in real time on a normal PC.
So it's up to you to decide if you want to use the software or the hardware. You may improve the things, but only if the DVD itself is of a bad quality.
And 1080 exists also as 1080i. No deinterlace needed, unless the resizing algorithms require it.
-=-
My advice was actually an educated "don't waste your time".
2Bdecided
13th November 2009, 11:41
@Didée,
...
assumetff().SeparateFields().SelectEvery(4,0,3).Weave()
...
since HD is always TFF, but SD source may not be, and replacing tgmc with other bobbers can create unpredictable passthrough of original field order anyway.
(I know you weren't posting a complete script anyway, but the poster might interpret that line as being complete, while IMO it wasn't!)
Cheers,
David.
Didée
13th November 2009, 14:46
Oh, is HD strictly TFF always? You may laugh at me, I wasn't really aware of that. :o
In that case - yes, the assumeTFF() must be there! Thanks for the pointer.
So it's up to you to decide if you want to use the software or the hardware. You may improve the things, but only if the DVD itself is of a bad quality.
For the given task of upscaling SD->HD, of course it's exactly the other way round: The better the DVD's quality, the better the upscaling result. The poorer the DVD, the poorer the result. Making a "really good" upscale is difficult enough from a clean source. If you've additionally to cope with lots of artifacts, then the upscale will suffer even more ... either because you upscaled the artifacts too, or because you lost valuable detail while treating the artifacts.
The hardware upscalers do not cost some 2000-10000€ (maybe more) for nothing. If Snell&Wilcox wants to remain in business and to ask that incredible amount of money, they have to be superior to any avisynth filter that nowadays runs also in real time on a normal PC.
Well, doing some "reasonably sophisticated" upscaling with Avisynth will most definetly not run in realtime, not even close. In that domain, hardware implementations have the ultimate advantage. PC-based software solutions are like using a swiss knife for everything: you can do all things that you only want, but it won't necessarily be the fastest possible way to do specific things. If the actual main task is to cut a tree, the HW implementation departement just implements a chainsaw, blah. The PC solution can't stand a chance - even if it jiggles its swiss knife with GigaHertzes and MultiCores, there's no way to keep up with the chainsaw.
But there's another BIG advantage that HW solutions do have, and it's this particular advantage that often makes me :rolleyes: : The fact that (at least for the vaaast majority of people) there is no way to verify the claims of hardware solutions. All I ever hear is people talking about - e.g. - Snell&Wilcox as the holy grail, being the A&O, the beyond-ultimate solution only possible. But I never have seen anything of it. People are in awe, but nobody ever shows anything to back up the claim. Thinking about it, this sounds more like "religion" than like "science"....
Main factors are
a) psychological: "if it's so expensive, it must be superior"
b) technically: with such hardware solutions, you can only look at the output (if you're lucky enough to get the chance) and subjectively judge "yes, that looks great". What's always missing is raw neutral data to make comparisons with: input stream and output stream, so that you can sit down and take your time to make close examinations of what was achieved, and how it fairs to other possible solutions.
(I could imagine it's for a good reason - on closer examination you *might* find that it's indeed pretty good, but then, not *that* breathtaking/mindblowingly good as you had believed. Perhaps other more simple and more cheap solutions would come in rather close in fact!? - Since, even if SnellWilcox has the most advanced watercooker of all, it still is only water that they are cooking. )
Possibility of verification, that's always the problem of hardware solutions. ("Problem" for customers and theorists. For the sales department, it's probably an advantage.)
Get me right - I'm not doubting that Snell&Wilcox offers very-hi-end, very-hi-quality solutions. I assume that they really are. But, as long as people only refer to hearsay (from people that refer to hearsay from people that...), without any comprehensible proof, I would be carefull to put it as the ultimate reference. ;)
henryho_hk
13th November 2009, 15:31
Isn't TGMC() denoising the SD source? Is it necessary to add some compression-friendly grain to restore the film-look?
2Bdecided
13th November 2009, 17:17
You do see S&W standards conversion on TV in the UK sometimes. And also when UK content makes its way overseas. Or at least, it's some kind of high-end device, because it doesn't judder like the (far more common, always used for news) cheaper devices, and it doesn't break into artefacts like mflowfps.
You're very right in one way though - people can put their own challenging content into the AVIsynth script and watch frame-by-fame, giving a maximum chance of spotting faults. Whereas us normal people have no control over what goes into a S&W device, and normally watch real-time after low bitrate (broadcast!) MPEG compression.
The thread I linked to suggests adding grain at the higher resolution (or some intermediate resolution). Depends on the source as to whether this looks at all convincing. What's "right" afterwards doesn't really depend on whether you use tgmc's implicit denoising or not so much as what the source is. e.g. stuff that's obviously clean well-lit video looks silly with grain added. Stuff that's already a bit filmic looks more convincing. IMO. YMMV!
Cheers,
David.
wonkey_monkey
13th November 2009, 17:50
You do see S&W standards conversion on TV in the UK sometimes.
Plus there are all the dramas and such that (at least until HD came along) are shot at 50i and processed to 25p, such as Doctor Who, which used a Snell & Wilcox Alchemist Platinum (says Wikipedia).
David
Blue_MiSfit
13th November 2009, 21:15
Quick and decent results (upscaling to 720p60 with better than average deinterlacing, and assuming a semi-noisy source)
#assuming proper field order is already set
edi=nnedi2(field=-2)
yadifmod(mode=1, edeint=edi)
#Now we're at 480p60, let's do a light MDegrain2 (multithreaded, of course!). Increase thSAD as necessary
MT("""
super = MSuper(pel=2, sharp=1)
backward_vec2 = super.MAnalyse(isb = true, delta = 2, overlap=4)
backward_vec1 = super.MAnalyse(isb = true, delta = 1, overlap=4)
forward_vec1 = super.MAnalyse(isb = false, delta = 1, overlap=4)
forward_vec2 = super.MAnalyse(isb = false, delta = 2, overlap=4)
MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=200)
""",2) # two threads
#Now good interpolation to 720p
Spline36resize(1280,720)
#And let's sharpen a bit, comment out if ugly
MT("LSFMod(Smode=5, strength=70)", 2)
#And finally, add some nice HD grain, tweak parameters as you like
MT("GrainFactory3(g1str=4, g2str=6, g3str=8)", 2)
Yep... that's what I'd do for a true interlaced 16x9 NTSC source. Swap out YadifMOD for TGMC if you're masochistic, or have ages to process. Definitely save the results to a lossless file (or x264 at crf 10) for easier encoding later.
~MiSfit
Didée
13th November 2009, 21:47
Eh, I won't pretend TGMC were a fast-runner, but ... the majority of it's slowness comes from a) NNEDI2 which is inherently slow, and from b) MDegrainX which is inherently slow. Now you suggest Yadif because hey it's so fast, but feed with a) the same-inherently-slow NNEDI2, and post-process with the same-inherently-slow MDegrainX. Ain't that funny?
I'm sure with your script it is much easier to make use of multiple cores. (But that's kind of secondary, TGMC could be adopted accordingly just as well. I just don't have hardware to really evaluate it.)
However, regarding the mere computational effort, your script is about the same! Just that its deinterlacing is worse. (A little worse for muddy low-detail sources, much worse for sharp high-detail sources.)
"masochist" and "ages to process" are broad exaggerations, I'd say ...
Blue_MiSfit
14th November 2009, 01:32
You're quite right, Didee!
Quite possible to just use NNEDI instead of NNEDI2, as it's a bit faster last I checked.
I'm not terribly familiar with TGMC, so I'll quite happily concede your points.
Grainfactory3 and LSFMod aren't exactly snappy, either ;)
~MiSfit
bizz & buzz
14th November 2009, 02:22
To retain more details/grain/noise after TGMC does it's job you can use the noise-bypass technique (http://forum.doom9.org/showthread.php?p=1324744#post1324744) script also made by Didée. It did wonders on my videos.
kolak
21st January 2010, 17:18
Oh, is HD strictly TFF always? You may laugh at me, I wasn't really aware of that. :o
In that case - yes, the assumeTFF() must be there! Thanks for the pointer.
For the given task of upscaling SD->HD, of course it's exactly the other way round: The better the DVD's quality, the better the upscaling result. The poorer the DVD, the poorer the result. Making a "really good" upscale is difficult enough from a clean source. If you've additionally to cope with lots of artifacts, then the upscale will suffer even more ... either because you upscaled the artifacts too, or because you lost valuable detail while treating the artifacts.
Well, doing some "reasonably sophisticated" upscaling with Avisynth will most definetly not run in realtime, not even close. In that domain, hardware implementations have the ultimate advantage. PC-based software solutions are like using a swiss knife for everything: you can do all things that you only want, but it won't necessarily be the fastest possible way to do specific things. If the actual main task is to cut a tree, the HW implementation departement just implements a chainsaw, blah. The PC solution can't stand a chance - even if it jiggles its swiss knife with GigaHertzes and MultiCores, there's no way to keep up with the chainsaw.
But there's another BIG advantage that HW solutions do have, and it's this particular advantage that often makes me :rolleyes: : The fact that (at least for the vaaast majority of people) there is no way to verify the claims of hardware solutions. All I ever hear is people talking about - e.g. - Snell&Wilcox as the holy grail, being the A&O, the beyond-ultimate solution only possible. But I never have seen anything of it. People are in awe, but nobody ever shows anything to back up the claim. Thinking about it, this sounds more like "religion" than like "science"....
Main factors are
a) psychological: "if it's so expensive, it must be superior"
b) technically: with such hardware solutions, you can only look at the output (if you're lucky enough to get the chance) and subjectively judge "yes, that looks great". What's always missing is raw neutral data to make comparisons with: input stream and output stream, so that you can sit down and take your time to make close examinations of what was achieved, and how it fairs to other possible solutions.
(I could imagine it's for a good reason - on closer examination you *might* find that it's indeed pretty good, but then, not *that* breathtaking/mindblowingly good as you had believed. Perhaps other more simple and more cheap solutions would come in rather close in fact!? - Since, even if SnellWilcox has the most advanced watercooker of all, it still is only water that they are cooking. )
Possibility of verification, that's always the problem of hardware solutions. ("Problem" for customers and theorists. For the sales department, it's probably an advantage.)
Get me right - I'm not doubting that Snell&Wilcox offers very-hi-end, very-hi-quality solutions. I assume that they really are. But, as long as people only refer to hearsay (from people that refer to hearsay from people that...), without any comprehensible proof, I would be carefull to put it as the ultimate reference. ;)
Even new Alchemist (best of S&W products) is not realy better than many of scripts from this forum. The main difference is realtime processing on 10bit and that's why it cost 80K£ :)
Andrew
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.