Log in

View Full Version : Only get Hight motion scene


Dark-Cracker
27th December 2003, 07:07
hi,

does someone know how to get only the hight motion scene ?
in fact i try to made a function who return only the frame who are in the hight scene (for exemple if i use the function with a 500 frames sample while in these 500 frames only 50 frames are an hight scene motion, i want it return me a clip with only 50 frames).

but apparently i am not sure u can only get a part of the clip.

for the moment i use this script :

#----
Video=Mpeg2Source("sceneaction.d2v").trim(100,600)
Video=OnlyHightMotion(video)

Return(Video).Limiter()


function OnlyHightMotion(clip Source)
{

Source=ConvertToYv12(Source)

global Source = Source
global threshold_hm = 5

Slow = blankclip(Source,1)
Hight = Source.subtitle("hight")

Result = Conditionalfilter(Source, Hight, Slow, "0.5*YDifferenceFromPrevious() + 0.25*UDifferenceFromPrevious() + 0.25*VDifferenceFromPrevious()", ">", "threshold_hm", False)

return result

}
#----------

but it return me a black frame for each frame detected as slow or medium scene action :( so at the end i still have a 500 frames lenght clip.

if someone have an idear he is welcome :)

++

Didée
27th December 2003, 12:36
Sorry for bringing bad news, but: that's impossible to do with Avisynth - at least in an 1-pass approach.

1. You _need_ to use the conditional stuff in order to analyze the frames
2. The framecount of the script is set when initially constructing the graph, before any conditional function has been executed. There's no sane way to perform any trim()ming inside the conditional environment.

The only way, IMHO, would be to do two passes: 1st pass analyzes the video frame by frame, and writes the results in a text file. 2nd pass evaluates that text file and sets trim() arguments according to the values found in there.

Would be great, though, if someone prooves me wrong here.

BTW 1: Isn't your subtitle("hight") disturbing the measurement?

BTW 2: YDifferenceXYZ is not such a reliable indicator for interframe motion. Medium motion may get misinterpreted. Very high motion is reckognized quite good - but what about scene changes?

- Didée

Dark-Cracker
27th December 2003, 16:30
hi,

first thank u for your answer :)
yes i have already try a trim in conditionnal filter but without success.
sad it was impossible to made a such thing.

for your BTW1 yes you are right this disturb the detection, and BTW2 is also correct but in fact i don't want to made a script to get an accurate detection of the motion , i am playing on how to automaticly detect interlaced material so i have made some tests to try a basic detection :)

in fact i use somethink like :

function CompareField(clip v1){
t0=v1.ComplementParity
t1=t0.separatefields

b1=v1.separatefields

res=compare(t1,b1,"yuv","compare.log")
#res=stackvertical(t1,b1) #--debug

return res}

and after i read the mean deviation in the compare.log but the static scene disturb the calculation of the deviation so i wanted to remove them to made an accurate detection and while interlacing field are more visible in hight motion (even in scene change) i have use this basic motion detection :)

Bye.