Go Back    Forum > Featured > General Discussion

Reply
 
LinkBack Thread Tools
  #1  
01-21-2015, 07:29 PM
premiumcapture premiumcapture is offline
Free Member
 
Join Date: Dec 2013
Location: Boston, MA
Posts: 585
Thanked 73 Times in 66 Posts
I have no idea where to get started. I have XML and Java experience but I don't know enough about Avisynth to know how to load a Huffy video. I am sure once the video is loaded the filtering will not be so difficult, but what about encoding?

I have always used VirtualDub filters and not ventured too much into Avisynth. I have a good idea of what I want to do but need to load filters.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
01-21-2015, 07:48 PM
NJRoadfan NJRoadfan is offline
Premium Member
 
Join Date: Sep 2010
Posts: 1,161
Thanked 363 Times in 298 Posts
Encoding is usually done by loading the completed script into something like VirtualDub or a dedicated encoder. I also occasionally use a tool called AVANTI to do compression/encoding, which is a combined AviSynth and FFmpeg front end.
Reply With Quote
  #3  
01-22-2015, 07:10 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,312 Times in 984 Posts
Quote:
Originally Posted by premiumcapture View Post
I have no idea where to get started. I have XML and Java experience but I don't know enough about Avisynth to know how to load a Huffy video. I am sure once the video is loaded the filtering will not be so difficult, but what about encoding?

I have always used VirtualDub filters and not ventured too much into Avisynth. I have a good idea of what I want to do but need to load filters.
Avisynth isn't an encoder. Neither is VirtualDub, although many simply feed VirtualDub output to an encoder or compression codec (an inefficient way of doing it IMO, but convenient for those who like to run multiple processing stages in one long step). Avisynth outputs decoded, uncompressed frames. You can monitor those frames in VirtualDub and output them as you wish. I usually output VirtualDub results to losslessly compressed Lagarith AVI, then feed the AVI to an encoder in a separate step. Many people open and clean a video with Avisynth and run that script in HCenc, which can encode Avisynth's output. Many use something like MEGUI, which uses an Avisynth script to open and filter the video, then encodes to any of several formats. How you want to handle Avisynth's output is open to many choices.

You can open a video using one of Avisynth's builtin decoders (AviSource, DirectShowSource) or any of several plugins for other source formats like QuickTime, mp4/mkv, MPEG (DGIndex project files), .TS, M2T, etc. etc.

After your script opens the source video, you apply Avisynth filters. Or you can just open the file for processing with VirtualDub filters, or you can run both sets of filters at the same time. Opening huffyuv AVI's directly in Avisynth is a rather haphazard way of doing it due to the way VirtualDub handles colorspace conversions from YUV (YV12, YUY2, etc.) to RGB. Avisynth has more precise ways of making those conversions. along with greater precision in deinterlace/reinterlace, inverse telecine, resizing, etc.

Let's say you have a huffyuv AVI located at D:\my videos\filename.AVI. Use this statement:
Code:
AviSource("D:\my videos\filename.AVI")
What you do after that depends on the video and what you want to do with it. If you want to modify that video correctly for use with VirtualDub filters:

interlaced video:
Code:
ConvertToRGB32(interlaced=true, matrix= "Rec601")
progressive video:
Code:
ConvertToRGB32(interlaced=false, matrix="Rec601")
A few Avisynth filters will work in YUY2 only. Some work in YV12 and YUY2. Most work in YV12. Many are designed only for progressive video -- you can get to that point by using deinterlacers like yadif or QTGMC, or remove telecine with TIVTC before applying filters. Another method for getting to a quasi-progressive state is to use SeparateFields(), then do some processing, after which you would re-weave the separated fields together again with Weave(). You would normally not apply filters such as those that work with chroma bleed, chroma shift, most denoisers, frame repair, spot removers, resizers, etc., on interlaced frames. A heavy-duty popular denoiser is MCTemporalDenoise, which has a parameter letting you specify whether the video is interlaced or not. Avisynth processing occurs line by line, in the order the coded lines are listed.

