Log in

View Full Version : Trim video sections with different filters


Chengbin
2nd August 2009, 00:39
An example is better than trying to explain it.

For example

0-999, I want MSharpen () to be applied
1000-1100, I want gradfun2db(2) to be applied
1101-1200, I want MSharpen () to be applied,

...

And join them all together into one video at the end.

I've been doing this manually, and it is a pain. How do I get Avisynth to automatically do it?

Guest
2nd August 2009, 00:50
DGSource()
vid1=trim(0,999).MSharpen()
vid2=trim(1000,1100).gradfun2db(2)
vid3=trim(1101,1200).MSharpen()
vid1++vid2++vid3

Chengbin
2nd August 2009, 01:00
2 plus signs to join them?

How about MVDegrain? Is it the same thing? It contains multiple lines.

Another question, does trim work with 1 frame? If frame 1111 is a bad frame, and I want to replace it with 1110, will trim work?

Guest
2nd August 2009, 01:21
Instead of demanding spoon-feeding, try reading the Avisynth documentation.

And say thanks when someone helps you. It's basic courtesy.

Chengbin
2nd August 2009, 01:31
Instead of demanding spoon-feeding, try reading the Avisynth documentation.

And say thanks when someone helps you. It's basic courtesy.

Thanks for your help. It will save me a load of time on future encodes. I usually avoid saying thanks until my problem is solved to avoid a lot of "thanks" clogging up posts.

I just want to say one thing. I know trying and figuring it yourself is usually a good idea with simple things, but from previous experience (x264) I've destroyed a good deal of eyesight and considerable amounts of CPU power learning and trial and error, not to mention the amount of time spent (about a year). Even though now I have a pretty good understanding of x264, I would have saved a lot of time, eyesight, and electricity if someone "spoon-fed" me (though I would have less understanding).

Just food for thought next time someone asks a simple question.

Guest
2nd August 2009, 02:24
2 plus signs to join them? Yes, that keeps audio sync.

How about MVDegrain? Is it the same thing? It contains multiple lines. If it's a function, then yes.

Another question, does trim work with 1 frame? If frame 1111 is a bad frame, and I want to replace it with 1110, will trim work? Use FreezeFrame:

FreezeFrame(1111,1111,1110)

Chengbin
2nd August 2009, 02:27
Yes, that keeps audio sync.

If it's a function, then yes.

Use FreezeFrame:

FreezeFrame(1111,1111,1110)

Thank you so much.

Chengbin
2nd August 2009, 02:39
Oh wait,

vid1=trim(3189,11965).backward_vec3 = last.MVAnalyse(isb = true, delta = 3, pel = 2, overlap=2, sharp=1, idx = 1)
backward_vec2 = last.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=2, sharp=1, idx = 1)
backward_vec1 = last.MVAnalyse(isb = true, delta = 1, pel = 2, overlap=2, sharp=1, idx = 1)
forward_vec1 = last.MVAnalyse(isb = false, delta = 1, pel = 2, overlap=2, sharp=1, idx = 1)
forward_vec2 = last.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=2, sharp=1, idx = 1)
forward_vec3 = last.MVAnalyse(isb = false, delta = 3, pel = 2, overlap=2, sharp=1, idx = 1)
last.MVDegrain3(backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,thSAD=300,idx=1).MSharpen(strength=32).tweak(0,1.1,0,1.2)

It says there is a syntax error at column 37 (which is where the = sign is after backward_vec3)

Guest
2nd August 2009, 02:51
Your syntax is wrong.

I don't know the MV stuff, so I can't help you with it.

You need a refresher course in Avisynth syntax.

Chengbin
2nd August 2009, 03:03
I basically copied the MVDegrain line to it, using a dot as a separator from the trim function.

I just paid a visit to Avisynth's syntax mediawiki page. That's a lot to read.

Guest
2nd August 2009, 03:11
Try this:

