PDA

View Full Version : Using freezeframe repeatedly in the same script


1loser
10th February 2003, 06:48
I've used freezeframe before and it works great but I have a long script with 124 trims and I need to add 124 freezeframes scripts.

How do I add freezeframes that reference the original source? I tried to do it many ways but none were right.

the first freezeframe = freezeframe(3167,3194,3166)
second freezeframe = freezeframe(3365,3392,3364)

AVISource("panda.avi").AssumeFPS(29.970,True)
c1=trim(2920,3194)
c2=trim(3327,3392)
c3=trim(3493,3735)
c4=trim(3740,3806)
...
...
c124=trim(97945,100100)
s1=alignedsplice(c1,c2,c3,c4,...,c24)
s2=alignedsplice(c25,c26,c27,...,c48)
s3=alignedsplice(c49,c50,c51,...,c72)
s4=alignedsplice(c73,c74,c75,...,c96)
s5=alignedsplice(c97,c98,c99,...,c116)
s6=alignedsplice(c117,c118,c119,c120,c121,c122,c123,c124)
s1 ++ s2 ++ s3 ++ s4 ++ s5 ++ s6

1loser
11th February 2003, 19:09
I was finally able to get the script to work but I couldn't figure out how to reference the frames of the source video. So each freezeframe had to be relative to each trim. I used microsoft excel to do all the calculations and it worked perfectly. I was hoping someone could tell me how to reference the source video for each freezeframe.

---------------------------------------
didn't work
---------------------------------------
s1=AVISource("panda.avi").AssumeFPS(29.970,True)
c1=trim(s1,2920,3196).freezeframe(s1,3167,3194,3166)
c2=trim(s1,3327,3392).freezeframe(s1,3365,3392,3364)
c3=trim(s1,3493,3735).freezeframe(s1,3708,3735,3707)
c4=trim(s1,3740,3806).freezeframe(s1,3779,3806,3778)
c1 ++ c2 ++ c3 ++ c4
---------------------------------------
3167-2920 = 247 (start freezeframe)
247 + 29 = 276 (end freezeframe)
247 - 1 = 246 (frame used for replacement)

