Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 4th January 2009, 21:31   #1  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Location: Helsinki, Finland
Posts: 112
First time using avisynth, need advice

I have about 24 min of DV PAL (interlaced, BFF) footage that I want to convert to xvid. For a target size, I would be happy with about 200 mb.

Ok, so first I believe I want to deinterlace, because I want to end up with progressive 25 fps. What is a good deinterlacer for this purpose? IMO, this footage shouldn't be too hard to deinterlace since the camera remains static all the time and movement is fairly limited.

I may also want to do some mild denoising, as DV is quite noisy, especially in dark areas and I think denoising makes compression easier. What denoising filters do you recommend?

As for aspect ratio, the resolution is standard PAL (720x576) and DAR is 16/9. I guess the best solution for this is to resize to 720x405?

This is how my script looks thus far:
Code:
Load_Stdcall_plugin("yadif.dll")
AVISource("C:\Casbah.avi")
Yadif(clip, int "0", int "0")
FastBicubicResize(720,405)
This is my first time using avisynth and I don't know where to go from here... I appreciate any help.

Oh, and here's a sample.
kutjong is offline   Reply With Quote
Old 4th January 2009, 23:36   #2  |  Link
Nightshiver
Quality Freak
 
Join Date: Jun 2007
Location: Area 52
Posts: 597
You have an .avi for a sample? No mpeg files?
Nightshiver is offline   Reply With Quote
Old 4th January 2009, 23:40   #3  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,923
His source is DV. Why would he post an MPEG file?
Guest is offline   Reply With Quote
Old 4th January 2009, 23:55   #4  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,171
Yadif is a reasonable smart bob. The correct syntax is Yadif(0, 0)

I would choose a sharper resizer like the internal Spline36Resize(). FastBicubicResize() is a fairly old external plugin and the internal resizers are very fast.

For Xvid the height needs to be an even number and preferable a number divisible by 16.

Popular 16:9 mod16 Xvid sizes with the aspect error.

512x288 0%
544xx304 1.2%
576x320 2.2%
592x336 -1.6%
624x352 -0.5%
656x368 0.5%

688x384 1.4%
704x400 -1.8%


For decoding DV I would recommend Cedocida.

Seeing you have an interlaced source working in "YUY2" may avoid any chroma problems. AVISource("C:\Casbah.avi", pixel_type="YUY2").

24 Minutes and 200mb would be 1000kbits video and 128kbits audio, this is generous and extra denoising may not be necessary.

Last edited by IanB; 5th January 2009 at 03:36. Reason: Opps wrong syntax :(
IanB is offline   Reply With Quote
Old 5th January 2009, 00:10   #5  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,384
Quote:
Originally Posted by IanB View Post
The correct syntax is Yadif(clip, 0, 0)
To clarify that, in the context of kutjong's original script, it would be simply Yadif(0, 0).
Gavino is offline   Reply With Quote
Old 5th January 2009, 01:57   #6  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Location: Helsinki, Finland
Posts: 112
Thanks for your help thus far!
My script now looks like this:
Code:
Load_Stdcall_plugin("C:\Program Files\AviSynth 2.5\plugins\yadif.dll")
AVISource("Casbah.avi")
Yadif(0, 0)
Spline36Resize(656, 368)
Any other recommendations for deinterlacer? Speed is not an issue.
Quote:

For decoding DV I would recommend Cedocida.

Seeing you have an interlaced source working in "YUY2" may avoid any chroma problems. AVISource("C:\Casbah.avi", pixel_type="YUY2").
I don't understand what you mean here... The source is YV12.
Another thing, what YV12 option should I check Cedocida's options? My guess would be DV?

Also, I hope it's ok if I additionally ask for advice with xvid encoder settings.
Bitrate will be quite high, about 1200 kbps, so for matrix I guess MPEG is fine, I haven't looked into any custom matrices...

Additional settings (unrestricted):
  • Adaptive quantization, Qpel, GMC, Trellis quantization
  • B-Vops 2, Q ratio 1.5, Q offset 1, packed bitstream
  • Motion search precision 6 (ultra), VHQ 1, VHQ B-frames, chroma motion, turbo

Any settings anybody thinks I should change? I'm going to put keyframes to every tenth frame since there is no scene change in this footage, the camera remains static all the way.

Last edited by kutjong; 6th January 2009 at 00:56.
kutjong is offline   Reply With Quote
Old 5th January 2009, 21:07   #7  |  Link
thetoof
Sleepy overworked fellow
 
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
Quote:
Originally Posted by kutjong View Post
Any other recommendations for deinterlacer? Speed is not an issue.
http://avisynth.org/mediawiki/Extern...#Deinterlacing
__________________
AnimeIVTC() - v2.00
-http://boinc.berkeley.edu/-
Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p)
thetoof is offline   Reply With Quote
Old 5th January 2009, 22:46   #8  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,171
Quote:
Originally Posted by kutjong
I don't understand what you mean here... The source is YV12.
Another thing, what YV12 option should I check Cedocida's options? My guess would be DV?
Your source is Pal DV, i.e. it has DV's unusual chroma placement, and there are a whole raft of issues with interlaced YV12. Cedocida can do YV12 in 3 flavours, hence my recommending the YUY2 option.

