EMP traceLinks patch

Todays patch fixes some bugs when handling stills and movie clips with traceLinks.py. This also required a few extra lines in the mistika.py module, so you’ll have to update that as well.

Just extract the archive to your emp directory and overwrite the existing files.

Download patch 100606

EMP release 0.2

As some of you may now, I’ve written quite a few scripts over the last couple of years for making my life with Mistika easier. The tools range from Final Cut to Mistika xml conform, media files consolidating and an audio normalize calculator, to afterscripts for making various compressed movie formats easily. I recently began the process of cleaning those up a putting them into a single package – EMP, or Effcient Mistika Project.

Version 0.2 is now ready, and all you have to do is extract the emp_0-2.tgz to a permanent location and run empSetup.py in the Tools directory. You may have to do that from a terminal (but only as your Mistika user), and as always with these kind of things, I advice you to backup your MISTIKA-ENV folder first. Some scripts have destination variables that needs to be set (see below), and some settings can be set in ~/.emp/emp.py

An EMP-button will be created in your App-panel (or Extras in 5.0) and all afterscripts will be listed in the render panel.

Download EMP 0.2

Here comes a short description of the various files included:



Move’s the rendered MOVIE file to a location specified in the outDir variable


Makes a 640×360 MPEG1 file using the whole image frame.
Use separate audio when rendering.
Set the outDir variable to specify output directory


Makes a quicktime MPEG4 in the current resolution.
Use separate audio when rendering.
Set the outDir variable to specify output directory


Makes a 640×360 QT MPEG4 file.
Use separate audio when rendering.
Set the outDir variable to specify output directory


Makes a iPhone compatible video file.
Use separate audio when rendering.
Set the outDir variable to specify output directory



Converts audio or video input and converts it to a Mistika-friendly format.
This can also be used as a droplet. Put a shortcut on your desktop, and you’ll be able to drag media files directly onto it to convert.


This sets up all files and settings for the emp install


This will check all .js files for the project against .env files in the projects DATA folder (subfolders are not checked) and move every file not in use to a trash folder. The default path is a folder called trash in your JS folder, but this can be changed in ~/.emp/emp.py


Will trace the links for a selected clip in a Mistika timeline step by step. Just test it. Nothing scary about this one.


Well look for references to this project in all other projects, so you can know if it’s safe to delete this project without screwing up another one.


Will report the peak audio level of a selected clip.


This is a very basic Final Cut .xml -> Mistika .env utility. Nowhere near stable, but definitely a time saver.
Just select an xml file and then a source folder. You can add a media source folder each time you click OK, and when all are added, click Cancel to start the actual conform.

Read groups in a Mistika timeline with PHP

Here’s some code to read top-level groups from a Mistika timeline (.env-file). If all films are stored in separate groups with names, this snippet will list all films and their length (in both 25 and 24 frames TC).

Will produce something like this:

  • Test.env
    • Film one 00:00:20:0025 00:00:20:2024
    • Film two 00:00:20:0025 00:00:20:2024
function framesToTC($frames, $framerate) {
	$hours = floor( $frames / ( $framerate * 60 * 60 ) );
	$framesleft = $frames - ($hours * $framerate * 60 * 60);
	$minutes = floor( $framesleft / ( $framerate * 60 ) );
	$framesleft -= ( $minutes * $framerate * 60 );
	$seconds = floor( $framesleft / ( $framerate ) );
	$framesleft -= ( $seconds * $framerate );
	$tc = sprintf("%02d:%02d:%02d:%02d", $hours, $minutes, $seconds, $framesleft );
	return $tc;

function groupsInEnv( $envAbsPath ) {
	$groups = array();
	$balance = 0;
	$envH = fopen($envAbsPath, 'r');
	while (!feof($envH)) {
		$line = fgets($envH);
		if ( strpos($line, "Group(") === 0 && $balance === 1 ) {
			$waitForName = 1;
		elseif ( strpos(ltrim($line), "n(") === 0 && $waitForName == 1 ) {
			$groupName = substr(trim($line), 2, -1);
			$waitForName = 0;
			$waitForLength = 1;
		elseif ( $waitForLength == 1 ) {
//                                $groups[$groupName] = substr(trim($line), strpos($line, "W("), strpos($line, ")", strpos($line, "W(")) - 1);
			$expLine = explode(" ", $line);
			$groups[$groupName] = substr($expLine[2], 2, -1);
			$waitForLength = 0;
		$balance += substr_count($line, "(");
		$balance -= substr_count($line, ")");
	if ( count($groups) === 0 ) {
		$groups["Timeline has no groups"] = "N/A";
	return $groups;
$project = $_GET['mistika'];
$dataDir = "/PROJECTS/$project/DATA";
$timelines = scandir( $dataDir );
$out = "<ul>";
foreach( $timelines as $timeline){
	if ( substr($timeline, -4) == ".env" ) {
		$out .= "<li>$timeline<ul>n";
		$films = groupsInEnv("$dataDir/$timeline");
		foreach( $films as $film => $filmFrames ) {
				$out .= "<li><b>$film</b>     ".framesToTC($filmFrames, 25).'<sup>25</sup>     '.framesToTC($filmFrames, 24).'<sup>24</sup></li>';
		$out .= '</ul></li>'."n";