DGSource()
vid1=trim(3189,11965)
backward_vec3 = vid1.MVAnalyse(isb = true, delta = 3, pel = 2, overlap=2, sharp=1, idx = 1)
backward_vec2 = vid1.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=2, sharp=1, idx = 1)
backward_vec1 = vid1.MVAnalyse(isb = true, delta = 1, pel = 2, overlap=2, sharp=1, idx = 1)
forward_vec1 = vid1.MVAnalyse(isb = false, delta = 1, pel = 2, overlap=2, sharp=1, idx = 1)
forward_vec2 = vid1.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=2, sharp=1, idx = 1)
forward_vec3 = vid1.MVAnalyse(isb = false, delta = 3, pel = 2, overlap=2, sharp=1, idx = 1)
vid1=vid1.MVDegrain3(backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,thSAD=300,idx=1).MSharpen(strength=32).tweak(0,1.1,0,1.2)

[etc. for vid2 and vid3]

Chengbin
2nd August 2009, 03:19
That worked perfectly.

Thanks a lot.

I have to read the avisynth documentation sometimes, even though it is a huge hassle, but I'll be missing out if I don't.

Chengbin
2nd August 2009, 03:26
Is this the correct syntax?

vid5=FreezeFrame(12423,12423,12422)

My number of frames jumped from 9000 to 45000 with that line. Virtual dub seems to crash when I slide it over frame 9000.

Sorry to bother you with these persistent questions.

