Log in

View Full Version : AVCHD and Avisynth filters?


hollywood10s
20th April 2008, 20:41
I am making videos for my website using a AVCHD camcorder and I'm wondering what filters I should use to get the most out of my encode using x264 in Megui? If I understand it correctly avisynth filters fix up the video source before it is encoded so that x264 can work as efficiently as possible? My source files are 1440x1080 AVCHD and they will be resized to 720x405 for viewing through my website. I would like to get the highest quality possible at a somewhat low bitrate (500kbps-1500kbps) Some people have mentioned Hqdn3d and I will try it but I wanted to know if there were any other filters that work well with HD source. I have read a lot of threads about different denoisers and such but I'm a little new to this and I don’t believe there is a ton of noise or other artifacts so I don’t know if filters will help or not. Anything to help in the compression and quality I'm willing to try. I am trying to gather as much info before testing because at the moment I’m working on an older AMD that takes a long time to encode. Thanks for all of your help.

cogman
20th April 2008, 23:42
I am making videos for my website using a AVCHD camcorder and I'm wondering what filters I should use to get the most out of my encode using x264 in Megui? If I understand it correctly avisynth filters fix up the video source before it is encoded so that x264 can work as efficiently as possible? My source files are 1440x1080 AVCHD and they will be resized to 720x405 for viewing through my website. I would like to get the highest quality possible at a somewhat low bitrate (500kbps-1500kbps) Some people have mentioned Hqdn3d and I will try it but I wanted to know if there were any other filters that work well with HD source. I have read a lot of threads about different denoisers and such but I'm a little new to this and I don’t believe there is a ton of noise or other artifacts so I don’t know if filters will help or not. Anything to help in the compression and quality I'm willing to try. I am trying to gather as much info before testing because at the moment I’m working on an older AMD that takes a long time to encode. Thanks for all of your help.

The best thing you can do download avsp and then look at the different filters as you apply them (with the image blown up to huge sizes).

What you will find is that in some situations one filter fixes a problem quiet well while in others it fails miserably.

That being said, I like fft3dgpu, fft3dfilter, and fluxsmootht for denoising. dfttest works pretty good as well. MVTools is supposed to be the really good as well, but it comes at the price of more complex scripts and a slower encoding time.

If you have a multi-cored computer you will definitively want to check out the MT plugin to help speed up the script processing.

Mostly, with denoising, you don't want the output picture to be hugely different from the input picture, maybe a little cleaner looking (less grain) and possibly slightly sharper (the limited sharpening filter works well I hear). The end goal is usually to get the picture to compress better (sharping usually makes the video compress worse.)

Re-reading your post, you DEFINITIVELY want to use AvsP. It will give you pictures of individual frames after denoising saving lots of time, after that encode short segments using the trim function in avisynth. Once you are happy with that, encode the full thing and marvel at the beauty of it.

One last thing, for a resizing filter I like to use Spline36resize. Some people like Lancroz4resize (I think thats how you spell it) and I have heard blackmanresize in the avisynth beta is supposed to be fairly good as well.

You should note that order of operation is important when writing scripts. I prefer to do them in the order of Noise_filter->sharpen->tweak Colors->resize. But if you are really pressed for time then you can put resize in front of all that to get a faster encode (if you are downscaling, definitively don't put it in front if you are upscaling IMO).


Good luck, Oh, btw, your soul belongs to us now :devil:

Guest
20th April 2008, 23:52
I think you are going about it the wrong way, and could develop the disease called filteritis. Instead of looking at the universe of filters and asking which should I use, you should look at your video and ask what needs correcting. So, what needs correcting in your videos?

Blue_MiSfit
21st April 2008, 01:05
Well said. Some samples are in order if you're looking at a specific case.

In general, if you're recording from an AVCHD camorder, chances are it's consumer grade, and most likely has a fair amount of noise, especially if its a single chip variety. I've found that DV cameras tend to have a lot of chroma noise, so I would imagine this extends to AVCHD cameras as well. You might want to try out fft3dfilter/ fft3dgpu in their chroma processing modes like this:

fft3dgpu(plane=3, sigma=2) #moderate strength, chroma only
fft3dgpu(plane=3, sigma=4) #aggressive strength, chroma only

Just a couple suggestions :)

