Quantcast Workflow order: mask/crop then deinterlace? - digitalFAQ Forum
Go Back    Forum > Digital Video > Video Project Help > Encode, Convert for streaming

Reply
 
LinkBack Thread Tools
  #1  
07-18-2017, 07:57 PM
rocko's Avatar
rocko rocko is offline
Premium Member
 
Join Date: Oct 2010
Posts: 455
Thanked 13 Times in 13 Posts
.avi file > Mask/Crop edges > De- Interlace > Convert to .mp4.
Is this proper order, or no? Can you point me to proper guide or thread? (For preparing for uploading video to websites) Thanks

Last edited by rocko; 07-18-2017 at 07:59 PM. Reason: Add
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
07-19-2017, 10:14 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,403
Thanked 1,067 Times in 890 Posts
If your crop operation involves resizing (that's the noob way of doing it), you must deinterlace first. Never resize video while it's interlaced.
Reply With Quote
The following users thank sanlyn for this useful post: bever (07-19-2017)
  #3  
07-19-2017, 12:17 PM
bever bever is offline
Free Member
 
Join Date: Nov 2016
Location: Pac Northwest
Posts: 92
Thanked 11 Times in 11 Posts
Quote:
Originally Posted by sanlyn View Post
If your crop operation involves resizing (that's the noob way of doing it), you must deinterlace first. Never resize video while it's interlaced.
I am keenly following this thread.

Due to I used the technique here

How to Properly Crop the Overscan in VirtualDub [GUIDE]

following a virtualdub debounce filtering on interlaced 720 x 480 video

see near the bottom of post 1

Quote:
^ This is an example of a hidden overscan. Notice that there is twice as much hidden on the left/right (X) as there is on the top/bottom (Y). This is a good example of proper overscan removal (masking) for interlaced video.
Should I have deinterlaced my video before masking (crop and resize in virtualdub)?
Reply With Quote
  #4  
07-19-2017, 02:45 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,403
Thanked 1,067 Times in 890 Posts
Quote:
Originally Posted by bever View Post
Should I have deinterlaced my video before masking (crop and resize in virtualdub)?
If you used the method shown in the guide, there is no resizing.

The question refers to masking off detritus such as bottom-border head switching noise and uneven side borders. Some people mask off the head switching noise and then mask off the rest of the image along the borders to even the black borders. This is shown int he VirtuaDub guide. This method covers large areas of the image that weren't masked in the original. There is no resizing using this method, but parts of the edges are obscured by the mask.

Other users actually crop (remove) the bottom noise and side border in VirtualDub and resize the video to fill the frame -- this almost always distorts the aspect ratio and makes the picture look slightly stretched horizontally. If the video is interlaced and you resize, you must deinterlace first. If it's not interlaced, resize as-is. This method is also a waste of time if you view the results on TV, because the typical HDTV has overscan enabled, so parts of the image are obscured.

I don't use either method and don't use simple masks in VirtualDub as shown in the referenced guide. I use Avisynth, never touch the inner image. I crop off unwanted areas, and add border pixels to even up the image, all without altering the core image.

Example 1: Original sample image, with 6 pixels of head switching noise at the bottom and 16 pixels of black border on the right:


Example 2: Same image masked as in the Virtualdub guide, with edge details covered by the mask. No resizing.


Example 3: bottom and right Borders cropped off, border pixels added and image centered, original image content intact:


Avisynth in example 3 used this code:
Code:
Crop(0,0,-16,-6).AddBorders(8,2,8,4)
Excuse the quality of the images, they are directly from one of the earlier samples posted and have no levels control during capture. Darks are crushed, brights are blown out. It would take some work in Avisynth to make corrections. I didn't have time for that offhand, but the sample was already open on my desktop and was handy. The Virtualdub masking guide is overly complicated -- it's much easier just using the Virtualdub BorderControl filter to mask edges. http://www.hlinke.de/vdub-filter/brdcntrl235.zip


Attached Images
File Type: jpg Example 1 - original.jpg (92.5 KB, 96 downloads)
File Type: jpg Examle 2 - VitualDuib mask guide.jpg (91.1 KB, 93 downloads)
File Type: jpg Example 3 - AVisynth crop - add borders.jpg (88.0 KB, 93 downloads)

Last edited by sanlyn; 07-19-2017 at 03:35 PM.
Reply With Quote
  #5  
07-19-2017, 05:15 PM
rocko's Avatar
rocko rocko is offline
Premium Member
 
Join Date: Oct 2010
Posts: 455
Thanked 13 Times in 13 Posts
Quote:
Originally Posted by sanlyn View Post
If your crop operation involves resizing (that's the noob way of doing it), you must deinterlace first. Never resize video while it's interlaced.
Thanks sanlyn, got it, But ok to crop interlace as long as no re-sizing takes place? Sorry, my OCD really kicks in with this subject, and sometimes causes trouble, Plus I sometimes get mixed up between your and Lordsmurf advice. But enough about Me!.. I was under the impression that V-Dub's "Resize" filter isn't really resizing anything because it replaces cropped pixels with the mask boarders all in one operation?... Did start using this filter in V-Dub on my interlaced .avi because I thought V-dub only works with .avi files?
Then de-interlacing with VLC (BAD!). However looks like all this will be mute when I learn to start using Avisynth!...BTW once one learns Avisynth, can one just ignore or even get rid of V-dub? (There goes my OCD again, the less choices the better!)..Plus will post a sample of my latest example, when time, soon. Hope other members learn something too from this!

Last edited by rocko; 07-19-2017 at 05:16 PM. Reason: Add
Reply With Quote
  #6  
07-19-2017, 06:01 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,403
Thanked 1,067 Times in 890 Posts
Quote:
Originally Posted by rocko View Post
BTW once one learns Avisynth, can one just ignore or even get rid of V-dub?
Nope. You need both.

Mask or crop, whatever you think best for yourself. Some like it one way, some the other.
Reply With Quote
  #7  
07-23-2017, 06:16 AM
rocko's Avatar
rocko rocko is offline
Premium Member
 
Join Date: Oct 2010
Posts: 455
Thanked 13 Times in 13 Posts
Just thought I would add some clips (as promised) of my latest masking/cropping efforts using Virtual Dub, Before moving along to using Avisynth.


Reply With Quote
  #8  
07-23-2017, 06:25 AM
juhok juhok is offline
Premium Member
 
Join Date: Sep 2009
Posts: 379
Thanked 99 Times in 84 Posts
You can crop/add borders/resize with Avisynth if that's what you meant.
Reply With Quote
The following users thank juhok for this useful post: rocko (07-23-2017)
  #9  
07-23-2017, 06:43 AM
rocko's Avatar
rocko rocko is offline
Premium Member
 
Join Date: Oct 2010
Posts: 455
Thanked 13 Times in 13 Posts
Here's three short clips. One straight .avi, Then same one Masked, Then same one de-interlaced AFTER Masking. Plus a screenshot from my edits folder, that shows much smaller file size of original 00:01:38 .avi video clip before masking. Then noticed file size is almost 4 times larger after masking with Virtual dub for some reason? (Gunnar is name on one of the Virtualdub De-Interlace filters)

Quote:
Originally Posted by juhok View Post
You can crop/add borders/resize with Avisynth if that's what you meant.
Thanks, Just mask out VHS noise on boarders, no resizing involved.


Reply With Quote
  #10  
07-23-2017, 06:48 AM
juhok juhok is offline
Premium Member
 
Join Date: Sep 2009
Posts: 379
Thanked 99 Times in 84 Posts
All these clips are RGB. They should be kept YUV.

Why are you masking the videos? If you're going to encode them to MP4, crop all bad edges and set pixel aspect ratio when encoding.
Reply With Quote
The following users thank juhok for this useful post: rocko (07-31-2017)
  #11  
07-23-2017, 07:03 AM
rocko's Avatar
rocko rocko is offline
Premium Member
 
Join Date: Oct 2010
Posts: 455
Thanked 13 Times in 13 Posts
Quote:
Originally Posted by juhok View Post
All these clips are RGB. They should be kept YUV.

Why are you masking the videos? If you're going to encode them to MP4, crop all bad edges and set pixel aspect ratio when encoding.
Thanks juhok, will reply later, up all nite, must get some rest for my afternoon job, Thanks.

-- merged --

Quote:
Originally Posted by juhok View Post
All these clips are RGB. They should be kept YUV.

Why are you masking the videos? If you're going to encode them to MP4, crop all bad edges and set pixel aspect ratio when encoding.
Thanks, this question is confusing to me, a bit beyond my knowledge so far, I am a beginner at masking, just learning how to mask out VHS noise, but RGB vesus YUV really has me confused, Thanks.
Reply With Quote
  #12  
07-28-2017, 07:00 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,403
Thanked 1,067 Times in 890 Posts
Quote:
Originally Posted by rocko View Post
Thanks, this question is confusing to me, a bit beyond my knowledge so far, I am a beginner at masking, just learning how to mask out VHS noise, but RGB vesus YUV really has me confused
Hm. It's hard to believe that after capturing and working with video clips and VirtualDub for all this time you aren't aware of which colorspace you're working with.

When working with video and graphics you'll be concerned with two basic colorspace systems: YUV and RGB. To grossly oversimplify a description of these:

YUV is a luminance and chroma (i.e,brightness and color) storage and manipulation system in which three data channels are used to store luminance and color information. The "Y" channel in "YUV" stores luma or brightness values, the "U" channel stores blue-to-yellow values, and the "V" channel stores red-to-green values. These three channel values are stored separately and can be manipulated separately -- that is, with YUV you can adjust brightness without affecting color, or adjust color without affecting brightness. Because luma and color are stored separately this system works with black-and-white video systems, which ignore the color data and display "Y" luminance information only. This B&W compatibility issue is why the current YUV system was invented long ago.

Variations in YUV storage are also a more economical way of storing video information using less data space, such as with broadcast video and DVD and BluRay formats. VHS, SVHS, and many broadcast bands use a 4:2:2 YUV system. 4:2:2 means that for every 4 parts of luma (Y) data there are 2 parts of U data and 2 parts of V data. One colorspace that uses a 4:2:2 system is YUY2. Although there are other 4:2:2 color systems that treat the same data differently, YUY2 is a popular system in wide use that you'll encounter many times, and is similar to the 4:2:2 used for VHS. Note that 4:2:2 systems like YUY2 store 100% of the original luma information and 50% of the original color. This works out OK because visually we humans base "sharpness" on brightness values and less on color. Your cable box outputs digital HD color known as "YCbCr", which is similar to YUY2.

Another common variation is the YUV system used for DVD and BluRay, which is 4:2:0. You'll also encounter another similar system, the consumer DV-AVI format, which is 4:1:1. Both of these systems store 4 parts of luma data with 1 part of U data and 1 part of V data. These 4:2:0 and 4:1:1 systems are widely known as "YV12". YV12 is a primary colorspace used by many Avisynth filters, while Avisynth itself has many sophisticated ways of converting and restoring colorspaces that are usually better than the methods used by many famous NLE's with "Pro" in their names. YV12 stores 50% less color information than YUY2.

There are also 4:4:4 systems in YUV. These store 100% of the available luma and color information. Unless you get involved in some heavier duty mastering systems, you won't be using 4:4:4 YUV any time soon. However, you WILL be using an equivalent 4:4:4 system in the form of RGB. But RGB isn't referred to as 4:4:4 because it doesn't store brightness and color information separately.

Rather, RGB stores brightness and color data in a single coded place. RGB uses one value for the Red, Green, and Blue values in each pixel, which means that it also imbeds brightness values in the same place. If you increase the amount of green in an RGB image, you'll also increase the perceived overall brightness. If you reduce the amount of Green, you'll reduce the perceived overall brightness. You can change the amount of Red, Green, or Blue separately without affecting the other two colors, by changing some of the bit values in RGB-coded pixels. This ability to manipulate RGB pixel-by-pixel without affecting other RGB values is one reason why RGB is used in many color correction systems because of this precision of targeting discrete range and contrast adjustments.

You'd think that converting from YUV to RGB and back and forth would be a simple matter. Dream on. It's not so simple at all, if for no other reason that you'll get numeric rounding errors when you try to make one or two YUV pixels do the work of 4 RGB pixels, especially since each one of those 4 RGB pixels is almost always a slightly different shade of the same color. In downscaling chroma, some color pixels are simply discarded (where will you put 4 red RGB pixels when you only have YUV storage space for 1 or 2?). In upscaling from YUV to RGB, you have 1 row of luma pixels for every two rows of YUV data -- but in RGB you have imbedded brightness in every row of RGB. So you have some interpolation problems to solve. Avisyvth and other apps have come up with some clever operations to do all this with acceptable accuracy (but some apps just do a sloppy job of it). Keep changing these colorspaces back and forth, and you have degradation problems. On top of that, converting interlaced colorspaces is different than converting progressive colorspaces.

There's also another YUV->RGB conversion problem. Most YUV systems store luminance data in a restricted value range in order to protect playback and broadcast systems from wildly out-of-bounds brightness or color values that could blow up your TV set or smoke some cable company hardware. The preferred range of luma values for YUV video storage is y=16 to 235, with chroma at 16-240. This basic value range when interpreted for RGB display is expanded from 16-235 to RGB 0-255, which is the limit of the luma and color band for display. Yes, some scientific instruments can handle more. Are you using them?

I think you can see that if your YUV video has values that are darker than y=16 and brighter than y=255, those values can't be contained in an RGB system that only accepts 0-255. After all, if y=16 is expanded in RGB to RGB 0, what do you think would happen if y already equaled 0? RGB can't accept super blacks below zero, so data below zero is simply clamped to 0 and all the dark detail looks the same, with no differentiation. Effectively, those darker details are destroyed -- if they weren't already out of range and destroyed in YUV, they will definitely be kaput in RGB. The destruction is called clipping. The same thing happens at the bright end -- if you already have y = greater than 235, what do you think would happen if RGB tried to expand that into something brighter than 255? It won't happen. Those out of range bright details will be clipped, i.e, destroyed. This is why tools are used to check original video levels in Avisynth and YUV before converting to RGB for VirtuaLdub or NLE editors.

When you open a video for processing in NLE editors or in VirtualDub, what you see is converted to RGB if for no other reason than for display purposes. If that video is saved as a new file, even if no filters have been applied, most NLE's will save it as converted RGB unless you specify otherwise.

When you save a video out of Virtualdub using "full processing mode", that video has been altered -- converted to RGB whether you want it or not, even if you haven't applied any Virtualdub filters. By default the video is saved as uncompressed RGB, which is 3 times the size of lossless huffyuv YUY2 or Lagarith YUY2, and 4 to 5 times the size of Lagarith YV12.

- To make a sample for posting without changing the original output colorspace, perform the edit in VirtualDub, then change the processing mode using "Video..." -> "direct stream copy", and the output will be saved in the original colorspace. When using "direct stream copy", no RGB conversion will occur and no filters will be applied, even if you have VDub filters mounted.

- To run Virtualdub filters and save the output as any colorspace and lossless compression you want, set "Video..." -> to "full processing mode", set the color depth to the desired colorspace, and set the compression to the desired compressor. Then save the new output file. The incoming video will be converted to RGB for full processing mode, and then saved in the colorspace and compression you specify. Otherwise it's saved by default as uncompressed RGB24.
Reply With Quote
The following users thank sanlyn for this useful post: friendly_jacek (07-28-2017), rocko (07-31-2017), wimvs (07-31-2017)
  #13  
07-28-2017, 10:34 PM
rocko's Avatar
rocko rocko is offline
Premium Member
 
Join Date: Oct 2010
Posts: 455
Thanked 13 Times in 13 Posts
Thanks sanlyn, I will read and try to understand these details, hope others learn too. So much to learn, and I forget a lot, Time spent so far working with video has mostly been just learning how to basically capture and correctly use the hardware/software, plus basic computer knowledge has been long and slow for a 58 year old. Only recently getting back into video after long spurts of leaving it alone, off and on since about 2010, Thanks for all your patience and guidance so far.
Reply With Quote
  #14  
07-29-2017, 12:45 AM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 8,281
Thanked 1,371 Times in 1,206 Posts
Quote:
Originally Posted by sanlyn View Post
Hm. It's hard to believe that after capturing and working with video clips and VirtualDub for all this time you aren't aware of which colorspace you're working with.
Part of it may be my fault. I'm always hesitant to educate on colorspace until other information has been covered first. I save the most confusing (not best) for last. And as you know, I'm not overtly strict about colorspaces either, due to how many steps restoration take, and how steps often force conversion.

Quote:
Originally Posted by rocko View Post
.avi file > Mask/Crop edges > De- Interlace > Convert to .mp4.
Is this proper order, or no? Can you point me to proper guide or thread? (For preparing for uploading video to websites) Thanks
Ideally you'd
1. capture,
2. deinterlace,
3. crop/mask (to ensure good edges),
4. and last encode to delivery format

There's no single guide for this, though this is something you should suggest in the new forum upgrade thread.

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
The following users thank lordsmurf for this useful post: rocko (07-31-2017)
  #15  
07-29-2017, 06:24 PM
rocko's Avatar
rocko rocko is offline
Premium Member
 
Join Date: Oct 2010
Posts: 455
Thanked 13 Times in 13 Posts
Quote:
Originally Posted by juhok View Post
All these clips are RGB. They should be kept YUV.

Why are you masking the videos? If you're going to encode them to MP4, crop all bad edges and set pixel aspect ratio when encoding.
Now I understand why, after reading sanlyn post above, regarding VirtualDub "Full Processing mode" turns them into RGB! Still learning, getting things less mixed up in my mind.

Re: VirtualDub "Full Processing mode"....Thanks, now I understand why some of my clips were RGB AND 5 times larger than YUV. I was aware of the "Direct stream copy" setting for simple editing in VirtualDub, but just let it stay in "Full process" when saving my masked experiments.

Quote:
Originally Posted by lordsmurf View Post
Part of it may be my fault. I'm always hesitant to educate on colorspace until other information has been covered first. I save the most confusing (not best) for last. And as you know, I'm not overtly strict about colorspaces either, due to how many steps restoration take, and how steps often force conversion.


Ideally you'd
1. capture,
2. deinterlace,
3. crop/mask (to ensure good edges),
4. and last encode to delivery format

There's no single guide for this, though this is something you should suggest in the new forum upgrade thread.
Nope, is all my fault, have seen all that mention about colorspace, put it on the back burner, while still barely learning how to properly use VirtualDub to edit!
Very tiny baby steps after all this time, but this thread, especially sanlyns recent and important synopsis about it, has really heled bring it to the forefront now in my cluttered and busy mind! Again, Many life situations and distractions over the past years have prevented me from devoting more time than I would like to this subject, but Thanks for everything so far!
Reply With Quote
  #16  
07-29-2017, 10:51 PM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 8,281
Thanked 1,371 Times in 1,206 Posts
You can only run filters using Full Processing.

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
The following users thank lordsmurf for this useful post: rocko (07-31-2017)
  #17  
07-30-2017, 10:57 PM
rocko's Avatar
rocko rocko is offline
Premium Member
 
Join Date: Oct 2010
Posts: 455
Thanked 13 Times in 13 Posts
Quote:
Originally Posted by lordsmurf View Post
You can only run filters using Full Processing.
Ah! Another "Necessary Evil"!
Reply With Quote
  #18  
07-31-2017, 12:13 PM
bever bever is offline
Free Member
 
Join Date: Nov 2016
Location: Pac Northwest
Posts: 92
Thanked 11 Times in 11 Posts
Quote:
Originally Posted by rocko View Post
Ah! Another "Necessary Evil"!
VirtualDub help file is a great resource. But you have to browse through it (ugg) and it does take time. I had mostly skipped it, depended on Digitalfaq and Wikipedia and misc webpages. I guess the pros here assume (rightfully so) that you have already read the help file.

It explains why you need to select compression vidub.JPG

and processing mode
You must be logged in to view this content; either login or register for the forum. The attached screen shots, before/after images, photos and graphics are created/posted for the benefit of site members. And you are invited to join our digital media community.


I still need to read (and absorb) a bunch more.

btw Sanlyn did one of the best easy to understand colorspace explanations I have seen yet in this thread.


Reply With Quote
The following users thank bever for this useful post: rocko (07-31-2017)
  #19  
07-31-2017, 04:19 PM
rocko's Avatar
rocko rocko is offline
Premium Member
 
Join Date: Oct 2010
Posts: 455
Thanked 13 Times in 13 Posts
Thanks bever, "ugg" is right!, so much to learn! I just re-read or absorbed sanlyns post above about colorspace, but had to do it right after waking up, when my mind is "fresh", before the day progress on.
Reply With Quote
  #20  
07-31-2017, 04:40 PM
rocko's Avatar
rocko rocko is offline
Premium Member
 
Join Date: Oct 2010
Posts: 455
Thanked 13 Times in 13 Posts
Quote:
Originally Posted by lordsmurf View Post
Ideally you'd
1. capture,
2. deinterlace,
3. crop/mask (to ensure good edges),
4. and last encode to delivery format

There's no single guide for this, though this is something you should suggest in the new forum upgrade thread.
Would I suggest a guide for colorspace, or just the simple steps for as you listed here?
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Properly Crop the Overscan in VirtualDub [GUIDE] kpmedia Edit Video, Audio 14 03-28-2018 10:53 AM
For VHS to DVD, mask (crop) before other restore filters? Laserer Restore, Filter, Improve Quality 34 04-09-2017 09:51 PM
What order for my hardware workflow? chase317 Project Planning, Workflows 2 03-11-2014 10:50 PM
Will a TV always deinterlace video? premiumcapture Restore, Filter, Improve Quality 6 12-27-2013 11:06 AM
Lens distance for FX vs DX/crop lenses on digital SLR? manthing Photo Cameras: Buying & Shooting 1 08-06-2012 12:55 PM

Thread Tools



 
All times are GMT -5. The time now is 11:33 AM