---------------------------------------
DID WORK
---------------------------------------
AVISource("panda.avi").AssumeFPS(29.970,True)
c1=trim(2920,3196).freezeframe(247,276,246)
c2=trim(3327,3392).freezeframe(38,67,37)
c3=trim(3493,3735).freezeframe(215,244,214)
c4=trim(3740,3806).freezeframe(36,65,35)
c5=trim(3807,3878).freezeframe(42,71,41)
c6=trim(3897,3974).freezeframe(48,77,47)
c7=trim(3976,4036).freezeframe(31,60,30)
c8=trim(4142,4225).freezeframe(54,83,53)
c9=trim(4245,4762).freezeframe(488,517,487)
c10=trim(8056,8523).freezeframe(438,467,437)
c11=trim(8589,8843).freezeframe(225,254,224)
c12=trim(8872,9300).freezeframe(399,428,398)
c13=trim(9327,9767).freezeframe(411,440,410)
c14=trim(9781,10068).freezeframe(258,287,257)
c15=trim(10085,10764).freezeframe(650,679,649)
c16=trim(10862,11125).freezeframe(234,263,233)
c17=trim(11398,11573).freezeframe(146,175,145)
c18=trim(12849,13320).freezeframe(442,471,441)
c19=trim(13780,14272).freezeframe(463,492,462)
c20=trim(14550,15006).freezeframe(427,456,426)
c21=trim(17665,17926).freezeframe(232,261,231)
c22=trim(17965,18290).freezeframe(296,325,295)
c23=trim(18860,19258).freezeframe(369,398,368)
c24=trim(19279,19665).freezeframe(357,386,356)
c25=trim(19850,20030).freezeframe(151,180,150)
c26=trim(20111,20385).freezeframe(245,274,244)
c27=trim(20498,20725).freezeframe(198,227,197)
c28=trim(20793,20887).freezeframe(65,94,64)
c29=trim(21152,21610).freezeframe(429,458,428)
c30=trim(21742,21944).freezeframe(173,202,172)
c31=trim(22333,23818).freezeframe(1456,1485,1455)
c32=trim(24101,24580).freezeframe(450,479,449)
c33=trim(24741,24892).freezeframe(122,151,121)
c34=trim(24947,25230).freezeframe(254,283,253)
c35=trim(25403,25652).freezeframe(220,249,219)
c36=trim(25748,26024).freezeframe(247,276,246)
c37=trim(26155,26446).freezeframe(262,291,261)
c38=trim(26525,26687).freezeframe(133,162,132)
c39=trim(26760,27465).freezeframe(676,705,675)
c40=trim(27651,27742).freezeframe(62,91,61)
c41=trim(27766,27898).freezeframe(103,132,102)
c42=trim(27991,28119).freezeframe(99,128,98)
c43=trim(28138,28422).freezeframe(255,284,254)
c44=trim(28554,28659).freezeframe(76,105,75)
c45=trim(29653,29820).freezeframe(138,167,137)
c45a=trim(29888,30071).freezeframe(154,183,153)
c46=trim(30244,30412).freezeframe(139,168,138)
c47=trim(30482,30947).freezeframe(436,465,435)
c48=trim(31550,32992).freezeframe(1413,1442,1412)
c49=trim(33377,33829).freezeframe(423,452,422)
c50=trim(33894,34346).freezeframe(423,452,422)
c51=trim(34950,35380).freezeframe(401,430,400)
c52=trim(35588,35833).freezeframe(216,245,215)
c53=trim(36467,36620).freezeframe(124,153,123)
c54=trim(36669,36881).freezeframe(183,212,182)
c55=trim(36931,37224).freezeframe(264,293,263)
c56=trim(37380,37634).freezeframe(225,254,224)
c57=trim(37696,38160).freezeframe(435,464,434)
c58=trim(38382,38651).freezeframe(240,269,239)
c59=trim(39434,39803).freezeframe(340,369,339)
c60=trim(39844,40058).freezeframe(185,214,184)
c61=trim(40481,40634).freezeframe(124,153,123)
c62=trim(41944,42231).freezeframe(258,287,257)
c63=trim(42320,42552).freezeframe(203,232,202)
c64=trim(42587,42697).freezeframe(81,110,80)
c65=trim(42725,42847).freezeframe(93,122,92)
c66=trim(42864,43162).freezeframe(269,298,268)
c67=trim(43199,43768).freezeframe(540,569,539)
c68=trim(43800,43979).freezeframe(150,179,149)
c69=trim(44018,44218).freezeframe(171,200,170)
c70=trim(44243,44467).freezeframe(195,224,194)
c71=trim(44645,44968).freezeframe(294,323,293)
c72=trim(45036,46104).freezeframe(1039,1068,1038)
c73=trim(46630,46926).freezeframe(267,296,266)
c74=trim(47154,47311).freezeframe(128,157,127)
c75=trim(47409,47873).freezeframe(435,464,434)
c76=trim(47919,48179).freezeframe(231,260,230)
c77=trim(48824,49312).freezeframe(459,488,458)
c78=trim(49976,51092).freezeframe(1087,1116,1086)
c79=trim(51998,53309).freezeframe(1282,1311,1281)
c80=trim(53385,54073).freezeframe(659,688,658)
c81=trim(54258,54521).freezeframe(234,263,233)
c82=trim(54710,54889).freezeframe(150,179,149)
c83=trim(55075,56412).freezeframe(1308,1337,1307)
c84=trim(56605,57789).freezeframe(1155,1184,1154)
c85=trim(57921,58317).freezeframe(367,396,366)
c86=trim(58591,58832).freezeframe(212,241,211)
c87=trim(60755,61595).freezeframe(811,840,810)
c88=trim(61724,62550).freezeframe(797,826,796)
c89=trim(62636,63031).freezeframe(366,395,365)
c90=trim(64216,64369).freezeframe(124,153,123)
c91=trim(66146,66963).freezeframe(788,817,787)
c92=trim(67790,68024).freezeframe(205,234,204)
c93=trim(68353,68592).freezeframe(210,239,209)
c94=trim(73320,73576).freezeframe(227,256,226)
c95=trim(74851,75082).freezeframe(202,231,201)
c96=trim(75101,75302).freezeframe(172,201,171)
c97=trim(75351,75504).freezeframe(124,153,123)
c98=trim(75509,75636).freezeframe(98,127,97)
c99=trim(75723,75967).freezeframe(215,244,214)
c100=trim(76647,76835).freezeframe(159,188,158)
c101=trim(76854,77360).freezeframe(477,506,476)
c102=trim(77696,77982).freezeframe(257,286,256)
c103=trim(78542,78930).freezeframe(359,388,358)
c104=trim(78989,80761).freezeframe(1743,1772,1742)
c105=trim(81000,81449).freezeframe(420,449,419)
c106=trim(81551,81813).freezeframe(233,262,232)
c107=trim(81874,82678).freezeframe(775,804,774)
c108=trim(83487,84662).freezeframe(1146,1175,1145)
c109=trim(84689,84823).freezeframe(105,134,104)
c110=trim(84830,85349).freezeframe(490,519,489)
c111=trim(85364,85700).freezeframe(307,336,306)
c112=trim(86602,86779).freezeframe(148,177,147)
c113=trim(86961,87120).freezeframe(130,159,129)
c114=trim(87981,88383).freezeframe(373,402,372)
c115=trim(90353,91277).freezeframe(895,924,894)
c116=trim(92374,92675).freezeframe(272,301,271)
c117=trim(93284,94528).freezeframe(1215,1244,1214)
c118=trim(95302,95432).freezeframe(101,130,100)
c119=trim(96156,96341).freezeframe(156,185,155)
c120=trim(96411,96715).freezeframe(275,304,274)
c121=trim(96738,97018).freezeframe(251,280,250)
c122=trim(97053,97295).freezeframe(213,242,212)
c123=trim(97336,97769).freezeframe(404,433,403)
c124=trim(97945,100130).freezeframe(2156,2185,2155)
s1=alignedsplice(c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,c24)
s2=alignedsplice(c25,c26,c27,c28,c29,c30,c31,c32,c33,c34,c35,c36,c37,c38,c39,c40,c41,c42,c43,c44,c45,c45a,c46,c47,c48)
s3=alignedsplice(c49,c50,c51,c52,c53,c54,c55,c56,c57,c58,c59,c60,c61,c62,c63,c64,c65,c66,c67,c68,c69,c70,c71,c72)
s4=alignedsplice(c73,c74,c75,c76,c77,c78,c79,c80,c81,c82,c83,c84,c85,c86,c87,c88,c89,c90,c91,c92,c93,c94,c95,c96)
s5=alignedsplice(c97,c98,c99,c100,c101,c102,c103,c104,c105,c106,c107,c108,c109,c110,c111,c112,c113,c114,c115,c116)
s6=alignedsplice(c117,c118,c119,c120,c121,c122,c123,c124)
s1 ++ s2 ++ s3 ++ s4 ++ s5 ++ s6
AssumeFrameBased().SeparateFields()
peachsmoother(NoiseReduction=45, Stability=25, DoSpatial=true, Spatial=100, NoiseLevel=3, Baseline=2)
unfilter(60,60)
BicubicResize(304,208,0,0.6,0,0,640,240).Weave()
AddBorders(24,32,24,32)
ResampleAudio(44100)

