Skip to content

Instantly share code, notes, and snippets.

@codeliger
Created November 29, 2014 01:58
Show Gist options
  • Save codeliger/7f3825db76005026a9f9 to your computer and use it in GitHub Desktop.
Save codeliger/7f3825db76005026a9f9 to your computer and use it in GitHub Desktop.
<?php
// Total Frames
$tfr = $argv[1];
// Frames Per Second
$fps = $argv[2];
// Key-frame Interval
$kfi = $argv[3];
// Total Key Frames
$tkf = ($tfr - ($tfr % $kfi) ) / $kfi;
// Elapsed Time
$eti = ( $tfr - ($tfr % $fps) ) / $fps;
echo "\n";
echo "Total Frame Count : $tfr\n";
echo "Key-frame Interval : $kfi\n";
echo "Frames Per Second : $fps\n";
echo "Total Run Time : $eti Seconds\n";
echo "Total Key-frames : $tkf\n";
echo "\n";
for($i = 1; $i <= $tfr; $i++){
$pad = str_pad($i, strlen($tfr), "0", STR_PAD_LEFT);
if( !($i % $kfi) )
echo "F$pad [X]";
else
echo "F$pad [ ]";
echo ($i % $fps == 0) ? "\n" : null;
}
echo "\n";
@codeliger
Copy link
Author

usage php keyframe-analyser.php [frames] [fps] [key-frames]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment