Quantcast Upsampling interlaced YUV420 to YUV422 ? - digitalFAQ Forum
  #1  
04-12-2019, 09:06 PM
homefire homefire is offline
Premium Member
 
Join Date: Apr 2019
Posts: 13
Thanked 3 Times in 1 Post
I have DVD's that were converted from VHS with a low grade toshiba dvd recorder and the video format of the DVD is interlaced YUV 4:2:0. Re-capturing the VHS video is not an option, they have been destroyed. I have some heavy noise reduction, color and chroma correction, drop frames to fix. From what I've read and understand filters and plugins have less information to work with YUV 4:2:0 than YUV 4:2:2. Will filters work better if I were to upsample from YUV 4:2:0 uncompressed to huffyuv 4:2:2?

From what I understand certain filters are meant to be used in certain color spaces. Which filters work better in which color spaces (the most common ones for VHS restoration)?

I've read that avisynth is better than virtualdub at converting color spaces due to their modified algorithm. Is this still the case? Is there a better alternative?
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
04-13-2019, 03:15 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,356
Thanked 1,039 Times in 872 Posts
Quote:
Originally Posted by homefire View Post
I have DVD's that were converted from VHS with a low grade toshiba dvd recorder and the video format of the DVD is interlaced YUV 4:2:0.
4:2:0 interlaced is standard spec for DVD, and also for standard-def BluRay, and for 1920x1080 BluRay at 29.97 or 25 fps, and for most TV broadcast material, not to mention a lot of streaming stuff. I'll bet at least some of it isn't interlaced but is telecined or uses some form of pulldown, or could be progressive but mastered as interlaced. Deinterlacing in itself is not an improvement, since deinterlacing is a destructive process. Don't deinterlace unless you have a reason for doing so.

Quote:
Originally Posted by homefire View Post
From what I've read and understand filters and plugins have less information to work with YUV 4:2:0 than YUV 4:2:2.
That's true. Results also depend on how well a specific process handles the working colorpsace.

Quote:
Originally Posted by homefire View Post
Will filters work better if I were to upsample from YUV 4:2:0 uncompressed to huffyuv 4:2:2?
Any time a video is decoded for processing, it is decompressed regardless of colorspace. Compression refers to encoding, not to color resolution. Why are you specifying huffyuv? Lagarith and UT Video codecs work with more colorspaces than huffyuv does, although there's nothing wrong with it.

Sometimes a higher chroma resolution is a better choice (cleaner, more detail retention, less destructive, fewer interpolation errors, etc.), sometimes it isn't. If a filter isn't designed to work in a particular colorspace, it can't be used in other colorspaces anyway. Many filters can work in more than one colorspace, most can't. Some multispace filters work better in one colorspace than in another. How do you find out? You use it, you find discussions about it (usually in doom9.org), you perform very specific and highly controlled experiments -- the latter means you have to know a lot about programming and filter design.

To a general extent, a filter that can work in a higher color resolution gives superior results. How superior? Again, it depends. Usually the differences are subtle, but not always. One recommendation used by colorists and mastering experts is that resizing is cleaner when the color resolution is higher -- of course, much also depends on the resizer. As you can guess, there are different resizers. Try some of these in Avisynth: http://avisynth.nl/index.php/Resize. There are also special resizing filters or procedures. One favorite for downsizing is iResize, which basically uses the Spline36Resize algorithm (http://blog.davidesp.com/archives/269). The coded text in that link that begins with "function IResize" is saved as an .avs text file for use as an Avisynth plugin. It was designed primarily for use with interlaced material, but it can be used as-is with either interlaced or progressive.

How do you know which colorspaces a filter can use? Look at the documentation. For a quick reference you can look at the following plugin listing that includes a column of allowed colorspaces: http://avisynth.nl/index.php/External_filters. For Avisynth built-in functions such as ColorYUV, consult the documentation or browse this page that lists filters and their intended color formats: http://avisynth.nl/index.php/Internal_filters.

Which filters work better in which color spaces (the most common ones for VHS restoration)?[/QUOTE]
There is no answer. Most of the classic Avisynth filters for VHS restoration use Yv12 only, some are YUY2 only, many can use YUY2 and YV12. The filters used depend on the problems they address. The deinterlacer QTGMC has the original basic version that works only in Yv12, but there are newer versions that can use multiple colorspaces. The advantage of the original, which is still a favorite, is that it's time-proven and always works. The problem with the newer versions is that they change every few months, they often work only in the computers of those who designed them, revisions almost always have bugs that are "fixed" in new revisions a week later, etc., etc. Newer versions of QTGMC can also work with 16-bit dithering if you're willing to master the specialized and complex procedures and support plugins required.

I'd suggest that you start with what most refer to as the old classics and gradually move up to the newer stuff, keeping in mind that newer isn't always better and is often a pain in the neck. Most tried and true classics are 32-bit, but there are 64-bit versions if you don't mind waiting around for new updates from 32-bit (which in many cases will never happen). The newer 64-bit guys use more colorspaces. If they can fill the bill for you, go for it. I find the current choices too limited and poorly documented.

Another consideration is that if you're using a batch of filters some of which require different colorspaces, it's best to stay within one colorspace before moving to the next, rather than jockey back and forth between colorspaces. Colorspace conversions involve math rounding and interpolation errors. Change colorspaces often enough and those errors add up, degrading quality.

Quote:
Originally Posted by homefire View Post
I've read that avisynth is better than virtualdub at converting color spaces due to their modified algorithm.
For the most part, that's true. And VirtualDub is better at most conversions than Adobe Premiere Pro and other NLE's most of the time.

Quote:
Originally Posted by homefire View Post
Is there a better alternative?
Not that I know of.

There is still a [supposed] problem with the way VirtualDub converts interlaced YV12 to RGB, but the rumor/report/assumption is that it's [supposed to be] fixed in v1.9 and later. Most people don't worry about it. But if you're really concerned you can always use an Avisynth script to open your Yv12 video and convert it to RGB formerly and properly before applying VirtualDub filters (http://avisynth.nl/index.php/Convert). If you're not applying RGB filters, no need to convert.

Some people say that Davinci Resolve does good color conversion. Others disagree. Those who discuss it give no information one way or the other about how DaVinci does it (or doesn't do it) and no one seems to know how to post comparative results. The word "Pro" in software names has nothing to do what actually happens. For VHS work the gargantuan software bloat is often overkill and a silver bullet fantasy by those who don't know very much about color work and who think the pricey software will automatically solve all their processing problems for them. If you're going to get involved with complex software of that nature it's strongly advised that you get advanced knowledge of what you're doing and how the product works. Most people use Adobe and DaVinci the same way they would use a cheap $50 editor. On those terms you can accomplish more with Avisynth and VirtualDub, and they're free. It depends on how much you're willing to learn to to get the best from any product or method.

Opinions otherwise are welcome and necessary.
Reply With Quote
The following users thank sanlyn for this useful post: homefire (04-13-2019), lordsmurf (04-17-2019)
  #3  
04-13-2019, 05:45 PM
homefire homefire is offline
Premium Member
 
Join Date: Apr 2019
Posts: 13
Thanked 3 Times in 1 Post
Thank you for such a detailed response, I've learned so much from reading all of your posts. You have a great eye for detail. I'm actually compiling a file with all the responses on the forum, so that it is easier for me to reference. If you wouldn't mind I'd also like to post it in order to help someone new to this, like me, get up to speed quicker.

Quote:
Compression refers to encoding, not to color resolution. Why are you specifying huffyuv? Lagarith and UT Video codecs work with more colorspaces than huffyuv does, although there's nothing wrong with it.
There's no reason I specified huffyuv except in the fact that it handle 4:2:2 and it is used in most examples on this forum. From what I've read, they are all lossless, meaning no quality loss in capture, and the only differences between them are the colorspace(s) they handle, size of file and decode speed. Please correct me if I am wrong.

Quote:
I'll bet at least some of it isn't interlaced but is telecined or uses some form of pulldown, or could be progressive but mastered as interlaced. Deinterlacing in itself is not an improvement, since deinterlacing is a destructive process. Don't deinterlace unless you have a reason for doing so.
In the post below you say mediainfo is inaccurate about interlace/telecine with lossless avi. What would be the proper way to tell? And how should those more complex cases telecine with a pulldown or progressive but mastered as interlaced? There are some avisynth filters that require you to define if the clip is interlaced, such as colorspace conversions. Found more VHS tapes, best Avisynth scripts to restore?

Forgive me if this has been answered elsewhere, but what situations would deinterlacing be necessary? I'm guessing this should be done for truly interlaced videos before converted in a format that will be played back in a environment that does not handle interlaced videos well, such as streaming. Or does it depend on the quality of the videos and filters being used?

Quote:
Another consideration is that if you're using a batch of filters some of which require different colorspaces, it's best to stay within one colorspace before moving to the next, rather than jockey back and forth between colorspaces. Colorspace conversions involve math rounding and interpolation errors. Change colorspaces often enough and those errors add up, degrading quality.
I know that the order of filters applied highly depends on the quality, noise of the video and filters being applied but in general - levels, colors, denoiser, resize and possibly deinterlace if required? I should try to stick to filters that handle the colorspace I am already in and only convert if absolutely necessary, like as you had mentioned resizing is cleaner in higher colorspaces. Is this worth the interpolation errors or should it depend on the video and the acceptable look?

Quote:
The word "Pro" in software names has nothing to do what actually happens. For VHS work the gargantuan software bloat is often overkill and a silver bullet fantasy by those who don't know very much about color work and who think the pricey software will automatically solve all their processing problems for them. If you're going to get involved with complex software of that nature it's strongly advised that you get advanced knowledge of what you're doing and how the product works. Most people use Adobe and DaVinci the same way they would use a cheap $50 editor.
I completely agree:

"A tool is only as good as the hands that wield it"
Reply With Quote
  #4  
04-14-2019, 02:39 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,356
Thanked 1,039 Times in 872 Posts
Quote:
Originally Posted by homefire View Post
There's no reason I specified huffyuv except in the fact that it handle 4:2:2 and it is used in most examples on this forum. From what I've read, they are all lossless, meaning no quality loss in capture, and the only differences between them are the colorspace(s) they handle, size of file and decode speed. Please correct me if I am wrong.
Correct. Lagarith and UT Video are also lossless. Decoding speed is one thing, although they're all pretty fast, but Lagarith makes smaller files. You will find yourself using YV12 often with Avisynth, so you can use Lagarith to save YV12 and avoid another colorspace conversion back to YUY2. UT Video can use several color systems and so can the new Magix (the latter is optimized for HD). HuffYUV and Lagarith are recognized by most PC media players; others aren't so widely used and aren't so widely recognized. Many users like myself stick with Huffyuv/YUY2 for capture but use Lagarith to make smaller intermediate working files.

Quote:
Originally Posted by homefire View Post
In the post below you say mediainfo is inaccurate about interlace/telecine with lossless avi. What would be the proper way to tell? And how should those more complex cases telecine with a pulldown or progressive but mastered as interlaced?
You can distinguish between frames that are physically interlaced (actually contain two interlaced images from two different instants in time) and frames that are physically progressive (contain only one non-interlaced image) but are encoded or played as if interlaced.

VHS always plays as interlaced and is captured that way. But the frames might be physically interlaced or not. Video created by consumer VHS cameras is always physically interlaced. Retail VHS tape could have several structures, depending on how it's mastered and its original source. A live TV broadcast (not film based) would be phsyically interlaced, but it could also have newsfilm segments that are telecined. Almost all early Sitcoms like I Love Lucy and even later were created on film at 23.976fps and are telecined for 29.97fps playback, meaning that they consist of 3 progressive frames and 2 interlaced frames in every group of 5 frames. Movie based retail tapes are almost always telecined. On tape, telecine plays back as if interlaced, even though you have the physical 3:2 pulldown in every 5 frames (this is called "hard telecine"). 3:2 pulldown is broken down to all-progressive film speed by using inverse telecine (Avisynth's TIVTC plugin). On retail tape you can also have speed adjustment by using periodic duplicate frames, in which case you'll need TIVTC's TDecimate function or other plugins. You'll encounter a complex system of duped and telecined frames in animation, although Disney's Hollywood classics like Snow White and others were created as 23.976 on film and as plain vanilla 3:2 pulldown on tape and DVD.

Years ago a video guru named Neuron2 posted a famous HTML page that described basic ways to analyze frames. The page disappeared from the 'net years ago, but I posted a copy at digitalfaq a while back: Neuron2_How To Analyze Video Frame Structure.zip.

Quote:
Originally Posted by homefire View Post
Forgive me if this has been answered elsewhere, but what situations would deinterlacing be necessary? I'm guessing this should be done for truly interlaced videos before converted in a format that will be played back in a environment that does not handle interlaced videos well, such as streaming. Or does it depend on the quality of the videos and filters being used?
It has definitely been handled elsewhere and many times, but on a case by case basis. Deinterlace and inverse telecine are used when purely progressive material is required for transmission or for playback by not-so-smart systems such as the internet and by equally stupid smart-tv's, but often for processing.

