Script to detect scene changes?

Patryk Rebisz wrote on 12/1/2009, 1:10 AM
My editors use FCP or Avid and at the end of the edit i get one large QT ProRes file which then i need to color correct... Of course to do that first i need to spend considerable amount of time looking for the edit points... Thus i was wondering if there is a script that can automatically detect scene changes in the QT file making the edits on that point thus saving me TONS of time. ANyone?

Comments

apit34356 wrote on 12/1/2009, 3:06 AM
So, are you asking for a script that reads an external EDL or XML file that puts "M" markers on the the vegas timeline ?
Patryk Rebisz wrote on 12/1/2009, 3:12 AM
No, more like something i don't even exists/is possible. Namely a script/plug-in that reads the QT file and either makes actual cuts where there was a cut in FCP or AVID on the file in the timeline or put the markers on the cuts in the file.
Chienworks wrote on 12/1/2009, 3:48 AM
Scripts cannot know what is inside the media files, so as far as Vegas is concerned this is impossible. You might be able to find a 3rd party application (possibly scenealyzer) that can either split the file or give you an edit list.
apit34356 wrote on 12/1/2009, 5:26 AM
Chien, I was thinking of an app reading the EDL or XML file outputted from the editing system used to produced the single Qmov file and building a veg file with the markers at the proper cut points. A dummy media file could be easily inserted into the veg file and when vegas loads the veg, it would prompt for proper file name then load the markers indexes.
johnmeyer wrote on 12/1/2009, 7:51 AM
The Original Scenalyzer can optically detect scene changes in DV files. There are various ways to interface its output with Vegas.

I have also written several different AVISynth scripts that will work with any video and which optically detect scene transitions.

Anything which analyzes video content cannot do a perfect job, so some manual work is still necessary. A person walking in front of the camera in the foreground, for example, may be detected as a scene change. On the other side, a jump cut, or a cut between two very similar scenes may be missed.

If you want scene detection based on timecode, that can be done as well, although I don't have a script at my fingertips.

There is absolutely nothing that can be done with a Vegas script, however, because the scripting language in Vegas does not provide any visibility whatsoever to the content of the video, including (unfortunately) timecode, date/time, etc.
Patryk Rebisz wrote on 12/1/2009, 10:40 AM
And it only works with AVIs....
farss wrote on 12/1/2009, 12:14 PM
If you can get a text EDL out of the original system then it should be easy enough to do what you want without a script.
Load the text EDL into Excel, select the insert point timecode column and paste that into the Vegas project's Edit Details / Markers window. That should get you a marker at each original edit point. That's probably enough for what you want.
If not then there's a script to convert markers to regions or these one around to make cuts at markers.
From a timeline with regions the Veggie Toolkit's Multirender can render each region as a new file.

I haven't tried all of the above but reading a CMX EDL into Access or Excel I have and that's most of the work done. If nothing else printing out the EDL in an easy to read format would give you a cue sheet and even that is a lot easier than trying to find scene changes but eyeball. You can open a text file in notepad and copy and paste the timecode values to save typing.

Bob.
johnmeyer wrote on 12/1/2009, 12:16 PM
Just to complete the original thought, here's the script which will detect scenes. It will work with anything that AVISynth can read. In addition, if you have Satish's frameserver installed, you can frameserve into the script from Vegas, so that anything that Vegas can read can be used. The result of the script is a text file. You temporarily set the rulers in Vegas to display in Frames, and then cut/paste the frame numbers from the text file into the Edit Details Markers view. You can then use any of the numerous scripts which will cut events at markers (I have one if anyone wants it).

So, if you already have AVISynth installed and know how to use it, this only takes a few steps to set up and is quite fast (I got 500 frames per second yesterday when I used it on a long file that I didn't want to scrub through just to find scene change points).

Here's the script:

#Script to find scene changes 
loadPlugin("c:\Program Files\AviSynth 2.5\plugins\depanestimate.dll")
loadPlugin("c:\Program Files\AviSynth 2.5\plugins\depan.dll")

filename = "e:\scenes.txt"

setmtmode(5)
AVISource("d:\frameserver.avi")
setmtmode(2,0)

converttoYV12(interlaced=true)
separatefields().selecteven()

#The "trust" parameter is what determines the scene change threshold.
#Lower number results in fewer scenes.
data=DepanEstimate(trust=4)

#Uncomment following line for troubleshooting. It puts the scene change threshold numbers on the screen.
#ScriptClip("Subtitle(String(AverageLuma(DepanScenes(data) ) ),align=5)")

WriteFileIf(filename, "(AverageLuma(DepanScenes(data))>30)" , "current_frame")

#Close VirtualDub after running this script in order to close the scenes.txt file
#Also, delete the scenes.txt file after each use.
apit34356 wrote on 12/1/2009, 1:15 PM
Farss, you are thinking along the same lines about the EDL I was but Pat was asking/wanting an auto app or script for a heavy workload it seems. Manually editing the file could be enhance with macros for deleting/replacement....... a lot faster, fewer misses and cheaper than most other approaches. I don't know if Apple's codec behaves well with free third party virtualdub and its buddies.
Patryk Rebisz wrote on 12/1/2009, 11:32 PM
Yeah, i really though there would be an easier solution. Reading the above it seems searching for the edit point by eye is not that much cumbersome then doing through the above hoops...