Gavino
2nd August 2009, 09:56
Yes, it is the correct syntax, as you can see from the FreezeFrame (http://avisynth.org/mediawiki/FreezeFrame) wiki page.
(Every filter has a page like this - you should always look there first.)

Since FreezeFrame does not alter the number of frames, there must be a mistake somewhere else in your script - probably the way you are using vid5.

Chengbin
2nd August 2009, 14:25
Yes, it is the correct syntax, as you can see from the FreezeFrame (http://avisynth.org/mediawiki/FreezeFrame) wiki page.
(Every filter has a page like this - you should always look there first.)

I did look at it. It just has 2 lines about syntax, nothing else.

Since FreezeFrame does not alter the number of frames, there must be a mistake somewhere else in your script - probably the way you are using vid5.

Oh! Now I get it. Up to vid4 it was fine. I tried using 1 frame from freezeframe as one video. That must be the problem.

Thank you.

Didée
2nd August 2009, 14:34
The style as shown by neuron2 -
DGSource()
vid1=trim(0,999).MSharpen()
vid2=trim(1000,1100).gradfun2db(2)
vid3=trim(1101,1200).MSharpen()
vid1++vid2++vid3
is valid, but in some cases may lead to problems. For example when using MVTools stuff: double execution of a filter will conflict with the internal "idx" or "super" clips of MVTools.

It is more safe to use this style:
DGSource()
vid1=MSharpen()
vid2=gradfun2db(2)
vid1.trim( 0, 999) ++ \
vid2.trim( 1000, 1100) ++ \
vid1.trim( 1101, 1200) ++ \
... ... ... ... ++ \
vid2.trim(11223,12233) ++ \
vid1.trim(12234, 0)


When using e.g. MVDegrain3, making a custom function helps a lot for clarity and readability of the script.
For example:

input = DGSource()

vid00 = input .FuncMVDegrain3(blksize=8,overlap=2,thSAD=300) # vid00 has: denoising by MVDegrain3
vid01 = input .MSharpen() # vid01 has: MSharpen without denoising
vid02 = vid00 .MSharpen() # vid02 has: MSharpen after denoising
vid03 = input .gradfun2db(2) # vid03 has: gradfun without denoising
... etc ... # ... create more filter combinations as needed ...

# Now splice the individually filtered sections together:
vid01.trim( 0, 999) ++ \
vid02.trim( 1000, 1100) ++ \
vid03.trim( 1101, 1200) ++ \
... ... ... ... ++ \
vid99.trim(11223,12233) ++ \
vid00.trim(12234, 0)

return( last )

### end of script ###

### function stuff below ###

function FuncMVDegrain3(clip c, int "blksize", int "overlap", int "thSAD")
{
_blksize = default(blksize, 8)
_overlap = default(overlap, blksize/2)
_thSAD = default(thSAD, 400)
bvec3 = c.MVAnalyse(isb = true, delta = 3, pel = 2, blksize=_blksize, overlap=_overlap, sharp=1, idx = 1)
bvec2 = c.MVAnalyse(isb = true, delta = 2, pel = 2, blksize=_blksize, overlap=_overlap, sharp=1, idx = 1)
bvec1 = c.MVAnalyse(isb = true, delta = 1, pel = 2, blksize=_blksize, overlap=_overlap, sharp=1, idx = 1)
fvec1 = c.MVAnalyse(isb = false, delta = 1, pel = 2, blksize=_blksize, overlap=_overlap, sharp=1, idx = 1)
fvec2 = c.MVAnalyse(isb = false, delta = 2, pel = 2, blksize=_blksize, overlap=_overlap, sharp=1, idx = 1)
fvec3 = c.MVAnalyse(isb = false, delta = 3, pel = 2, blksize=_blksize, overlap=_overlap, sharp=1, idx = 1)
c.MVDegrain3(bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=_thSAD,idx=1)
return(last)
}


Even if at first glance it *seems* to be more work - be assured that in the long run, such a kind structurizing makes it *much* easier to keep the oversight over what you are doing.

kemuri-_9
2nd August 2009, 15:07
it seems to me that using ScriptClip in combination with a custom wrapper function to control which filter to use at frame n, could be easier to deal with than with all the trimming and recombining...

function myFilter(clip c, int n)
{
c1 = blur(c,1.0)
c2 = sharpen(c,1.0)

return \
(n < 400) ? c1 : \
(n < 800) ? c2 : \
(n < 1200) ? c1 : \
(n < 1600) ? c2 : \
c1
}

ColorBars() #example source
ScriptClip("myFilter(current_frame)")

though it is pretty similar in appearance to Didée's code...

D'zzy
2nd August 2009, 16:15
I just read about RemapFrames from stickyboy (http://avisynth.org/stickboy/)

src = last
filtered = src.SomeFilter()
ReplaceFramesSimple(src, filtered,
\ mappings="[10 11]
[15 16]
[20 24]
[30 32]
[35 36]")
This will apply SomeFilter to the mapped frame range.

And also, Sh0dan's post about how to selectively apply filters here (http://forum.doom9.org/showthread.php?p=1101802#post1101802)

Hope that helps too.

Gavino
2nd August 2009, 16:16
kemuri-_9: Although quite elegant, the problem with that approach is that, since your function myFilter is called once per frame, the clips c1 and c2 are similarly instantiated afresh on every frame (EDIT: even on frames that don't need them). That may not matter much for Blur and Sharpen, but could be a problem for filters with a heavier instantiation cost, or filters like MVTools.

Better would be to make c1 and c2 additional parameters of the function.

D'zzy
2nd August 2009, 16:26
kemuri-_9: Although quite elegant, the problem with that approach is that, since your function myFilter is called once per frame, the clips c1 and c2 are similarly instantiated afresh on every frame. That may not matter much for Blur and Sharpen, but could be a problem for filters with a heavier instantiation cost, or filters like MVTools.

Better would be to make c1 and c2 additional parameters of the function.

I suppose the RemapFrames approach has the same problem?

Honestly I'm still confused in what order avisynth's commands are run... :confused:

Gavino
2nd August 2009, 16:35
I suppose the RemapFrames approach has the same problem?
No, because in your example SomeFilter is only instantiated once and the appropriate frames are obtained from that one instance.
Honestly I'm still confused in what order avisynth's commands are run... :confused:
There are a number of pages in the wiki explaining this. Start by reading this ( http://avisynth.org/mediawiki/ConditionalFilter#Advanced_conditional_filtering:_part_I).

Chengbin
2nd August 2009, 16:58
I spent an hour writing this avs, and it doesn't encode with HDC! (Works perfectly with virtualdub though).

http://www.megaupload.com/?d=T635PL80

Chengbin
3rd August 2009, 00:25
I can't encode properly the way neuron2 taught me. It would encode the first trim (vid1), then stop.

Didee, I don't quite get your method, you mind showing me how you do it for 2 videos?

Chengbin
3rd August 2009, 15:09
Here is a snippet of my avs (goes to vid59)

vid1=trim(3189,11965).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid2=trim(11966,12086).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid3=trim(12087,12139).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid4=trim(12140,12423).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2).FreezeFrame(12423,12423,12422)

It seems avisynth wants to load vid1 to vid59! It says system access violation, line 34 (vid4). I'm assuming avisynth hit the 2GB RAM limit on 32 bit OS (I'm watching RAM closely). When I limit it to 4 videos (vid1-vid4), it would barely load. Setting setmemorymax(1024) doesn't work either.

thewebchat
3rd August 2009, 15:20
Save yourself some memory by running msharpen and tweak after you splice the clips together.

Also, trim(12140,12423).FreezeFrame(12423,12423,12422) is totally wrong. How about you post your entire script so we can find the problem?

Chengbin
3rd August 2009, 15:48
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\ColorMatrix.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\deblock.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\DGAVCDecode.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\DGDecode.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\DirectShowSource.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\FFT3DFilter.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\gradfun2db.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\MSharpen.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\mt_masktools-26.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\mvtools.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\mvtools2.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\RemoveGrain.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\Repair.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\TTempSmooth.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\VSFilter.dll")
LoadPlugin("G:\HDConvertToX_2.0.424.3356\filters\FDecimate.dll")

Import("G:\HDConvertToX_2.0.424.3356\filters\LSFmod.v1.8.avsi")
Import("G:\HDConvertToX_2.0.424.3356\filters\MCTemporalDenoise.v1.3.00.avsi")

DirectShowSource("G:\HDConvertToX_2.0.424.3356\20090627.mp4\fullvideo.mkv")
# Crop(Left, top, -right, -Bottom)
Crop(180,0,-180,-0)
Spline36Resize(1440,1080,0,0,-0,-0)

vid1=trim(3189,11965).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid2=trim(11966,12086).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid3=trim(12087,12139).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid4=trim(12140,12423).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2).FreezeFrame(12423,12423,12422)
vid5=trim(12424,12530).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid6=trim(12531,12587).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid7=trim(12588,12839).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid8=trim(12840,12886).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid9=trim(12887,12967).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid10=trim(12968,13098).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid11=trim(13099,13319).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2).FreezeFrame(13319,13319,13318)
vid12=trim(13320,13499).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2).FreezeFrame(13499,13499,13498)
vid13=trim(13500,13620).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid14=trim(13621,13696).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid15=trim(13697,14010).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid16=trim(14011,14102).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid17=trim(14103,14238).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid18=trim(14239,14467).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid19=trim(14468,14830).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2).FreezeFrame(14830,14830,14829)
vid20=trim(14831,14967).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2).FreezeFrame(14967,14967,14966)
vid21=trim(14968,15043).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid22=trim(15044,15079).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid23=trim(15080,15271).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid24=trim(15272,15367).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid25=trim(15368,15427).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid26=trim(15428,15513).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid27=trim(15514,15602).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid28=trim(15603,15727).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid29=trim(15728,15888).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid30=trim(15889,16049).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid31=trim(16050,16192).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid32=trim(16193,16312).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid33=trim(16313,16374).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid34=trim(16375,16435).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid35=trim(16436,16832).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid36=trim(16833,17014).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid37=trim(17015,17560).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid38=trim(17561,17787).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid39=trim(17788,18714).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2).FreezeFrame(18714,18714,18713)
vid40=trim(18715,18793).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid41=trim(18794,19236).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid42=trim(19237,19407).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2).FreezeFrame(19407,19407,19406)
vid43=trim(19408,23008).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid44=trim(23009,23193).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid45=trim(23194,23357).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid46=trim(23358,23494).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid47=trim(23495,24323).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid48=trim(24324,24418).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid49=trim(24419,24555).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid50=trim(24556,24645).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid51=trim(24646,25431).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid52=trim(25432,25491).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2).FreezeFrame(25491,25491,25490)
vid53=trim(25492,25735).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid54=trim(25736,25904).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid55=trim(25905,25965).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid56=trim(25966,26140).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid57=trim(26141,28335).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid58=trim(28336,28392).MCTemporalDenoise(settings="low",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid59=trim(28393,31159).MCTemporalDenoise(settings="high",GPU=false).MSharpen(strength=32).tweak(0,1.1,0,1.2)
vid1++vid2++vid3++vid4++vid5++vid6++vid7++vid8++vid9++vid10++vid11++vid12++vid13++vid14++vid15++vid16++vid17++vid18++vid19++vid20++vid21++vid22++vid23++vid24++vid25++vid26++vid27++vid28++vid29++vid30++vid31++vid32++vid33++vid34++vid35++vid36++vid37++vid38++vid39++vid40++vid41++vid42++vid43++vid44++vid45++vid46++vid47++vid48++vid49++vid50++vid51++vid52++vid53++vid54++vid55++vid56++vid57++vid58++vid59

thewebchat
3rd August 2009, 16:05
Oh, no wonder. Obviously you would run out of memory if you call the same filters 99 times. Here's a sanitized approach:

DirectShowSource("fullvideo.mkv")

Crop(180,0,-180,-0)
Spline36Resize(1440,1080)

FreezeFrame(12423,12423,12422)
FreezeFrame(13319,13319,13318)
FreezeFrame(13499,13499,13498)
FreezeFrame(14830,14830,14829)
FreezeFrame(14967,14967,14966)
FreezeFrame(18714,18714,18713)
FreezeFrame(19407,19407,19406)
FreezeFrame(25491,25491,25490)

low = MCTemporalDenoise(settings="low",gpu=false)
high = MCTemporalDenoise(settings="high",gpu=false)

vid1 = high.Trim(3189,11965)
vid2 = low.Trim(11966,12086)
<insert the rest of the sections>
vid58 = low.Trim(28336,28392)
vid59 = high.Trim(28393,31159)

vid1 + vid2 + <...> + vid58 + vid59

MSharpen(strength=32)
Tweak(0,1.1,0,1.2)

Notes: These sections will almost definitely not align right with DirectShowSource. What happened to frames 0-3188? Also, do you see the error in the way you used FreezeFrame? You referred to the frame numbers of the original clip in your code but applied FreezeFrame on the trimmed clip. Lastly, Yatta (http://ivtc.org) is very good at doing all this ugly sectioned filtering and freezeframing for you (it can autogenerate AVS scripts).

Gavino
3rd August 2009, 17:25
Here is how you can use stickboy's ReplaceFramesSimple to eliminate the tedious trimming and splicing part, as suggested by D'zzy in post #18 earlier. Replace
vid1 = high.Trim(3189,11965)
vid2 = low.Trim(11966,12086)
...
vid59 = high.Trim(28393,31159)
vid1 + vid2 + <...> + vid58 + vid59
by
ReplaceFramesSimple(high, mappings="[3189 11965] [12087 12139] ... [28393 31159]")
ReplaceFramesSimple(low, mappings="[11966 12086] [12140 12423] ... [28336 28392]")
Of course, you still have to work out and put in the frame numbers, but you no longer have to create 59 separate trims and splice them all together.

Chengbin
3rd August 2009, 18:46
Ahhh! That makes a lot of sense.

I had given up hope (more like I was impatient), and did it manually (ughh). Should of waited.

@thewebchat

Well, I'll know what to do next time. Thanks for teaching me the very clean way of doing it.

0-3188 needed special treatment that I did before.

BTW, you wrote "vid1 + vid2 + <...> + vid58 + vid59"

Did you do that to simplify or can you actually do that in a script?

neuron2 said you need 2 + signs, how come you only have one?

thewebchat
3rd August 2009, 18:54
+ = UnAlignedSplice
++ = AlignedSplice

AlignedSplice pads/cuts the audio to ensure audio/video sync when the audio and video length aren't the same. Since all your trims came from the same clip and you aren't reordering them, UnAlignedSplice is more appropriate. Of course, if you don't have audio, then it doesn't matter either way. And no, of course you can't substitute "<...>" for actual code.

Note: This is all in the AviSynth manual, which I suggest you read.

Chengbin
3rd August 2009, 19:44
+ = UnAlignedSplice
++ = AlignedSplice

AlignedSplice pads/cuts the audio to ensure audio/video sync when the audio and video length aren't the same. Since all your trims came from the same clip and you aren't reordering them, UnAlignedSplice is more appropriate. Of course, if you don't have audio, then it doesn't matter either way. And no, of course you can't substitute "<...>" for actual code.

Note: This is all in the AviSynth manual, which I suggest you read.

Thanks for clearing that up. I'm encoding it without audio (add audio during muxing).

I will read the AviSynth manual, but not now. It is sooooo long. It must be like 500 pages if it is a book.