It's processing situations that get down to specific cases. If you want to use QTGMC's sometimes superior EZDenoise feature or try to get its motion smoothing and edge cleaning help against aliasing, sawtooth edges, and excessive interlace combing, you'll have to use QTGMC (which will automatically deinterlace) and manually set some of its special preset templates or other options. QTGMC's options are explained in great detail in the html doc that comes with the plugin and in the top several hundred lines of the .avsi text file itself. If you want to see how advanced users implement those options, browse forum posts of Avisynth scripts that use QTGMC. Or submit unfiltered video samples to get advice on specific real-life issues.

Color and levels correction don't require deinterlace or inverse telecine. However, chroma shift and bleeding correction usually require it, along with filters that help clean up edge ghosts, halos, and DCT ringing (noise along edges, such as mosquito noise). Hard edges in large surfaces that should be smooth gradations will almost always require progressive frames for gradient smoothing and elimination of macroblocks.

Common denoisers that don't usually (repeat usually) require purely progressive frames but can use SeparateFields() are MCTemporalDenoise, MDegrain2, RemoveSpots variations, RemoveDirt variations, and TemporalDegrain, along with some temporal smoothers such as TemporalSoften or TemporalSmoother. How to determine? it's largley a matter of using the filters and observing their behavior, as well as browsing forum posts for samples of noise and damage to see how they've been handled by others.

Quote:
Originally Posted by homefire View Post
I know that the order of filters applied highly depends on the quality, noise of the video and filters being applied but in general - levels, colors, denoiser, resize and possibly deinterlace if required?
Contrast, Levels, and basic YUV color correction usually occur first, but you'll find they will be tweaked later after applying other filters. Levels and color can reveal more noise or defects than you first thought was there. Noise is sometimes the result of oversaturation, which causes flicker and blooming. Denoising is next (never sharpen before denoising. Who needs sharpened noise?). Deinterlace/inverse telecine always comes before resizing (why are you resizing, other than for internet use? Resizing always has a cost). Sharpeners should not be applied to interlaced images. When you experiment with filters, don't sit and filter an hour of video to see what happens. Work with very short segments to tweak your settings and procedures. Don't be afraid to split a video into smaller working parts.

Don't go crazy with colorspace obsession. If you find that you must go from YUY2 to YV12 to use a YV12 filter to get somewhere and return to YUY2 to finish up, so be it. It's moving back and forth on and on that gets messy. I've had to work in YV12, then go to RGB for something, then come back to YUY2 and even 16-bit YV12 to clean up some pretty messy videos. Try to keep it simple and consistent. I've seen scripts where the user went haywire with repeated and circular colorspace conversions without rhyme or reason. It's not difficult to avoid that sort of thing.
Reply With Quote
The following users thank sanlyn for this useful post: homefire (04-14-2019), lordsmurf (04-17-2019)
  #5  
04-14-2019, 04:56 PM
homefire homefire is offline
Premium Member
 
Join Date: Apr 2019
Posts: 13
Thanked 3 Times in 1 Post
Quote:
Years ago a video guru named Neuron2 posted a famous HTML page that described basic ways to analyze frames. The page disappeared from the 'net years ago, but I posted a copy at digitalfaq a while back: Neuron2_How To Analyze Video Frame Structure.zip.
Great source, turns out they were all progressive.

sanlyn, this is all pure gold. I have a good idea of how to tackle the issues I'm having. I appreciate that your taking the time to pass the knowledge on.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Output both progressive and interlaced? koberulz Restore, Filter, Improve Quality 51 08-01-2017 05:57 PM
Why is my PAL interlaced messed up? [SOLVED] lordsmurf Capture, Record, Transfer 9 10-11-2016 01:17 PM
Capture interlaced, but how to to keep video interlaced when making DVDs? premiumcapture Encode, Convert for discs 11 12-21-2013 03:40 PM
S-VHS PAL interlaced acquisition with Huffyuv Genu29 Capture, Record, Transfer 3 02-01-2012 04:39 AM
Interlaced vs non-interlaced artifacts ? lordsmurf Capture, Record, Transfer 0 04-15-2009 03:23 PM

Thread Tools



 
All times are GMT -5. The time now is 02:51 AM