I capture and process a lot of tv programming for later viewing. I'd like to automate the process more so that I'm spending less time processing them and more time enjoying them. My captures usually have a couple of garbage scan lines at the top, so I use the AviSynth feature in ffdshow to remove them before they get passed into AutoGK, like this:
Crop(8,2,-12,0)
AddBorders(8,2,12,0)
The reason I keep the black pixels around the top and sides is so that the final video will be positioned correctly on my tv when I view it (just the way it came over the cable). I realize AGK usually resizes the video smaller, but once my DVD player sizes it back up, it should fit the screen just right. For widescreen programming, I use:
Crop(8,58,-12,-56)
AddBorders(8,0,12,0)
I don't add back the black bars at top and bottom because a)it allows for lower compression and higher quality and b) the DVD player centers the video anyway, so I'm not missing anything, even if it isn't positioned exactly the way it was on the original airing. Of course, not every capture falls neatly into one of these two categories, so I inspect every one and adjust the script as necessary before I AGK it, which brings me to my question.
Does anyone know a way, using Avisynth to automatically detect the number of garbage and/or black pixels at the edges and process them accordingly? This would allow me to use a single script for all of my videos and not have to inspect every one and adjust accordingly.
Another concern relating to my script, though not as big of a concern to me, is that AGK does color correction, and I'm afraid that after using AddBorders (which adds pure black), the black level correction will not be as good as it could be. Is AGK smart enough not to consider edge pixels when doing the color correction? Is there a way in Avisynth to detect the level of the darkest shadow in the frame and add borders of that color instead of pure black?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 5 of 5
Thread
-
-
Don't know of anything. Maybe try a few things with:
FillMargins(8,2,12,0) # (left, top, right, bottom)
instead of crop/addborders.
FillMargins(12,4,16,0) will give some leeway & cost you a few pixels, but will you ever notice?
Filter is, probably, already on your PC. Or here. http://avisynth.org/warpenterprises/ -
Yeah, I don't know of any way either, for AutoGK or anything else to detect garbage pixels and automatically crop them off. As for detecting and cropping black, AutoGK's AutoCrop does a decent job:
http://forum.doom9.org/showthread.php?t=87602&highlight=autocrop
You don't have to worry about black levels for the color correction. It uses ColorMatrix and is just doing a BT.709 to BT.601 conversion when necessary. You can read about it here:
http://forum.doom9.org/showthread.php?t=82217&highlight=colormatrix
and an in-depth discussion here:
http://forum.doom9.org/showthread.php?t=133982&highlight=colormatrix
Or download the ColorMatrix filter and read the docs. -
As mentioned, Autocrop will do a good job of detecting black.
But 'garbage" is a lot harder to define, I think.
If you use AvsP, it has a crop editor that might be useful.
You drag the borders, then it inserts the crop line in your script.
You could probably write a macro to do the matching AddBorders.
If you ask in the Doom9 forum, someone might even do that for you. -
I played around with writing a script to do this automatically, but it was, shall we say computationally expensive. Those of you who know more about AviSynth and the available filters, please don't laugh at me, but I was cutting the video into two equal length clips and using layer() to combine them. I did this repeatedly, until the resulting clip was one frame long. This was so the levels in the frame would be representative of the levels in the full length video over all. My plan was to crop down to key areas of the frame and use AverageLuma etc to take appropriate action conditionally, but I never figured out how to use AverageLuma. Every time I tried, I got the error message "I don't know what 'AverageLuma' means."
EDIT: I'd rather not use AGK's autocrop because there's no way to tell it to crop in only one dimension instead of both. Plus there's pretty consistently garbage in the first couple scan lines of my captures that would throw it off anyway.
Similar Threads
-
Garbage In, Garbage Out: An intro to restoring
By lordsmurf in forum RestorationReplies: 8Last Post: 15th Dec 2018, 11:16 -
Help with FLV (AviDemux) - Cropping 8 pixels from right...
By tigerb in forum Newbie / General discussionsReplies: 8Last Post: 28th Aug 2010, 16:23 -
Adding 15 black rows of pixels to the top and bottom of an entire clip
By Terrah in forum EditingReplies: 8Last Post: 20th Apr 2010, 22:48 -
black pixels on white video?
By huttonhenrysfinest in forum Software PlayingReplies: 4Last Post: 23rd Feb 2008, 07:01 -
PAL 4:3 to 16:9 but black L/R stripes instead of cropping
By jmwismer in forum Video ConversionReplies: 17Last Post: 3rd Jan 2008, 10:18