Hi, I would like to know how scene detection is done. I'm sure there are tools floating around that already do this, but I want to write my own, education purposes, etc.
So, I want to write my own version as a command line tool and write the results to a text file and then load that into another app that I'm working on. Is it too difficult ?
I already have an avi file reader. I just need the logic that analyzes the frame(s) and writes the frame numbers: 00001, 00010, 00105, 00200, ... and so on.
Also, I would be happy to post that cli app once completed.
My language is Pascal (Delphi) but I may be able to read some light c/c++ if it is straight-forward or I could ask questions for any c/c++ speaking people.
Thank you in advance.
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 3 of 3
Thread
-
-
There are lots of posts in the AVISynth section of doom9.org. Check out scene detection done by StainlessS.
I have almost a dozen different scene detection scripts, many of which I've posted at doom9.org. Each of them uses a different approach. The simplest thing is to use the YDifference function that is built into AVISynth. It provides a number that is based on the sum of the absolute differences between each and every pixel in adjacent frames. At a scene change, virtually every pixel is different, so this metric "blows up" and gets really large when there is a scene change. A good script will compare this value for the current frame with the values in adjacent frames in order to detect the spike.
Here is some code to get you started. It will create a text file that contains the frame number where scene changes happen.
Code:filename = "e:\Scenes.txt" global blankthreshold=1.8 source = AVISource("e:\fs.avi").convertTOYV12().killaudio() #Remove the /* and */ comment block in order to see the metrics on screen in order to tune the "blankthreshold" parameter /* script = """Subtitle("\nNext/Prev = " + String( YDifferenceToNext(last) / YDifferenceFromPrevious(last) ), lsp=0)""" final = ScriptClip(source,script) return final */ WriteFileIf(source, filename, "(YDifferenceToNext(last) / YDifferenceFromPrevious(last)>blankthreshold)", "current_frame+1", append = false)
There are quite a few simple utilities that will do this. The old freeware "Scenalyzer" had an "optical" scene detection utility built in. I don't know if it can be used for anything other than DV, however.Last edited by johnmeyer; 7th Nov 2016 at 21:58. Reason: added last sentence
Similar Threads
-
VDub - Automatic Scene Detection? (For recording from Hi8 Tapes)
By BlackFive in forum CapturingReplies: 0Last Post: 19th Sep 2016, 21:46 -
Avisynth, help with scene by scene cropping
By KarMa in forum Video ConversionReplies: 4Last Post: 26th Nov 2015, 09:00 -
Frame Blend Frame Rate Conversion with Scene Change Detection
By ndjamena in forum RestorationReplies: 7Last Post: 3rd Nov 2015, 09:26 -
Calculate Subtitle Synchronizaiton
By lomaidala in forum SubtitleReplies: 52Last Post: 12th Oct 2014, 15:30 -
how to calculate height and maintain a proper AR
By codemaster in forum Video ConversionReplies: 5Last Post: 3rd Mar 2012, 17:58