Like VirtualDub filters, Avisynth filters are loacted in the Avisynth plugins folder. A plugin file ending in .dll or .avsi will load automatically when the script is run. Some plugins come in the form of an .avs script (which you should not edit unless you know what you're doing). An .avs plugin doesn't load automatically, but you can get it going in the script with the Import statement:
Code:
Import(C:\Program files\Avisynth 2.5\plugins\name.avs")
Why a developer names his filter as avs instead of .dll or avsi is up to the developer and how the filter is designed. The QTGMC deinterlacer is actually an .avsi script, but it's about 200+ lines long. Never fear: as an .avsi, it loads automatically.

So, friends, much of what you would do inside an Avisynth script depends on the video and its requirements.....which is another story altogether.

By the way, in case you don't know: you save your Avisynth script as an .avs file. Don't keep your personal .avs scripts in the plugins folder. Any other place will do, usually with the other files in your video project. You can open your avs script directly in Virtualdub with "File..." -> "open video file...". Or you can right-click on the avs file, click "Open" in the popup menu, and select to open with VirtualDub.exe.

Last edited by sanlyn; 01-22-2015 at 07:52 AM.
Reply With Quote
  #4  
01-22-2015, 10:45 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,312 Times in 984 Posts
OOOOps. Me make booboo, as they say, and couldn't edit the previous post. Anyway what I wrote in paragraph 3 above was:

Quote:
Originally Posted by sanlyn View Post
Opening huffyuv AVI's directly in Avisynth is a rather haphazard way of doing it due to the way VirtualDub handles colorspace conversions from YUV (YV12, YUY2, etc.) to RGB.
My, my. What I meant to say was:

Opening huffyuv AVI's directly in VirtualDub is a rather haphazard way of doing it due to the way VirtualDub handles colorspace conversions from YUV (YV12, YUY2, etc.) to RGB.

Mea culpa. Even I choked when I saw that one later.
Reply With Quote
  #5  
01-23-2015, 07:08 PM
premiumcapture premiumcapture is offline
Free Member
 
Join Date: Dec 2013
Location: Boston, MA
Posts: 585
Thanked 73 Times in 66 Posts
Thanks. I'll play around with that and let you know how it goes.
Reply With Quote
  #6  
01-24-2015, 05:11 AM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 13,828
Thanked 2,503 Times in 2,128 Posts
Avisynth is a scripted video language. It's more like DOS than Java/XML. It's just a command interface to use "programs" (DLL filters), with a handful already included.

This loads the video:
Code:
AviSource("C:\video.avi")
I've been working on this, as time allows: http://www.digitalfaq.com/forum/news...light=avisynth

I have some more updates for the MultiScript.

As far as I know, Avisynth just taps into the system codec library. It doesn't have it's own Huffyuv codec, or codec library. So if Huffyuv is installed on the system, AviSource() will see it.

Non-AVI uses DirectShowSource() -- which isn't that good.

You also have ffmpeg to load MPEG.

Learn to use AvsPmod.

- Did my advice help you? Then become a Premium Member and support this site.
- For sale in the marketplace: TBCs, workflows, capture cards, VCRs
Reply With Quote
  #7  
01-28-2015, 04:56 PM
premiumcapture premiumcapture is offline
Free Member
 
Join Date: Dec 2013
Location: Boston, MA
Posts: 585
Thanked 73 Times in 66 Posts
Got this working, so far so good

I remember a while back there was a post on videohelp or doom9 that listed the types of filtering and the best order on how to perform them (denoise, sharpen, deinterlace, etc....). Does anyone have a personal list like that and preferred filters to go along with it? I have been making good headway with the filters I'm familiar with but its good to compare notes
Reply With Quote
  #8  
01-28-2015, 11:57 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,312 Times in 984 Posts
There have been a few hundred such lists at videohelp, doom9, here, and elsewhere. They're all mostly alike and mostly a little different. One day somebody will tote up 1000 of these sequence lists and see how much they have in common. Obviously the first thing you have to do is open the video -- you'd be surprised how many lists forget to mention this, which confuses many newbies.

One sequence you mentioned above needs attention: (quote) "denoise, sharpen, deinterlace, etc...." (unquote). Those three steps should be performed in reverse order: deinterlace, denoise, sharpen. And don't forget to re-interlace, except for web use. That sounds like 3 simple steps. Sometimes they are, sometimes not. Depends on what you're dealing with. For example, most of Avisynth's most effective denoisers are designed for non-interlaced video. How you get to that state was mentioned earlier. Video with telecine is not progressive -- it shouldn't be deinterlaced, but is inverse-telecined instead. Field-blended or frame-blended video is often treated as progressive and encoded by the maker as interlaced, compounding many issues (and most of it can't be repaired anyway). But sometimes deblenders work, up to a point. Sometimes duped frames are used to change frame rates, so decimation filters are used, or filters can be applied by separating alternate fields and reweaving them (Interleave()) afterward. Or sometimes you can use SeparateFields() and re-weave later.

Once you actually resize a piece of interlaced or telecined video while it's still interlaced or telecined, you've pretty well imbedded combing and double-image artifacts permanently. So let's expand the working list a bit:

- open the file in Avisynth

- determine the frame structure and any general problems by looking at the video, sometimes frame by frame. Look for levels and color problems, crushed blacks, blown-out highlights. Use histograms and vectorscopes. Remember that many filters and resizing techniques work poorly with invalid video levels. This initial checkout is to help you scope out your needs rather than apply random processing that later has you clinging to the ceiling/scratching your head in puzzlement/screaming at your mate or children.

- deinterlace (or inverse telecine, deblend, or whatever), if your filtering will need it.

- denoise. Clean up motion artifacts, block noise, edge halos and ghosting and ringing, chroma bleed, chroma shift, chroma noise, rainbows, split and broken edges or jaggies, mosquito noise, tape noise, spots, comets, dropouts, border noise or edge stains on tape sources, compression artifacts from VHS-DV captures or previous encodes, etc., etc., jitter or frame hopping, and so forth. This is not a complete list.

- sharpen. Be careful with these things, they're sharp! Sometimes you don't need this. It's easy to overdo. Anyone with decent vision can see unrealistic oversharpening right off the bat. Many people like oversharpening because, well, they just like things to look tacky. There are different types of sharpeners. You can tell some of them to sharpen edges only, no-edges only, or sharpen everything and then smooth the worse side effects, and so on.

- If you're going to resize, do it now. Tweak the resized image if needed. It usually is needed, to some degree. Look for color banding, posterizing, edge ringing, moire, stair-stepping and other resizing artifacts. Some resizers are worse than others. Apply anti-banding filters and film graining effects or other filters to make things look earthly again.

There are long debates about whether to sharpen before resizing, or after, or before and after. Best answer: it depends on (a) the specific video, and (b) whether you're upscaling or downscaling. Then you have special cases, like 1080i GoPro oversharpened video going down to 720p or even 480i -- this operation almost always requires pre-resize gaussian blurring, not sharpening, or the resulting line twitter will make your TV screen buzz.

- Levels and color correction. If you neglect this, most people won't notice because most consumers don't know one color from another anyway and prefer oversaturation, blooming reds and neon blues to make them feel emotionally certain that the video really is in color and that it looks just like grandma's cheap Sansui CRT. (I'm not kidding). Sometimes working in YUV can get colors right, but most analog or uTube sources will need more precise and flexible RGB controls. Convert between colorspaces properly and return to YV12 when it's over. If your luma and chroma stretch to invalid levels for digital video, they will look weird on all TVs (some of which will blank out or blink if the levels are bad enough), and uTube will apply ruthless clamping filters so that your volcanic video won't cause their online media players to vibrate and strobe onscreen.

- If you're not going on the web with the results, then re-interlace or re-apply telecine. Finally, encode. If PC-only display is your goal, you don't really need to re-interlace. But you shoudn't complain when your sports and fast-action videos look a little clumsy on horizontal moves and pans, and rolling credits get choppy and judder, even on good PC media players. You'll have to make up your own mind on this. Recall that commercial DVD is interlaced or telecined. Recall that BluRay/AVCHD formats are interlaced or telecined except for film-based frame rates and 720p video. Recall that people get into fisticuffs and friendships are broken over this matter. But none of that debate or angst seems to have dissuaded the retail disc or broadcasting industries from doing what they do.

- From there, go to whatever the current fad is -- authored disc, data disc, drive storage, cloud, USB key chains, refrigeration, or whatever.

You'll see countless exceptions and variations in aspects of this sequence, as well as shorter lists and longer ones.
Reply With Quote
The following users thank sanlyn for this useful post: premiumcapture (01-31-2015)
  #9  
01-29-2015, 08:34 AM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 13,828
Thanked 2,503 Times in 2,128 Posts
The proper sequence can vary. In my guide, I'm trying to explain some of the reasoning behind it.

- Did my advice help you? Then become a Premium Member and support this site.
- For sale in the marketplace: TBCs, workflows, capture cards, VCRs
Reply With Quote
  #10  
01-31-2015, 11:23 PM
premiumcapture premiumcapture is offline
Free Member
 
Join Date: Dec 2013
Location: Boston, MA
Posts: 585
Thanked 73 Times in 66 Posts
Lots of great info here and still looking this over and planning (will have more questions later too), but for the average 30 minute camcorder tape, how much time does doing all this require, not including processing time?

Quote:
Originally Posted by sanlyn View Post
There have been a few hundred such lists at videohelp, doom9, here, and elsewhere. They're all mostly alike and mostly a little different. One day somebody will tote up 1000 of these sequence lists and see how much they have in common. Obviously the first thing you have to do is open the video -- you'd be surprised how many lists forget to mention this, which confuses many newbies.

One sequence you mentioned above needs attention: (quote) "denoise, sharpen, deinterlace, etc...." (unquote). Those three steps should be performed in reverse order: deinterlace, denoise, sharpen. And don't forget to re-interlace, except for web use. That sounds like 3 simple steps. Sometimes they are, sometimes not. Depends on what you're dealing with. For example, most of Avisynth's most effective denoisers are designed for non-interlaced video. How you get to that state was mentioned earlier. Video with telecine is not progressive -- it shouldn't be deinterlaced, but is inverse-telecined instead. Field-blended or frame-blended video is often treated as progressive and encoded by the maker as interlaced, compounding many issues (and most of it can't be repaired anyway). But sometimes deblenders work, up to a point. Sometimes duped frames are used to change frame rates, so decimation filters are used, or filters can be applied by separating alternate fields and reweaving them (Interleave()) afterward. Or sometimes you can use SeparateFields() and re-weave later.

Once you actually resize a piece of interlaced or telecined video while it's still interlaced or telecined, you've pretty well imbedded combing and double-image artifacts permanently. So let's expand the working list a bit:

- open the file in Avisynth

- determine the frame structure and any general problems by looking at the video, sometimes frame by frame. Look for levels and color problems, crushed blacks, blown-out highlights. Use histograms and vectorscopes. Remember that many filters and resizing techniques work poorly with invalid video levels. This initial checkout is to help you scope out your needs rather than apply random processing that later has you clinging to the ceiling/scratching your head in puzzlement/screaming at your mate or children.

- deinterlace (or inverse telecine, deblend, or whatever), if your filtering will need it.

- denoise. Clean up motion artifacts, block noise, edge halos and ghosting and ringing, chroma bleed, chroma shift, chroma noise, rainbows, split and broken edges or jaggies, mosquito noise, tape noise, spots, comets, dropouts, border noise or edge stains on tape sources, compression artifacts from VHS-DV captures or previous encodes, etc., etc., jitter or frame hopping, and so forth. This is not a complete list.

- sharpen. Be careful with these things, they're sharp! Sometimes you don't need this. It's easy to overdo. Anyone with decent vision can see unrealistic oversharpening right off the bat. Many people like oversharpening because, well, they just like things to look tacky. There are different types of sharpeners. You can tell some of them to sharpen edges only, no-edges only, or sharpen everything and then smooth the worse side effects, and so on.

- If you're going to resize, do it now. Tweak the resized image if needed. It usually is needed, to some degree. Look for color banding, posterizing, edge ringing, moire, stair-stepping and other resizing artifacts. Some resizers are worse than others. Apply anti-banding filters and film graining effects or other filters to make things look earthly again.

There are long debates about whether to sharpen before resizing, or after, or before and after. Best answer: it depends on (a) the specific video, and (b) whether you're upscaling or downscaling. Then you have special cases, like 1080i GoPro oversharpened video going down to 720p or even 480i -- this operation almost always requires pre-resize gaussian blurring, not sharpening, or the resulting line twitter will make your TV screen buzz.

- Levels and color correction. If you neglect this, most people won't notice because most consumers don't know one color from another anyway and prefer oversaturation, blooming reds and neon blues to make them feel emotionally certain that the video really is in color and that it looks just like grandma's cheap Sansui CRT. (I'm not kidding). Sometimes working in YUV can get colors right, but most analog or uTube sources will need more precise and flexible RGB controls. Convert between colorspaces properly and return to YV12 when it's over. If your luma and chroma stretch to invalid levels for digital video, they will look weird on all TVs (some of which will blank out or blink if the levels are bad enough), and uTube will apply ruthless clamping filters so that your volcanic video won't cause their online media players to vibrate and strobe onscreen.

- If you're not going on the web with the results, then re-interlace or re-apply telecine. Finally, encode. If PC-only display is your goal, you don't really need to re-interlace. But you shoudn't complain when your sports and fast-action videos look a little clumsy on horizontal moves and pans, and rolling credits get choppy and judder, even on good PC media players. You'll have to make up your own mind on this. Recall that commercial DVD is interlaced or telecined. Recall that BluRay/AVCHD formats are interlaced or telecined except for film-based frame rates and 720p video. Recall that people get into fisticuffs and friendships are broken over this matter. But none of that debate or angst seems to have dissuaded the retail disc or broadcasting industries from doing what they do.

- From there, go to whatever the current fad is -- authored disc, data disc, drive storage, cloud, USB key chains, refrigeration, or whatever.

You'll see countless exceptions and variations in aspects of this sequence, as well as shorter lists and longer ones.
Reply With Quote
  #11  
02-01-2015, 12:26 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,312 Times in 984 Posts
No answer to that question. Depends on what you're doing in Avisynth and on the video at hand. You don't run filters or run steps you don't need. If there's no problem with a lot of block noise or color banding, don't use filters for it. If you don't resize, skip that step (Obviously, don't resize if your input frame size and your output frame size are the same. Don't resize standard def VHS or home made recordings to HD -- it's a complete waste of time and looks goofy when you're finished). If color and levels are OK, skip it. If you don't have to deinterlace, skip it. If you need complex filters, optimize to run no slower or faster than you need. For example, QTGMC in "super fast" mode can deinterlace at about 40 fps on my PC, which is no powerhouse. Run it at "medium" speed all by itself and it denoises like a champ and outputs double-frame-rate video at about 15 to 20 fps. Yadif deinterlacing is fast enough for real-time playback in several media players and it does do some interpolation work to expand interlaced fields into full images, but it doesn't denoise like QTGMC. There's a special super-fast QTGMC mode that does some repair work and uses yadif for the basic deinterlacing. There's a special QTGMC mode to clean up many motion and shimmer problems in video that's not interlaced, and other settings to do the same thing on interlaced video, and both options run at approximately (but not the same) speed. Take your pick.

Every Avisynth plugin is a specialized piece of work. There's no average speed for any of them. Strong denoisers are slow. Light denoisers are fast. Line conditioners tend to be very fast. Anti-alias filters are about medium speed. Color correction is too fast to worry about. Smooth dithering for color and levels corrections are a bit slower, but still too fast to see a difference. There are slower sharpeners and faster ones, depending on what you expect from them. And so on.

A better question: what is it that you want to do in Avisynth, and what are the problems with the video you mentioned? The answers to that question will change if you have another video with different problems. Every video is different. That's true of any application that you set up and customize to work with any video.

Last night I had 4 cleaned up video clips, each an average of about 1.5 minutes. In Avisynth I joined all 4 of them and added the audio track to each plus a 2-second fade to black at the end. I don't know how long it actually took because the progress bar popped up and disappeared by the time the output was finished, so I didn't have time to read what the progress bar said.
Reply With Quote
  #12  
02-06-2015, 11:14 PM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 13,828
Thanked 2,503 Times in 2,128 Posts
Lately I've had some really lousy videos that needed advanced filtering. There is easily 4-5 passes here, and several of them are only 2fps on Core 2 Duo systems. (Newer processors can go faster, but it'll still be under 10fps at best, probably just 4-6fps.)

Video is not a task for the impatient!

- Did my advice help you? Then become a Premium Member and support this site.
- For sale in the marketplace: TBCs, workflows, capture cards, VCRs
Reply With Quote
  #13  
02-14-2015, 12:27 AM
irruzzz irruzzz is offline
Free Member
 
Join Date: Feb 2015
Posts: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by lordsmurf View Post
Avisynth is a scripted video language. It's more like DOS than Java/XML. It's just a command interface to use "programs" (DLL filters), with a handful already included.

This loads the video:
Code:
AviSource("C:\video.avi")
I've been working on this, as time allows: http://www.digitalfaq.com/forum/news...light=avisynth

I have some more updates for the MultiScript.

As far as I know, Avisynth just taps into the system codec library. It doesn't have it's own Huffyuv codec, or codec library. So if Huffyuv is installed on the system, AviSource() will see it.

Non-AVI uses DirectShowSource() -- which isn't that good.

You also have ffmpeg to load MPEG.

Learn to use AvsPmod.
and can you upload all plugins here http://www.digitalfaq.com/forum/news...light=avisynth ?
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Basics when choosing shared, VPS or dedicated hosting? Rai_Yan Web Hosting 3 02-02-2015 03:20 AM
Need to brighten the dark video with AVISynth metaleonid Restore, Filter, Improve Quality 6 07-23-2014 07:57 AM
Video conversion service advice? also HuffYUV vs DV Kereellis Project Planning, Workflows 12 02-16-2010 01:49 PM

Thread Tools



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