Free Function Friday Ep.36 – fpsCheck

May 27th 2016 08:00:42am

Welcome to Free Function Friday. If you have ever dealt with a large project that contains image sequences and video files, you’ve probably come across a moment where you’ve imported a clip at the wrong frame rate or a clip was initially set to the wrong frame rate.

In larger projects it can be difficult to track down the mismatched footage items. This function is just for that moment. You supply it a master frame rate that you want to compare against and any FootageItem object that does not match your frame rate will be gathered. In our example I use the name of the files, but you can certainly use the object reference itself for the footage item. Doing this would allow for you to process those mismatched clips however you like.

Source Code:

alert(fpsCheck(24));

function fpsCheck(fps){
	var proj, projLen, curItem, mismatch;
	proj = app.project;
	projLen = proj.numItems;
	mismatch = new Array();
	for(var i=1; i <= projLen; i++){
		curItem = proj.item(i);
		if(curItem instanceof FootageItem){
			if(curItem.hasVideo == true){
				if(curItem.mainSource instanceof SolidSource){
					//Skip item
				}else{
					if(curItem.frameRate != fps){
						mismatch.push(curItem.name);
					}
				}
			}
		}
	}
	if(mismatch.length > 0){
		return mismatch;
	}else{
		return null;
	}
}
Checkout more:
Free Function Friday Ep.39 – setMaskPaths
Free Function Friday Ep.10 – resizeComp
Expression Shorts Numerical Readout
Houdini Mardini Fantasy
Houdini Mardini Mud