Syntax
Shuffle(clip c, int "groupSize", int "seed", bool "showSeed")
Parameters
"groupSize" |
If set to a value > 1, Shuffle first divides
the clip into groups of groupSize frames each and
then shuffles the groups. Shuffle does not shuffle
frames within each group. For example, if groupSize
is 3, frames 0, 1, 2 always will occur together and in
order, as will frames 3, 4, 5.(Default: 1 for frame-based clips; 2 for field-based clips) |
"seed" |
The initial seed to use for the randomizer. (Default: initially the current time; on subsequent calls, reuses the random number sequence from the previous seed) |
"showSeed" |
Pass true to display the seed value in the video
clip. Useful if you want to be able to generate reproducible
results.(Default: false) |
Usage
To be honest, this plug-in is pretty useless. It could be useful if used
with ImageReader to create randomized slideshows. Other
possibilities are to use it with a very strong temporal smoother to create
blurry montages or interesting visual effects. (See
Shuffle.examples.avs for
examples.)
Does not affect the audio track.
If used with a field-based clip, both the groupSize and the frame count must be even. This is done to ensure that Shuffle doesn't arrange top-fields next to other top-fields and bottom-fields next to other bottom-fields.
If you have a field-based clip, want to shuffle fields, and don't care about grouping, then use:
function SetParity(clip c, bool parity)
{
return parity ? c.AssumeTFF() : c.AssumeBFF()
}
function ShuffleFields(clip c, int "seed", bool "showSeed")
{
Assert(c.IsFieldBased(), "ShuffleFields: clip must be field-based")
oldParity = c.GetParity()
c0 = c.SelectEven().AssumeFrameBased().Shuffle(seed=seed, showSeed=showSeed)
c1 = c.SelectOdd().AssumeFrameBased().Shuffle()
return Interleave(c0, c1).AssumeFieldBased().SetParity(oldParity)
}
Revision History
-
0.1.5
-
Fixed a stupid bug that duplicated frames from the end of
the original clip when groupSize did not evenly
divide
FrameCount().
-
Fixed a stupid bug that duplicated frames from the end of
the original clip when groupSize did not evenly
divide
-
0.1.4
- Modified seed behavior. Now uses the previous seed by default, automatically generating a new seed only if there is no previous value.
- 0.1.3
-
0.1.2
- Minor code adjustments.
-
0.1.1
- Fixed a stupid bug that duplicated frames at the end.
-
0.1.0
- Initial release.