uNicAudio.dll info:
uNicAudio.dll v2.0.4 - AviSynth Audio Plugins for MPEG
Audio/AC3/DTS/LPCM and other uncompressed formats
Based in NicAudio.dll v2.0.4 with a unique
function call for all the supported formats
Same libs used, AudioSource.cpp replace
mpasource.cpp and m2audio_*.cpp in NicAudio.
AviSynth USAGE
--------------
Syntax:
UnicAudioSource("FileName.ext", int "Param1", int "Channels", int
"SampleBits")
Where the big difference is the parameter meaning with different
sources:
AC3/DTS
"Param1" Old DRC, if 1 Apply Dynamic Range Compression
algorytm. Else don't apply
"Channels" Maximum number of channels to output (Downmix).
Optional.
MPA/MP2/MP3
"Param1" Old Normalize, if 1 Normalize, if 2 write auxiliary
d2a file, 3 both. Else nothing.
Normalize means apply the max gain without clip
signal.
RAW/PCM
"Param1" Old SampleRate. Necessary for lpcm and raw files.
"Channels" Necessary for lpcm and raw files. Max 8 channels.
"SampleBits" Necessary for lpcm and raw files. Valid values
8/16/24/32 (also 33 (32 float) for raw)
(lpcm also accept 20 and -8/-16/-24/-32. Negative
values are for BluRay lpcm (big-endian))
WAV (and other uncompressed formats)
"Param1" IgnoreLength 1 force ignore the data size read in
the header also in 64 bits formats.
2 ignore the data size 32 bits read in
the header if > 2GB. (default)
4 ignore the data size 32 bits read in
the header if > 4GB.
Supported files (all can be > 4GB):
ac3 also in wav container (TODO: support also eac3 files
or Dolby Digital Plus)
dts also dtswav and dtshd (only core decoded) supported
mpa mpeg files: mp1, mp2 and mp3 (also in wav container)
lpcm from DVD Audio, from BluRay with -SampleBits
raw uncompressed audio without header but with standard MS
channel order and endian.
wav and other uncompressed formats: WAV,
WAVE_FORMAT_EXTENSIBLE, W64, BWF, RF64, AU, AIFF and CAF
Examples:
LoadPlugin("uNicAudio.dll")
UnicAudioSource("c:\File.ac3", 1, 2) # Apply DRC and downmix
to stereo
UnicAudioSource("c:\File.dts") # preserve full
channels and quality
UnicAudioSource("c:\File.mp3", 3) # normalize and write
the .d2a file for quick acces next time
UnicAudioSource("c:\File.lpcm", 48000, 6, -24) # we need the 3 param.
to open raw or pcm files (.pcm or .lpcm)
UnicAudioSource("c:\File.w64", 1) # the extension isn't
mandatory, the header are checked
+ Reply to Thread
Results 31 to 57 of 57
-
-
Thanks for all the info guys. I've run into yet another aggravating problem. Here's the script I am currently using and the error I'm getting is below it.
MPEG2Source("C:\Users\Nagashi\Desktop\Project X\Project Lab\02_VOB.d2v")
MCTemporalDenoise(settings="high",strength=250,edg eclean=true)
TFM().TDecimate()
LanczosResize(360,288)
I have FFTW3.dll in the plugins folder. So annoying... Looks like the problem is within MCTemporalDenoise on line 697. Ok, this is what's on line 697 of MCTemporalDenoise.avsi:
i.FFT3Dgpu(sigma=sigma*0.8,sigma2=sigma*0.6,sigma3 =sigma*0.4,sigma4=sigma*0.2,bw=bwbh,bh=bwbh,ow=owo h,oh=owoh,plane=chroma?4:0,bt=bt,precision=precisi on).gradfun2db(thr=1.0+sigma*0.05)
Any idea what could be causing this error? -
it has to go in the windows\system32 folder , or syswow64 folder on x64 os
the order of your script is wrong too, the IVTC (tfm.tdecimate) has to come first before the other filters but after the source filter (otherwise it will still be telecined, and the filters won't work correctly) ; and your aspect ratio will be wrong (360x288 with square pixels will give 1.25AR , so people will look fat)Last edited by poisondeathray; 28th Jun 2010 at 19:05.
-
it has to go in the windows\system32 folder , or syswow64 folder on x64 os
I really wanted to use MCTemporalDenoise at first... I think I might try something because this script is a royal pain in the ass.
the order of your script is wrong too, the IVTC (tfm.tdecimate) has to come first before the other filters
MPEG2Source("C:\Users\Nagashi\Desktop\Project X\Project Lab\02_VOB.d2v")
TFM().TDecimate()
MCTemporalDenoise(settings="high",strength=250,edg eclean=true)
your aspect ratio will be wrong (360x288 with square pixels will give 1.25AR , so people will look fat
Stream Type: MPEG2 Program
Profile: main@main
Frame Size: 720x576
Display Size: [not specified]
Aspect Ratio: 4:3 [2]
Frame Rate: 25.000000 fps
Video Type: PAL
Frame Type: Interlaced
Coding Type: B
Colorimetry: BT.470-2 B,G*
Frame Structure: Frame
Field Order:
Coded Number: 31591
Playback Number: 3367
Frame Repeats: 0
Field Repeats: 0
VOB ID: 2
Cell ID: 2
Bitrate:
Bitrate (Avg):
Bitrate (Max):
Timestamp: 0:00:00
Elapsed: 0:00:13
Remain: FINISH
FPS:
Info: -
you need gradfun2dbmod
http://avisynth.org/mediawiki/GradFun2DBmod
http://forum.doom9.org/archive/index.php/t-144537.html
whenver you have an error that says there is no function....blah blah blah, you are usually missing the avsi or plugin dll, so just google it
Assuming that DGIndex's AR information is correct (i.e this is a PAL 4:3 source) , you would resize to something like 640x480 or 480x360 or 400x300 etc... Just do multiples of 4width:3height , preferrably rounded to 16 for mod16 compatibility (better compression)
Also, this isn't a telecined source, since it's PAL , so you wouldn't IVTC it like the 1st example.
Don't use the same script for everything, you have to customize each one. Here is a basic guide for determining interlaced vs. progressive vs. telecine sources
http://neuron2.net/faq.html#analysis
I think DGindex is just reporting how the video was encoded (i.e interlaced) , but that doesn't mean the actual content is interlaced. You have to examine the fields to be sure if it's interlaced or progressive (see the link above). If it's interlaced, and this is for a progressive display (like PC, LCD) , then you probably want to deinterlace it.Last edited by poisondeathray; 28th Jun 2010 at 19:56.
-
If it's interlaced, and this is for a progressive display (like PC, LCD) , then you probably want to deinterlace it.
Here's a clip I encoded:
http://www.megaupload.com/?d=7NQ4ZCVJ.
Go to around 53 seconds to where the PPGZ are running up the stairs. The frames are stepping forward, then back, then forward again, giving it a blurred appearance. What kind of filter can fix this?
EDIT:
Ok. I managed to fix it using this:
AssumeBFF()
SeparateFields()
But it takes 10+ minutes to encode 44 seconds worth of video footage with this setting.
http://www.megaupload.com/?d=IE6TRUDZ
This is the script I'm using. I'm trying to keep it simple.
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
MPEG2Source("C:\Users\Nagashi\Desktop\Project X\Project Lab\ep. 01\episode 01.d2v")
AssumeBFF()
SeparateFields()
LanczosResize(720,480)
FieldDeinterlace(full=true,dthreshold=7,blend=true )
MSmooth(strength=3,threshold=15)
Notice the screen is very shaky during the transformation scene. It's like that on the original Japanese and PAL DVDs.Last edited by Nagashi; 2nd Jul 2010 at 08:31.
-
I haven't looked at the encoded sample yet, but If it's going forward/backward then it sound like a field order issue
Please post a corresponding sample of the original
EDIT: the encoded sample exhibits field blends . You might be be able to use a restore function like srestore() on the original sourceLast edited by poisondeathray; 2nd Jul 2010 at 08:08.
-
You might be be able to use a restore function like srestore() on the original source
Please post a corresponding sample of the original
http://www.megaupload.com/?d=WIEB2JRT
I managed to fix the field order in my test encode but I noticed that it doesn't flow as smoothly as the DVD. It seems to lag in between frames or something. If you compare the MPG to my encode, you will see what I mean. This is the encode I'm talking about: http://www.megaupload.com/?d=IE6TRUDZ. The same one in the post above. Any idea what could be the cause?
Additional information:
According to my nab skills and testing, I've concluded that the intro and endings are definitely 3:2 pulled-down progressive video. They use TFF and frame sequence: a a a b b c c c d d e e e f f...
The episode uses BFF and it is progressive video (plz correct me if I'm wrong). The frame sequence is mostly a a b b c c d d e e f f.
I'm guessing I will have to include Telecide() in my script. Could this be the reason why my encodes aren't playing as smoothly as the DVD?Last edited by Nagashi; 2nd Jul 2010 at 10:48.
-
It's fieldblended from an NTSC source. Try this:
Yadif(Mode=1)#or your favorite bobber
SRestore()
Tried it. It completely destroyed the output quality on default and the encode came out jerky.Last edited by manono; 2nd Jul 2010 at 11:08.
-
It's perfect.... Yadif is exactly what I've been missing. It fixed the field order, deinterlaces and fixed some of the choppiness. I couldn't use srestore though. It always came out choppy / jerky. Most likely because the source is a PAL bootleg. Thanks guys. I really appreciate it!!
http://www.megaupload.com/?d=W9QY9ANQ
Load_Stdcall_plugin("C:\Program Files\AviSynth 2.5\plugins\yadif.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\decomb.dll")
MPEG2Source("C:\Users\Nagashi\Desktop\Project X\Project Lab\ep. 01\episode 01.d2v")
Yadif(Mode=1)
LanczosResize(720,480)
Tweak(sat=1.1)
MSmooth(strength=1,threshold=15)Last edited by Nagashi; 7th Jul 2010 at 16:00.
-
And I have a confession to make; I was wrong about it being 'fieldblended from an NTSC source'. There aren't any field blends (only those frame blends) and I can now find no evidence of it having started life in NTSC. But by using Yadif(Mode=1) without the SRestore line after it, you bob the video and wind up with 50fps, which I don't think you intended. Maybe try Yadif(Mode=0) instead. Or maybe try a different deinterlacer instead, perhaps one that only deinterlaces when it's necessary (TDeint(Full=False)). And there are lots of better deinterlacers, but they're often also very slow
In addition, before resizing for NTSC I think you should get rid of the garbage pixels at top and bottom, perhaps by letterboxing, I don't think you need to boost the saturation, and I don't think you should use MSoften on it. But you didn't ask about those things, did you? -
But by using Yadif(Mode=1) without the SRestore line after it, you bob the video and wind up with 50fps, which I don't think you intended.
In addition, before resizing for NTSC I think you should get rid of the garbage pixels at top and bottom, perhaps by letterboxing
I don't think you need to boost the saturation
and I don't think you should use MSoften on it
Is there any way to fix shaky video with Avisynth (not VirtualDub)?Last edited by Nagashi; 3rd Jul 2010 at 23:21.
-
That's right, twice the number of frames played at twice the speed means the length remains the same. Half of those frames are superfluous. In addition, everything is being bobbed, good frames and bad, to their detriment. It's completely unnecessary.
Is there no other way? A filter perhaps?
Is there any way to fix shaky video with Avisynth (not VirtualDub)? -
bob is only good if you have unique frames, you have duplicates sometimes triplicates and 4x repeats - this is a waste of space and bitrate.
The problem with your source is some of the "good" duplicates occur in the odd frames, sometimes in the even frames. So you could bob it and manually mix & match (step though the bobbed video and you will see what I mean, they are not exact duplicates, and some of the "duplicates" have ghosting or excessive noise)
Following manono's suggestions will also help. Yadif is horrible for anime. You will notice "dotted line" artifacts almost every frame - these are classic yadif artifacts (see the attached screenshots below, especially #122.) The noise and deinterlacing artifacts also "eat up" more bitrate. Tempgaussmc_beta2 is an excellent deinterlacer , but very slow
msmooth is a bad idea, your settings kills details around grey lines, like the steps. You can see in the comparison screenshots attached below. I would use a better denoiser like DFTTest() which will clean the noise better, yet preserve more detail
The aspect ratio is incorrect 1.5 AR (it should be 1.333 AR or 4/3) ; picture is too wide, and the girls have fat asses. You could set the container flag in mkvmerge, or encode with SAR x:y values, or just resize to 640x480 using square pixels
Cropping the noisy edges will also make a cleaner encode and reduce bitrate requirements. You shouldn't need 7-8Mb/s for anime! By following these suggestions you should only need 1/2 to 1/3 of the size that you encoded "Test 3.mkv" with, and it will look better
For stabilization in avisynth (similar to deshaker in vdub), you can use depan, depanestimate, or stab (which is a function based on depan)
I usually do multiple stages , like a lossless intermediate after TGMC (e.g. using vdub fast recompress, and lagarith) , then another one after the other filters, then feed that into x264
Code:TempGaussMC_Beta2(1,1,1,1,1,0,4,sharp=0) # I did a lossless intermediate first SelectOdd() # or SelectEven() ; since you have many repeats you can mix & match good frames DFTTest() Crop(4,4,-4,-2,true) Dehalo_alpha(darkstr=0.6, brightstr=1.2) Toon(strength=0.3) LSFMod(strength=80) Tweak(sat=1.1) LanczosResize(640,480)
http://www.mediafire.com/?dzmh2d0d4mmLast edited by poisondeathray; 4th Jul 2010 at 07:39.
-
Wow! OK guys. I will definitely follow your suggestions. Thanks again for your help and support.
-
I've run into another problem. In this file, at around 32 seconds where the Professor is yelling, you will notice the lines around his face and shoulders flickering. For some reason, I cannot filter it out with any of the filters I've been using thus far. I can get rid of the field blending, interlacing, correct the field order... but not this. This is the raw, untouched MPEG file.
http://www.megaupload.com/?d=WY7NPPT0
And this one is a little bit different. Take a look at the Mayor's collar around 18 seconds.
http://www.megaupload.com/?d=DNQG3290
You would have to watch to video to actually see what I'm talking about.Last edited by Nagashi; 7th Jul 2010 at 09:49.
-
teacher yelling -
when you step through the fields (assumebff, separatefields) , you will notice the jaggies already present in each individual fields (i.e you have a bad source) . When you use a bad deinterlacer, this makes things even more jaggy what you want is a line connector and some antialiasing. The problem is the distance between your jaggies are too thick to be considered aliasing to the antialiasing algorithms (too many line skips), so one "trick" is to thin the lines so they are thin enough to work with the antialiasing algorithms. You can use awarpsharp2 to do the line thinning
nnedi2/3 for line connecting works well with natural rounded lines, but less so with straight lines (it creates artifacts). eedi2/3 works well with straight lines, but destroys rounded lines. If you preview the script you can see where using eedi3 works better for the straight teeth, but less well for things like rounded mouth. So again, you may have to mix & match frames and scripts for "ideal results" (just like you had to select some odd or even frames from the earlier test sequence). You can specify TGMC to use nnedi2/3 or eedi2/3 for it's interpolation (that's a big reason why you have fewer jaggies than other deinterlacers like vanilla yadif)
Code:MPEG2Source() TempGaussMC_beta2(edimode="nnedi2") Trim(1148,1317) #limits to the teacher yelling section SelectEven() #or selectodd() , you may want to encode without (i.e. don't use select odd or even) and pick and choose good/bad frames as before #I encoded a lossless intermediate first (e.g. vdub, fast recompress, lagarith) AwarpSharp2(depth=16) NNEDI3() #or EEDI3 and pick and choose frames AAA() Toon(strength=1) Crop(4,2,-2,-2,true) Spline36Resize(640,480)
Also, I didn't use any other denoiser, sharpening or other color filters, etc..., you can adjust that to your own tastes
There maybe other better ways to deal with this. There are a lot of avisynth experts at Doom9 forums that can help as well, you can ask there.
Here is a comparison example of the same frame, 1 using a generic deinterlacer (tdeint, but with yadif you would get the same results) -
mayor -
The problem with mayor's collar is both undulating noise (partly macroblocking) and line shape thickens on subsequent frames, so it sort of "flickers" . If the noise were reduced/eliminated and the line shape constant, you wouldn't see this problem.
Again, you may want to select frames, and definitely apply different script to different segments, or even parts of frames (you could use overlay() for example), or you will negatively impact other sections.
Using MPEG2Source with cpu=3 (deblocking), TGMC2() and DFTTest() get rid of lots of it, but still some residual from the varying line thickness between frames. Adding AwarpSharp2() can thin and help a bit too, but not completely eliminate - still a tiny bit of "shimmer"
Since there is no motion in the background (mayor doesn't move at all in that sequence), one method would be to select a static "poster frame" and use that to composite with the other frames e.g. with an overlay - This would probably be the best solution
Code:MPEG2Source("Mayor.d2v",cpu=3) TempGaussMC_Beta2() Trim(365,552) #limits to mayor section SelectEven() #or selectodd() blah blah pick good frames if you want since you have slightly different frame repeats.... DFTTest() #lossless intermediate again, blah blah... #in the new 94 frame sequence I chose 13 as the poster frame (no reason) from the above intermediate, and saved it out as an image png AVISource("Intermediate.avi") Trim(10,0) #have to trim the fade from white section, or it won't match poster frame a=last ImageSource("13.png",0,83,25) Crop(0,0,-560,0,true) ConvertToYV12() b=last Overlay(a,b)
Again, you can tweak, denoise, color etc.. to your own tastes, this is just to demonstrate one method to get rid of the collar artifacts -
What is it too confusing?
Try to learn what each line is doing, so you can tweak/adjust to your own purposes - this way you can apply to other sources effectively, and help other folks out. I mentioned this earlier, but a good tool is AvsP, so you can alter & view scripts
This is just scratching the surface, (ie. basic avisynth usage)... You should see the amazing stuff and application of avisynth at Doom9 forum100x more advanced and complex!
-
That's a lot of work just for a few frames. But I'll give it a try.
One more thing that's been bugging me. Well, actually I was kind of expecting it but I noticed that my encodes come out slightly choppy after removing the field blending. Even if I run them at the same fps (25 fps). This is especially noticeable in objects that are moving across the screen. I'm guessing I would have to use some sort of motion blurring technique to make the choppiness less noticeable? -
Well your initial post asked how to encode decent videos... this is how you do it when you have a crappy source. You have to fix it and optimize filters in order to optimize compression. If you had a cleaner/better source, you don't have to jump through all these hoops.
Those jaggies and aliasing eat up bitrate - so not only do your encodes look bad, the take up more bitrate for a certain level of "quality"
This really isn't that bad... have a look at some complex scripts and restoration work at Doom9 forums. I don't even begin to understand 1/2 of it (I'm still learning too!)
As for the choppiness, it shouldn't be any different on your particular source if you had 50fps, ONLY because you have frame repeats. If you have 25 frames vs. 50 frames but every 2nd frame is a repeat, visually it will look the same when you playback. The 50fps version will be less efficient because you need to code more stuff. If you had a TRUE 50fps source (i.e. every frame is different, it would look buttery smooth). But your source's true frame rate is actually a lot less than 25 (i.e. there are fewer than 25 unique frames per second) - that's why it's so choppy. If you want an approach is to generate new intermediate frames , but it's really messy & blurry. Most anime fans try to avoid this in the first place by using deblending scripts. But you can do whatever you like - this is for you no for someone else! -
Well your initial post asked how to encode decent videos... this is how you do it when you have a crappy source.
This really isn't that bad... have a look at some complex scripts and restoration work at Doom9 forums. I don't even begin to understand 1/2 of it (I'm still learning too!) -
Thanks for everything.
Last edited by Nagashi; 17th Jul 2010 at 00:36.
Similar Threads
-
Convert a DVD to an avi,mkv using Avisynth Scripts and VDubMod or MeGUI
By ppeterr in forum DVD RippingReplies: 6Last Post: 25th Apr 2010, 05:04 -
AVS scripts for MeGUI - why do they resize the video
By Bully9 in forum Video ConversionReplies: 0Last Post: 17th Mar 2010, 16:16 -
I need some help on writing H.264 AVISynth scripts
By rocky12 in forum Newbie / General discussionsReplies: 46Last Post: 6th Dec 2008, 13:40 -
H.264 deinterlacing AVISynth scripts for 29.97fps
By PuzZLeR in forum Video ConversionReplies: 12Last Post: 7th May 2008, 22:36 -
Avisynth scripts and VDubMOD filters
By GangstaRap in forum Newbie / General discussionsReplies: 2Last Post: 13th May 2007, 11:39