sh0dan
11th February 2003, 19:18
:eek:

:scared:

Wow!

On the other hand I wouldn't even think about the trouble it would take to do this in any other software!

The VirtualDubMod Editor really helps, with it's ability to pass frame numbers to the editor!

Just out of curiosity - why didn't you make a function, where you could pass the numbers - and let it do the math for you?

1loser
11th February 2003, 20:03
Originally posted by sh0dan
The VirtualDubMod Editor really helps, with it's ability to pass frame numbers to the editor!I just recently starting using VirtualDubMod but know very little about it. I didn't know of any editor. I was able to pass that entire script into VirtualDubMod and save it using the PicVideo codec, is that what you mean?

Originally posted by sh0dan
Just out of curiosity - why didn't you make a function, where you could pass the numbers - and let it do the math for you? Can avisynth do that? :rolleyes: I let excel do all the calculations for me.

Panda excel doc (http://user.7host.com/liketoshop/panda.xls),right-click, select target as to d/l it.

10 sec Panda video (http://user.7host.com/liketoshop/panda.mpg),right-click, select target as to d/l it.

22 sec Welchs grape juice commercial (http://user.7host.com/liketoshop/welchs.grape.juice.mpg),right-click, select target as to d/l it.

sh0dan
11th February 2003, 20:33
Something like:

function clipfeeze(clip v1, int start, int end, int freezeperiod) {
video = trim(v1, start, end+freezeperiod)
video = freezeframe(video, end-start, end-start+freezeperiod, end-start-1)
return video
}

s1=AVISource("panda.avi").AssumeFPS(29.970,True)
clipfreeze(s1,2920,3196, 30)
unalignedsplice(clipfreeze(s1,3327,3392, 30)
unalignedsplice(clipfreeze(s1,3493,3735, 30)
[...]
)


Should do it.

Didée
12th February 2003, 12:43
Originally posted by 1loser
... but I couldn't figure out how to reference the frames of the source video. So each freezeframe had to be relative to each trim

Trim(a,b).FreezeFrame(x,y,z) --> Freeze is relative to TRIMmed section

FreezeFrame(x,y,z).Trim(a,b) --> Freeze is relative to source

:)

BTW, when changing the framecount by any editing, don't forget to perform the actions from the end to the beginning.

1loser
12th February 2003, 22:44
Originally posted by sh0dan
Something like:
[code]
function clipfeeze(clip v1, int start, int end, int freezeperiod) {
video = trim(v1, start, end+freezeperiod)
video = freezeframe(video, end-start, end-start+freezeperiod, end-start-1)
return video
}
s1=AVISource("panda.avi").AssumeFPS(29.970,True)
clipfreeze(s1,2920,3196, 30)
unalignedsplice(clipfreeze(s1,3327,3392, 30)
unalignedsplice(clipfreeze(s1,3493,3735, 30)

I tried this is got error: expected a, or ) line 9, column 0. This is beyond my understanding at the moment but hopely someday I'll be writing my own arguments. :D

Originally posted by Didée
FreezeFrame(x,y,z).Trim(a,b) --> Freeze is relative to source
I think what you mentioned here is what I'm looking for.
-----------------------------------------------------------
At first I only wanted trims, than later I decided to extent the trims so I can freeze the last frames of the original script.

So I started out with this:
AVISource("panda.avi").AssumeFPS(29.970,True)
c1=trim(2920,3166)

Ended up with this:
AVISource("panda.avi").AssumeFPS(29.970,True)
c1=trim(2920,3196).freezeframe(247,276,246)

So, I think what I was looking for was something like this: (referencing the original script)

AVISource("panda.avi").AssumeFPS(29.970,True)
freezeframe(trim_end+1, trim_end+30, trim_end).trim(trim_start, trim_end + 30)

matrix
13th February 2003, 01:15
unalignedsplice(clipfreeze(s1,3327,3392, 30)
unalignedsplice(clipfreeze(s1,3493,3735, 30)
They're missing one of these ) each.

1loser
13th February 2003, 02:01
Originally posted by matrix
unalignedsplice(clipfreeze(s1,3327,3392, 30)
unalignedsplice(clipfreeze(s1,3493,3735, 30)
They're missing one of these ) each. No more errors after adding ) and correcting the spelling clipfreeze at the very beginning.

This worked the best for me and had the same results as what I used. It's exactly what I wanted to do from the start but I didn't know how until "Didée" made his post. :D Thank You.
freezeframe(trim_end+1, trim_end+30, trim_end).trim(trim_start, trim_end + 30)

Newer revised format, freezeframes ARE relative to source.
AVISource("panda.avi").AssumeFPS(29.970,True)
c1=freezeframe(3167,3196,3166).trim(2920,3196)
c2=freezeframe(3365,3394,3364).trim(3327,3394)
c3=freezeframe(3708,3737,3707).trim(3493,3737)
c4=freezeframe(3776,3805,3775).trim(3740,3805)

My original format, freezeframes NOT relative to source.
AVISource("panda.avi").AssumeFPS(29.970,True)
c1=trim(2920,3196).freezeframe(247,276,246)
c2=trim(3327,3394).freezeframe(38,67,37)
c3=trim(3493,3737).freezeframe(215,244,214)
c4=trim(3740,3805).freezeframe(36,65,35)

Thank you all for your help.:)