-
Scene Detect: fileObj.open – Line Index -to- Frame# Layer Split?
Scene Detection!…..
So all I’m really trying to do is utilize DaVinci Resolve 12’s awesome Scene Detection feature and get the timeline over to Premiere Pro CC 2015. This utility cuts the video clip wherever there’s a new scene (shot) automatically! 😀 I have tried all the export formats from Resolve (.aaf, .xml, .fcpxml, & .edl) and none result in properly timed cuts in PrPro. More details about what I’ve tried are at the bottom of this post.
The good news is that the Scene Detect utility can save a file format called a SceneCut (.sc) file. [to access that menu, click the 3 dots in the upper-right] It’s a super simple file, just numbers, one each on it’s own line. The first 6 lines are header/vid-length info, then line 7 is frame 0. From there, it’s just a number between 0 and 255 indicating the likelihood that the frame is a new scene (shot). So I decided the quickest way to get that info to PrPro is to script it in AE to split a video layer, and copy those layers to PrPro. Maybe there’s a better way?… idk.
**Before I go any further I should state that yes, I know about “Magnum – The Edit Detector.” It’s clunky and slow compared to Resolve’s built-in utility, which actually visualizes the scene detection on a timeline, and allows you to tweak the tolerances without having to process the clip again. It also shows you a frame along with one before and one after, to make sure it’s right. See it’s glory here!:
So in AE, I’m trying to open this .sc file and read each line. If the number is greater than 100, I want to split the selected layer at frame# ([file line index] -7). It’s minus 7 because the first 6 lines are header info. But how do I refer to the file’s current line (index) number?
I’m using Dan Ebbert’s “Creating Text Layers From File” and Paul Tuersley’s “Split at Markers” scripts as starting points… because I’m clearly a newbie. And there are probably other problems ahead to boot… =/
So something like:
{// create undo group
app.beginUndoGroup("SceneCut Splitter");// Prompt user to select SceneCut file
var myFile = File.openDialog("Please select SceneCut (.sc) file.");
if (myFile != null){// open file
var fileOK = myFile.open("r");
if (fileOK){// make sure a comp is selected
var activeItem = app.project.activeItem;
if (activeItem == null || !(activeItem instanceof CompItem)){
alert("You need to select a layer before running this script");
} else {
// make sure at least one layer is selected
var selectedLayers = activeItem.selectedLayers;
if (selectedLayers.length == 0 ) {
alert("Select at least one layer before running this script.");
} else {// read text lines and create text layer for each
// until end-of-file is reached
var text;
while (!myFile.eof){
text = myFile.readln();
if (text == "") text = "\r";
if (text > 100) app.project.activeItem.time = $line - 7;
if (text > 100) initKeyboardEvent ("Split Layer", true, true, null, U+0044, DOM_KEY_LOCATION_STANDARD, Shift Command);
}// close the file before exiting
myFile.close();}else{
alert("File open failed!");
}}else{
alert("No text file selected.");
}app.endUndoGroup();
}
}
}
And my SceneCut file would be like this (just an example):
0
17982
17975
0
17982
100
0
11
22
33
44
55
66
77
88
99
105
11
12
13
14
200
etc.....
So this idea is that the selected layer would get split at frames 10 & 15, because those lines minus 7 (so lines 17 & 22) were over 100.
But $line is just the script line, no? Is there any sort of “count” or do I have to use .split to make an array and call .length?
Also, I’m clearly trying to use the AE keyboard shortcut for Split Layer (Shift+CMD+D), as it seems simplest; though my syntax may be questionable.
I also just realized that the first 6 lines in the .sc file would actually have to be skipped… oye.Pleeease someone help! Am I way off here?…. BTW Resolve 12 is free, so anyone can download it and try this process out themselves.
https://www.blackmagicdesign.com/products/davinciresolveI commented on my trails in the roundtrip between Resolve 12 and PrPro CC’15 at the bottom of the following post (first comment at under the post). The author replied to me saying he doesn’t have a solution yet for the new Resolve 12 either.
https://www.4kshooters.net/2014/12/08/migrating-timelines-between-final-cut-premiere-pro-avid-and-davinci-resolve/Thanks to anyone who can help me out!!
– Royce
P.S. To get to the Scene Detect dialog in Resolve 12, navigate to your video inside of Resolve, right-click and click on “Scene Cut Detection…”
