Most of the code below is from a ImageJ template, with only the last 6 lines being custom-made. The purpose is to choose only certain frames in a video, and export the smaller video as .avi. I wish to batch-process this. However, the last piece of code (that saves the video) doesn't seem to work... any ideas?
input = getDirectory("Input directory");
output = getDirectory("Output directory");
Dialog.create("File type");
Dialog.addString("File suffix: ", ".avi", 5);
Dialog.show();
suffix = Dialog.getString();
processFolder(input);
function processFolder(input) {
list = getFileList(input);
for (i = 0; i < list.length; i++) {
if(File.isDirectory(input + list[i]))
processFolder("" + input + list[i]);
if(endsWith(list[i], suffix))
processFile(input, output, list[i]);
}
}
function processFile(input, output, file) {
open(input + file);
run("Make Substack...", " slices=1-293-5");
run("AVI... ", "compression=None frame=1.96 save=&output+&file");
close();
close();
}