~MiSfit

hollywood10s
21st April 2008, 03:31
Most of the videos I will be encoding are fishing videos and have a lot of moving water and some other minor movement. I also do some tutorials that are more still video. Do you guys need still samples and if so how do I capture them from my videos? Or do you want a short video clip to look at? Im sure it does need some work with noise and other things my eyes just arent trained to see the imperfections. The videos look nice and clear to me :) Let me know what you guys need to give some more insite. Thanks again

Blue_MiSfit
21st April 2008, 04:05
We need video samples, unprocessed. I'm not sure how to extract these from AVCHD. What type of files do you have - M2Ts?

~Misfit

hollywood10s
21st April 2008, 04:53
They are MTS files. I have ulead video studio 11 and vegas 8.0.

Blue_MiSfit
21st April 2008, 06:28
Okay, try using TSMuxer to split out a small section of video = 10 seconds or so.

~MiSfit

Guest
21st April 2008, 12:51
Im sure it does need some work with noise and other things my eyes just arent trained to see the imperfections. The videos look nice and clear to me :) Classic early onset filteritis.

Blue_MiSfit
21st April 2008, 19:04
:D rofl!

It's usually safe to assume that almost anything can use at least a _little_ filtering, especially if he's trying to push 720p at under 2mbit with lots of water / motion etc... let's give the guy a chance ;)

~MiSfit

hollywood10s
22nd April 2008, 07:29
Im getting a "cant get data stream file" error when trying to open the MTS file using TSMuxer. Is there another way to go about getting a small clip for you guys. I have tried using ulead to output a clip to the original file type but its not playable. Here is a file I made of a short clip (http://www.megaupload.com/?d=KF84S8YJ). It is saved in the original filetype AVCHD. I hope you guys can view it. If not let me know if there is another way to get a sample to you.

Blue_MiSfit
22nd April 2008, 08:02
Your sample looks great to me.

I don't think it has enough resolution to merit 1080p, so I bob-deinterlaced it to 60p with TDeint, and then resized it to 720p. Looks fantastic, great motion, little to no noise.


AVCSource("C:\Users\Misfit\Desktop\sample_fishing.dga")
MT("
assumetff()
tdeint(mode=1)")
lanczosresize(1280,720)


I MT'd the deinterlace routine, so you can do without that if you want.

Try 720p60!

Consumer grade HD Cameras are very impressive these days!

~MiSfit

hollywood10s
22nd April 2008, 18:12
I guess Im not crazy, I thought it looked pretty good! So using the deinterlace option TDeint will automatically bob-deinterlace it to 60p? I read that this means that it doubles the number of frames in the video, right? Will this method help me lower the final bitrate maybe? The way I was doing the process before was outputing the AVCHD file to HDV (1440x1080) then loading that file into Megui and using yadif to deinterlace then lanczos resize then encode. Will this new method below create a better final enocode?

So my workflow should start by editing the video file in vegas or ulead, then use debugmode avi (let it run in the background while it encodes through Megui). Set up my avisynth script similar to what you have done (tdeint deinterlace), resize and let megui do the encoding. Then Im done!!

I will try this out on a few samples and see how it looks. So I dont need to mess around with any filters then (to get the vidoe to compress more)? Thanks again for helping me understand all of this. Its a lot of information to take in but Im pretty good at learning fast. The website that Im working on is my first, along with editing the picture files in photoshop, doing all of the video editing and encoding and all of the website updates!! Its all been a very steep learning curve but its very rewarding when it comes together.

Blue_MiSfit
22nd April 2008, 18:31
Tdeint can output same rate (30p) or double rate (60p). Tdeint(mode=1) is double rate (bobbing) as is yadif(mode=1)

Double rate looks more lifelike, since it preserves the original 59.94 pictures per second inherent with 29.97fps interlaced.

It may prove too challenging to encode / decode. 720p60 isn't easy. If that's true, you can just do tdeint() - which will same rate deinterlace (30p)

You can try some denoising filters, but your video is pretty durn clean!

~MiSfit

hollywood10s
22nd April 2008, 19:12
Very good. Is Tdeint(mode=1) the same as Tdeint(order=1)? I think it is, just wanted to make sure.

Blue_MiSfit
22nd April 2008, 19:14
Nope :)

The order parameter specifies the field order - be it top field first or bottom field first. The mode parameter specifies the mode tdeint operates in.

Check the manual for more detailed information. ;)