Cedocida does a fully correct job converting DV chroma to YUY2. I wanted to make it easy for you and just make the issues go away, hence YUY2.

IIRC the panasonic DV decoder outputs RGB24 and it does a poxy job on aligning the chroma and has luma range issues. Yadif only does YUY2 and YV12.

With YUY2 from Cedocida, there are no level issues, what is on your tape ends up in YUY2, i.e. you get to choose how to control the levels if anything needs to be done.

With YUY2 there are no chroma placement issues, YUY2 has no vertical subsampling.

As Xvid is a 4:2:0 format and matches Avisynth's default YV12, you can convert to YV12 after all the interlaced issues have been eliminated.
Code:
Load_Stdcall_plugin("C:\Program Files\AviSynth 2.5\plugins\yadif.dll")
AVISource("Casbah.avi", Pixel_type="YUY2") # Using Cedocida for DV
Yadif(0, 0) # Deinterlace
ConvertToYV12()
Spline36Resize(656, 368)
For the Xvid I am inclined to leave QPel and GMC off. Many hardware player still fubar them and they do not offer very much quality wise on generous bandwidth encodes.
IanB is offline   Reply With Quote
Old 7th January 2009, 02:20   #9  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,555
All excellent advice, so far!

As far as the denoising goes, I'd suggest fft3dfilter, or fft3dgpu if you have a fast graphics card.

DV usually has very noisy chroma, so I'd clean that right off the bat (after deinterlacing). So, taking the existing script and modifying it a bit:

Code:
Load_Stdcall_plugin("C:\Program Files\AviSynth 2.5\plugins\yadif.dll")
AVISource("Casbah.avi", Pixel_type="YUY2") # Using Cedocida for DV
Yadif(0, 0) # Deinterlace
ConvertToYV12()

fft3dfilter(plane=3, sigma=2)  #clean the chroma planes, tweak sigma as necessary
fft3dfilter(plane=0, sigma=1, sigma2=2, sigma3=2, sigma4=1) #clean the luma plane, tweak the sigmas as necessary
gradfunkmirror(1.51) #Dither the banding that fft3dfilter might reveal

Spline36Resize(1024, 576) #why not expand horizontally to 1:1, or leave at 720x576 and set 16x9 when muxing?
Also, if you're not happy with the loss of motion fluidity inherent in 25i -> 25p, you might encode in 50p (i.e. set YADIF to mode=1).

Just some thoughts

~MiSfit

Last edited by Blue_MiSfit; 7th January 2009 at 10:04.
Blue_MiSfit is offline   Reply With Quote
Old 10th January 2009, 20:02   #10  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Location: Helsinki, Finland
Posts: 112
Where can I get the plugin required for gradfunkmirror? Googling this function didn't show up much...
kutjong is offline   Reply With Quote
Old 10th January 2009, 20:53   #11  |  Link
thetoof
Sleepy overworked fellow
 
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
3rd link of "gradfunkmirror" on google:http://forum.doom9.org/showthread.ph...15#post1111315
you'll also need gradfun2db http://kosmos.kawaii-shoujo.net/gradfun2db/
__________________
AnimeIVTC() - v2.00
-http://boinc.berkeley.edu/-
Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p)
thetoof is offline   Reply With Quote
Old 10th January 2009, 21:04   #12  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Location: Helsinki, Finland
Posts: 112
Yes I looked into that thread, but I don't know what to do with the code... Where do I insert it?

And gradfun2db I have installed.
kutjong is offline   Reply With Quote
Old 10th January 2009, 21:27   #13  |  Link
thetoof
Sleepy overworked fellow
 
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
oh, when you have script functions like this, save them as functionname.avsi in your plugins directory and they'll be autoloaded just like dlls.
__________________
AnimeIVTC() - v2.00
-http://boinc.berkeley.edu/-
Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p)
thetoof is offline   Reply With Quote
Old 10th January 2009, 22:18   #14  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,555
Yeah, gradfunkmirror is just a little wrapper for gradfun2db that fixes its curious behavior of not dithering the edges of images.
Blue_MiSfit is offline   Reply With Quote
Old 11th January 2009, 00:21   #15  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Location: Helsinki, Finland
Posts: 112
Ok, thanks. I've also switched to x264 for compression and I intend to keep resolution and just use PAR flags in MKV.

BTW, when examining the original DV avi file with gspot, it tells me that there is "1.35 GB unneeded bytes at end of file". Is there an easy way to get rid of these unneeded bytes?
kutjong is offline   Reply With Quote
Reply

Tags
aspect ratio, deinterlacing, denoise, pal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:36.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.