I get some e-mail from Andreas J. and decide post it here for discussion:
I trying to use DePanEstimate for scene detection & Extraction of JPEG-FIles.
As far as I have tested, It will do what I want.
I would like to do detect the scenes an extract JPEG thumbnails in one step.
My problem is, that I havent found a way to formulate the if-clause because I Havent Found a way to get the "Trust" Value or the dx-value for each frame
As I Understand your Plugin, it is currently not possible to get these values during runtime.
Is it possible to extend DePanEstimate to do this?
My Ideas for this are:
1) getting the "trust" - value as a variable during the processing of the each frames
in AviSynth a condition like
DePanEstimate.Trust < 3.5 ? ExtractKeyframe(currentFrame):nop()
(Okay, I need todo it on every frame with EvaluateFrame() or ScriptClip() but my Scripting Experiance
ist only only 10 Hours with Avisynth ;-):
2) by adding a function "DePanIsKeyFrame" with nearly the same parameters as DePanEstimate
(as far as I understand DePanEstimate SceneChange will come if myTrust-value > Trust(CurrentFrame)
3) another possibility could ba a function (DePanExtractKeyFrames (trust = 3.5, log = "c:\myfilename, KeyFramesEvery=1500, SkipMultiKeyframes=25…)
The log will consist of lines where myTrust <= Trust (Frame) where
"KeyframeEvery" will force-add keyframes(in this case every minute 25fps*60= 1500 and
"SkipMultiKeyframes" will not allow new keyframes for x frames if another (not forced) keyframe was detected before
(it should prevent to get 25 keyframes a second…. )
The log should also contain the trust-value and a info if KeyframeEvery-conditions was positive
4) my last idea is: a extlog="c:\myFilename.log" the result is a the same as the "log=" -LogFile
plus 2 additdional values: the trust value and "Scenechange"-Info.
So it would be goot to parse the logfile with PHP.
But a second step is needed to extract the thumbnails.
A Perfect solution would be a combination out of 1) & 3) & 4)
Sorry for so many ideas, but your tool has so much power….
Do you think you will find / a way to make scene-detection & frame extraction easier?
Here is my current script:
MayBe it ist much easier as I thought…..
Code:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MPEGDecoder.dll")
global ThumbNailPath = "D:\_Szenenerkennung\videos\Bilder\"
global LogFilename = "D:\_Szenenerkennung\MyLog.txt"
myMPEGSource = MPEGSource("D:\_Szenenerkennung\videos\25.mpg")
myVideo = ReduceBy2(myMPEGSource)
myVideo = ConvertToYV12(myVideo)
function SaveFrame (myClip, myFrameNumber)
{
###Uncomment to display frame number
myClip = Subtitle( myClip, string(myFrameNumber))
### Export JPEG Image
ImageWriter(myClip, file = ThumbNailPath, start = myFrameNumber, end = myFrameNumber, type = "jpeg",info=true)
### WriteLogFile
WriteFile(LogFilename, """ "CurrentFrame: " """ ,"current_frame")
return (last)
}
#myVideo = ScriptClip(myVideo,"depanestimate(myVideo,trust=4,log=""" "scenes.log" """,info=true,show=true)")
myVideo = depanestimate(myVideo,trust=4,log= "scenes.log",info=true,show=true)
###Export KeyFrame
### a Key Frame yould only be exported when myTrust <= (DePanEstimate.Trust(frame))
myRGBVideo = ConvertToRGB24(myVideo)
ScriptClip(myRGBVideo, "SaveFrame (myRGBVideo,current_frame)")
It would make me very happy to get an Idea how this problem could be solved..