~MiSfit

hollywood10s
22nd April 2008, 19:54
So in the past my avisynth script said (yadif=order1) so this means that I was encoding it a 30p instead of 60p. It seemed to play back smothly this way, is there an advantage to deinterlace to 60p from 30p other than at 60p it should be smoother and somewhat harder to playback? Will a 60p video enode better (percieved quality, lower compression)? I will be playing these back through flash, so I will experiment to see if a 60p video plays back fine on slower computers compared to the 30p version.

foxyshadis
22nd April 2008, 20:35
60p on flash is a lost cause, it's way too slow at rendering frames for that. Better stick with 30p, you can apply a little mv-blending if you want to make it look smoother but that's extremely slow. Otherwise just make do with what you can.

60p does require a higher bitrate to look as sharp, but not twice as much, usually closer to half again as much. It's a tradeoff.

Blue_MiSfit
22nd April 2008, 21:11
Very true. I hadn't taken into consideration the effeciency of the flash H.264 decoder.

30p for the win :D

Also, if you're using YADIF, you might try yadifmod, or tdeint - see what looks best to you.

~MiSfit

hollywood10s
23rd April 2008, 08:50
What do you think about the resize filter? Sould I stick with lanczos to downsize or try another option? I am really impressed with the output mp4 file with what you guys have helped me with. At 1500kbps its very clear and that is with water and movement. Thanks

Blue_MiSfit
23rd April 2008, 18:05
Little things like that will make a subtle difference.

Different resizing algorithms are pretty similar, once you step away from bilinear towards bicubic / lanczos / spline / gauss / blackman etc...

Give them a try, but you probably won't be able to tell a difference. My eyes generally prefer Lanczos3 (just lanczosresize(...))

Glad we could help, I think the source footage was well shot on a high quality camera which really helps.

~MiSfit

MagnumRT
14th July 2008, 19:54
Your sample looks great to me.

I don't think it has enough resolution to merit 1080p, so I bob-deinterlaced it to 60p with TDeint, and then resized it to 720p. Looks fantastic, great motion, little to no noise.


AVCSource("C:\Users\Misfit\Desktop\sample_fishing.dga")
MT("
assumetff()
tdeint(mode=1)")
lanczosresize(1280,720)


I MT'd the deinterlace routine, so you can do without that if you want.

Try 720p60!

Consumer grade HD Cameras are very impressive these days!

~MiSfit

Hello. Question. Why is the file a DGA? What program is that?

I have the same issue as the OP. I'm trying to deinterlace my 1080i from my AVCHD Sony HDR-SR5 camera so I can edit it in Virtualdub.

I already have AviSynth installed and Cyberlink to use the AVC decoder...

Guest
14th July 2008, 20:00
Hello. Question. Why is the file a DGA? What program is that? DGAVCDec

Blue_MiSfit
14th July 2008, 22:08
Indeed!

I prefer it for any and all H.264 sources. It's a tad bit slow (thanks to libavcodec), but is much more accurate than DirectShowSource, and has a familiar workflow for those of us used to working with DGIndex!


Cyberlink to use the AVC decoder..


Cyberlink is a DirectShow decoder, and is probably faster than DGAVCDec, but again, it's not accurate.

~MiSfit

florinandrei
15th July 2008, 09:37
I'm new to AviSynth but I've spent some time with other video tools. I believe it's always better to shoot as clean as possible, so that the amount of processing in post is reduced to a minimum.

E.g., on my Canon HF100 (http://www.usa.canon.com/consumer/controller?act=ModelInfoAct&fcategoryid=177&modelid=16187) - recent cheap (relatively speaking; cheap for an HD device) consumer-level AVCHD camera - the single most important thing I can do to improve the master footage is to set the camera in Cinema mode (despite the name, it doesn't change the frame rate or interlacing, just the gamma and gain), and set it to Neutral in the Image Effects menu. This will run the camera with a less aggressive gamma curve (less overblown whites, less "black hole" blacks), lesser gain (the noise is reduced tremenduously, it's really hard to believe the change until you see it), and less over-saturated colors.
It looks like footage from a prosumer camera, almost - if it wasn't for the lazy small sensor and the cheap glass.

It's almost too tame, so I'm inclined to spice it up in post. But then, I can always increase the brightness a bit while shooting (the camera allows this kind of tweaking since it has some latitude at the top) and voila - it's VERY clean footage with a lively look. No further processing necessary.

Tweak your camera to shoot cleaner footage. If it can't do that, get rid of it and find something more flexible. A silly $650 AVCHD camera can do it, so yes, it's definitely doable.

If you really can see the noise while shooting in broad daylight with a cheap box, you need a better camera. The Canon HV30 (http://www.usa.canon.com/consumer/controller?act=ModelInfoAct&fcategoryid=177&modelid=16206) is said to be a very good consumer camera. My HF100 is not bad either. Both are reasonably priced for HD.
If that's still not enough, you'll have to look at the prosumer-level equipment. This will set you back around $3k for something like a Canon XH A1 (http://www.usa.canon.com/consumer/controller?act=ModelInfoAct&fcategoryid=175&modelid=14061). Or wait until 2009 when RED is supposed to get Scarlet (http://www.red.com/) out for about the same price. By the way, Scarlet is said to shoot up to 120p continuously (or up to 180p bursts), so that will take care of your dilemma regarding 30p or 60i. :)

Sounds very expensive, but no amount of post will fix a bad camera, or an OK camera badly configured.

EDIT: I just noticed that you're downscaling the image a lot. Well, a lot of defects in the master get covered by downscaling. Noise, jaggies, that sort of thing, provided the scaling filter is good. A bad HD camera looks wonderful in SD. So you probably don't need anything, after all, except a good downscaler.

florinandrei
15th July 2008, 09:47
Watch DGAVCDec carefully. If it works fine for you, great, stick to it, it's free and pretty good.
But if you see large blocks flickering, you're being hit by a known bug in libavcodec.

http://forum.doom9.org/showthread.php?t=139441

What seems to work pretty well with DirectShowSource() is Adobe MainConcept MPEG Pro HDV. When you install it, it gives you an H.264/AVC decoder and then AviSynth can read AVCHD files with DirectShowSource("C:\path\to\file.m2ts"). But it's not free software.
You may want to install the Haali Media Splitter after MainConcept, so that the initial demuxing is done by Haali. Otherwise some applications (AviSynth, Windows Media Player) may hang for a long time at the end of the file. But I'm not sure if that happens on every system, or if it was just an isolated case.

Yoshiyuki Blade
15th July 2008, 10:13
I've been having a lot of fun playing around with various AVISynth filters and encoding HD videos that my dad and I took during our trip to Vietnam last month :D.

The best bobber I've used so far is TempGaussMC by Didée. An older downscaled sample I made was posted at http://forum.doom9.org/showpost.php?p=1158370&postcount=133.

I hope the libavcodec issue gets fixed soon, as I still use DGAVCIndex regardless (demuxing audio). If what Blue_MiSfit says is true, I would want to use DGAVCIndex since I want the most accurate way to feed the video into the encoder :eek:.

EDIT: Here's one I just finished (http://www.mediafire.com/?bfniddwmvrn). Just playing around with Telemacro mode. Stats are 1080p 60fps 16mbps encoded with x264 with very high settings, so it wont be too easy on your hardware.

knutinh
19th December 2009, 13:34
Sorry to hijack this thread. I am new to Avisynth and new to AVCHD.

It seems that dgavcdecode is nowhere to be found (licensing issues?). So what do I need to open the files in Avisynth? I see some cumbersome guides involving lots of external tools. Is there no *.dll that allows me to access the raw *.mts files from my Canon camera directly within avisynth?

As 2 hours of googling did not turn up the answer (for me at least), perhaps someone would be kind enough to write a 7-line basic script that loads, decodes, deinterlaces and scales avchd files, along with links to where the external plugins can be downloaded?

This is basically what I want to start out with (but the dgavcdecode.dll is nowhere to be found):

LoadPlugin("dgavcdecode.dll")
LoadPlugin("LeakKernelDeint.dll")
AVCSource("C:\yaddayadda\00053.mts")
LeakKernelDeint(order=1)
lanczosresize(1280,720)


best regards
-k

Blue_MiSfit
20th December 2009, 03:26
DSS2(...) - provided you have ffdshow installed for video decoding (or some other H.264 DirectShow decoder), and haali media splitter to handle splitting the transport stream.

Copy avss.dll from haali media splitter's folder in "Program File" into your avisynth plugins folder. This will give you DSS2.

Should work well enough.

I'm not sure if the LGPL issues with DGAVCDec have been fixed yet, but you can probably find old versions archived on videohelp or something like that :)

I use FFMS2 a lot these days. It has a simple index application (just drop your source on ffindex.exe and let it do its thing), and can handle almost anything ffmepg can!! Give it a whirl.

Btw ... you necro'd an 18 month old thread... nice :)

~MiSfit

knutinh
20th December 2009, 11:22
Thank you. I am following these steps:
## How to convert AVCHD files using Avisynth/VirtualDub ##
1. Install Avisynth
http://sourceforge.net/projects/avisynth2/files/

2. Install VirtualDub
http://virtualdub.sourceforge.net/

3. Install Haali media splitter
http://haali.su/mkv/MatroskaSplitter.exe

Copy avss.dll from e.g.
C:\Program Files\Haali\MatroskaSplitter
to e.g.
C:\Program Files\AviSynth 2.5\plugins

4. Install FFDshow
http://www.afterdawn.com/software/video_software/codecs_and_filters/ffdshow.cfm

5. Install Leakkerneldeint
http://neuron2.net/kerneldeint/leakkerneldeint154.zip

I save this script into the plugins folder of avisynth:

LoadPlugin("avss.dll")
LoadPlugin("LeakKernelDeint.dll")
DSS2("C:\yaddayadda\00053.mts")
LeakKernelDeint(order=1)
BilinearResize(720, 576)
ConvertToYUY2()


Now it works! Thank you. Now for some tweaking and parameter fiddling ;-)

## for transcoding ##
1. Install x264
http://x264.nl/

2. Install MEgui
http://sourceforge.net/projects/megui/

3. Nero AAC
http://www.nero.com/eng/downloads-nerodigital-nero-aac-codec.php

-k

Blue_MiSfit
20th December 2009, 12:34
I'd suggest something higher quality than LeakKernelDeint, at least try YADIF :)

Also, bilinearresize is pretty darn soft. If you're happy with the look, fine. However, lots of folks around here really prefer Spline36Resize. Definitely worth a try IMO.

~MiSfit