MySQL WordPress oprhan postmeta CleanUp

If your blog get agged probably it get slow . To clean up old SQL entrys there are several plugins but some time like in my case you need to delete millions of outdated Orphaned Post Meta  , than plugins will timeout your SQL Database.

Especially if you experiment with  post  plugins loops can cause very fast tausend of duplicated post and metas.This is the first try to explore and dig a bit deeper into the Developer World , not only from the code and benefit side but also to learn more about the style and thinking that build the red line thru all his work . Many times phantastic people nearly disappear online and there Blogs get abandoned . Most likely one of the Big 5 IT cooperation already hired him and no time for free plugins or Blogging .

  • Revisiones
  • Auto drafts
  • Deleted comments
  • Unapproved comments
  • Spammed comments
  • Deleted comments
  • Orphaned post meta
  • Orphaned comment meta
  • Orphaned user meta
  • Orphaned term meta
  • Orphan term relationships
  • Unused terms
  • Duplicated post meta
  • Duplicated comment meta
  • Duplicated user meta
  • Duplicated term meta
  • Transient options
  • Optimizes database tables
  • oEmbed caches in post meta

Wp- Sweep is from the Developer Lester Chan a well known high profile WordPress Developer . The Plugin works smooth and clean following WordPress Tables and Terms as long they stay below 100.000 entry then it still works but can take extremely long and outtime your SQL Database on a shared hostThe image below show the wp sweep admin screen after cleanup .Of course before you make any change or clean up in your database dont forget the full backup . For a faster access i use a client like Sequel Pro to manage all the Databases<code>

DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL

</code>

MAMP Info for Compiling

Package & Compatibility with MAMP 2.1.1 Free version

Just a reference post,  Active Configuration are in Bold

  • Apache HTTP Server 2.2.22
  • PHP 5.2.17
  • PHP 5.3.14 (MAMP PRO only) you can change this if you compile your own php
  • PHP 5.4.4
  • MySQL 5.5.25
  • phpMyAdmin 3.5.1
  • SQLiteManager 1.2.4
  • Alternative PHP Cache (APC) 3.1.9
  • curl 7.24.0
  • eAccelerator 0.9.6.1
  • Expat XML Parser 2.0.1
  • FreeType 2.4.8
  • gettext 0.18.1.1
  • jpeg 8d
  • libiconv 1.14
  • Libidn 1.17
  • libmcrypt 2.6.8
  • libpng 1.5.7
  • libxml2 2.7.8
  • libxslt 1.1.26
  • Sablotron XML processor 1.0.3
  • t1lib 5.1.2
  • XCache 1.2.2
  • XCache 1.3.2
  • Xdebug 2.2.0
  • PHP/YAZ 1.0.14
  • YAZ 4.0.1

Upgrading my OSX php to 5.5 not recommended need a upgrade to MAMP3 . Wy we dont upgrade to the new version ? Settings and custom Build for this version was a lot of work and not documented that well like i log now every change on the system that was the main reason i stuck for very long on the running MAMP 2.2 .

Helpful HomeBrew and Terminal Commands for Mac OSX

Since i just learn to work with brew and debug some build problems this is a little resoruce to help beginner who like compile there builds. This resource was created by experimenting with a custom MLT build. Read also the Formula Cookbook to learn more . Some note

Xcode is required for adding PHP modules

Brew install all kegs in a Cellar   /usr/local/Cellar//   and simlink them

How to modify brew scripts ? 

Once downloaded all brew scripts can be found following dir . The ruby Install scripts can be edited or extended as you like

/usr/local/Library/Formula

Where is your recent install of Fromula ?

brew --prefix 

All installed Packages via brew

brew list

All Homebrew Logs

/Library/Logs/Homebrew

How to turn on Debug mode for Brew ?

brew install --verbose --debug 

More Brew install with flags

brew install --universal
brew install --build-from-source

Unistall Brew Package

brew uninstall 

How to create a Folder SimLink

ln -s ~/"Foo Bar/" Foo

How to reload .bash_profile from the Terminal 

source ~/.bash_profile

How to identify 32-bit and 64-bit file types on MacOS X ? With  

 file /usr/lib/fooooooo.dylib

Mac Terminal Permission

List all USER  in Terminal

dscl . -list /Users UniqueID

Repair Home User Permission : Replace username with your username all lower case no space
 sudo chown -R username:admin /Users/username

Show Logged in User Name

id -un

List all Groups

dscacheutil -q group

Edit PATH environment vars

Will open the bash_profile with your default editor , in our case with sublime text 2

touch ~/.bash_profile; open ~/.bash_profile

Apache Mac Terminal Commands

start apache Server

sudo apachectl start

Stop Terminate apache

sudo apachectl stop

Restart Apache from Terminal

sudo apachectl restart

Show Apache Version

httpd -v

apache start with terminal output for Error and debugging

apachectl -t

Common Brew install messages

Even after insalling a package dont mean its available for the system if its keg-only its not linked as the system have already a version. If you whant to build with that lib or package you must include the LDFLAGS  and CPFLAGS in your make file or you can try to –force linking for your compile .

keg-Only 

This formula is keg-only, which means it was not symlinked into /usr/local.

OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/curl/lib
    CPPFLAGS: -I/usr/local/opt/curl/include

Apache versions for differnt OSX

OSX Lion

OSX Yosemite is Apache/2.4.10

OSX Snow Leopard Apache/2.2.24

Interesting Follow ups

How to Homebrew install specific version of formula?

Setting up a local web server on OS X

ImageProzessor Compiling make stills2dv for OSX

First of all i have to mention that comping software i am very new to had just compiled ffmpeg and imagic for my Dev MAMP work field. But after got hot with image and video processing software like MLT . I just found the gorgeous branch stills2dv . Zooming probably is not the big thing but how the lib speed and slow up the pans and zooms is the best and most intuitive i have seen. Building the workfile is like writing a Text script how to zoom and Pan . Very simple if you have a bit of feeling for Pans & Zooms .

This stills2dv package have some very sweet Zoom and Pan options for still images but was build for Linux and some outdated lybs and commands made it a bit hard for me compile. for future i will note here what i change to get it work .Last but not least dropped in as i would like huge panorama images and return a video that can be shared on social media platforms like Facebook or Instagram. That as a terminal batch proces without opening any editing software.

Future idea is to create the workfile for pan zoom with a html editor.

First of all watch the video to get a impression what is the still2dv can do

First make sure you have the needed libs Installed

X11 installed

most likely this packages are already on your machine

libc
gcc
make
libjpeg-dev
libpng-dev

 

Some changes for the PATH to work on OSX below my make file with corrected paths. The only change was in the first lines  -lXext and -lX11 made me some trouble till i installed XQuartz .

PREFIX = /usr
CC = gcc
COPTIONS = -Wall -g -O4
CLIBS = -ljpeg -lpng -lm -I/opt/X11/include -L/opt/X11/lib/ -lXext -lX11

all: stills2dv

hash: hash.c stills2dv.h
	$(CC) -o hash $(COPTIONS) hash.c

stills2dv: s2d_main.o s2d_ppm.o s2d_jpg.o s2d_png.o s2d_smoothing.o x_lowlevel.o
	$(CC) -o stills2dv  $(COPTIONS) s2d_smoothing.o s2d_ppm.o s2d_jpg.o s2d_png.o s2d_main.o x_lowlevel.o $(CLIBS)
	echo You may try the command: make example

s2d_main.o: s2d_main.c stills2dv.h
	$(CC) $(COPTIONS) -c s2d_main.c

s2d_jpg.o: s2d_jpg.c stills2dv.h
	$(CC) $(COPTIONS) -c s2d_jpg.c

s2d_png.o: s2d_png.c stills2dv.h
	$(CC) $(COPTIONS) -c s2d_png.c

s2d_ppm.o: s2d_ppm.c stills2dv.h
	$(CC) $(COPTIONS) -c s2d_ppm.c

s2d_smoothing.o: s2d_smoothing.c stills2dv.h
	$(CC) $(COPTIONS) -c s2d_smoothing.c

x_lowlevel.o: x_lowlevel.c
	$(CC) $(COPTIONS) -c x_lowlevel.c

clean:
	rm -f *.o stills2dv hash Example/out.mpg tmp/* out.mpg tmp.mpg ffmpeg2pass*.log *~

clean_temp:
	rm -f *.o tmp/* tmp.mpg ffmpeg2pass*.log

example: stills2dv
	mkdir -p tmp
	rm -f tmp.mpg out.mpg
	./stills2dv -tmpdir tmp -showoutput exampleworkfile.s2d
	ffmpeg -r 30.00 -f image2 -i tmp/%05d.jpg -i example_data_files/09_1_2_3_4.mp3 -vcodec mpeg4 -vb 9000k -ab 128k -aspect 16:9 -pass 1 tmp.avi
	ffmpeg -r 30.00 -f image2 -i tmp/%05d.jpg -i example_data_files/09_1_2_3_4.mp3 -vcodec mpeg4 -vb 9000k -ab 128k -aspect 16:9 -pass 2 out.avi
	rm -f tmp/* tmp.avi
	mplayer out.avi -fs



install: stills2dv
	cp -f stills2dv $(PREFIX)/bin
	chmod 755 $(PREFIX)/bin/stills2dv
	chown root:root $(PREFIX)/bin/stills2dv

To run the Install you need also to adapt the install part since root:root doesn’t exist on osx .The install done manually in the terminal

One more change on s2d_png.c since libpng updated some commands will not work. My s2d_png.c following error found on stackoverflow

Chances are you are compiling IM with png.h from libpng-1.5.x but
* Bugs png_longjmp” only exists inlibpng-1.5.x.
* libpng-1.6.17 already installed

changeds2d_png.c to following . Mostly replaced the old format to the new strukture

png_create_info_struct
/**********************************************************************
 *
 * s2d_png.c
 *
 * Author: Denis-Carl Robidoux
 *
 * Copyrights and license: GPL v3 (see file named gpl-3.0.txt for details
 *
 *  
 *
 ***********************************************************************/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <png.h>

#include "stills2dv.h"

Image *readpng(char *fn)
{
  unsigned char header[8]={0};
  int x, y, width, height;
  unsigned char *row;

  png_structp png_ptr;
  png_infop info_ptr;

  unsigned char  ** row_pointers;
  unsigned char *data;
  Image *img;
  FILE *in;
  TRACE;
  in = fopen(fn, "rb");
  if (!in)
    {
      fprintf(stderr," File %s could not be opened for reading", fn);
      return NULL;
    }
  if (fread(header, 1, 8, in)!=8)
    {
      fprintf(stderr, "Failed reading header of %s\n", fn);
      fclose(in);
      return NULL;
    }
  if (png_sig_cmp(header, 0, 8))
    {
      fprintf(stderr," File %s is not recognized as a PNG file", fn);
      fclose(in);
    }
     
  png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
	
  if (!png_ptr)
    {
      fprintf(stderr," png_create_read_struct failed");
      fclose(in);
      return NULL;
    }

  info_ptr = png_create_info_struct(png_ptr);
  if (!info_ptr)
    {
      fprintf(stderr," png_create_info_struct failed");
    }

  if (setjmp(png_jmpbuf(png_ptr)))
    {
      fprintf(stderr," Error during init_io");
    }
  png_init_io(png_ptr, in);
  png_set_sig_bytes(png_ptr, 8);
  png_read_info(png_ptr, info_ptr);

  
  height = png_get_image_height( png_ptr,  info_ptr);
  width = png_get_image_width( png_ptr,  info_ptr);
  
  png_set_interlace_handling(png_ptr);
  png_read_update_info(png_ptr, info_ptr);
  if (setjmp(png_jmpbuf(png_ptr)))
    {
      fprintf(stderr," Error during read_image");
    }
  if((row_pointers = (unsigned char **) malloc(sizeof(unsigned char *) * height))==NULL)
    {
	fprintf(stderr, "Out of memory allocating rows index for png\n");
	png_destroy_info_struct(png_ptr, &info_ptr);
	//png_destroy_struct(png_ptr);
	return NULL;
    }
  for (y=0; y<height; y++)
    if((row_pointers = (unsigned char *) malloc(  png_get_rowbytes(png_ptr, info_ptr) ))==NULL)
      {
	    fprintf(stderr, "Out of memory allocating rows for png\n");
	    while(y>1)
	  {	   
	    free(row_pointers);
	  }
	free(row_pointers);
	png_destroy_info_struct(png_ptr, &info_ptr);
	//png_destroy_struct(png_ptr);
	return NULL;
      }
  png_read_image(png_ptr, row_pointers);
  fclose(in);
  if((img=(Image *)malloc(sizeof(Image)))==NULL)
    {
      fprintf(stderr, "Out of memory creating header while opening png\n");
      png_destroy_info_struct(png_ptr, &info_ptr);
      //png_destroy_struct(png_ptr);
      for (y=0; y<height; y++)
	free(row_pointers);
      free(row_pointers);     
      return NULL;
    }
  memset(img, 0, sizeof(Image)); 

  if((img->data=(unsigned char *)malloc(width * height * 3))==NULL)
    {
      fprintf(stderr, "Out of memory for image while opening png\n");
      png_destroy_info_struct(png_ptr, &info_ptr);
      //png_destroy_struct(png_ptr);
      for (y=0; y<height; y++)
	free(row_pointers);
      free(row_pointers);     
      free(img);
      return NULL;      
    }
  if( png_get_color_type(png_ptr, info_ptr)  == PNG_COLOR_TYPE_RGB)
    {
      
      for (y=0;y<height;y++)
	{	  
	  memcpy(&img->data, row_pointers, width*3);
	}
    }else if ( png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGBA)
    {
      data=img->data;
      for (y=0;y<height;y++)
	{
	  row=row_pointers;
	  for(x=0;x<width;x++)
	    {
	      *(data++)=*(row++);
	      *(data++)=*(row++);
	      *(data++)=*(row++);
	      row++;
	    }
	}
    }else if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY)
    {
      data=img->data;
      for (y=0;y<height;y++)
	{
	  row=row_pointers;
	  for(x=0;x<width;x++)
	    {
	      *(data++)=*row;
	      *(data++)=*row;
	      *(data++)=*(row++);
	    }
	}
    }else if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
    {
      data=img->data;
      for (y=0;y<height;y++)
	{
	  row=row_pointers;
	  for(x=0;x<width;x++)
	    {
	      *(data++)=*row;
	      *(data++)=*row;
	      *(data++)=*(row++);
	      row++;
	    }
	}
    }else
    {
      fprintf(stderr, "Unsupported PNG format, we do not support indexed color (yet)\n");
      png_destroy_info_struct(png_ptr, &info_ptr);
      //png_destroy_struct(png_ptr);
      for (y=0; y<height; y++)
	free(row_pointers);
      free(row_pointers);     
      free(img->data);
      free(img);
      return NULL;
    }
  img->width=width;
  img->height=height;
  png_destroy_info_struct(png_ptr, &info_ptr);
  //png_destroy_struct(png_ptr);
  for (y=0; y<height; y++)
    free(row_pointers);
  free(row_pointers);     
  img->fn=strdup(fn);
  return img;
}

Now we are at the point that make and sudo make install works without any error.

IMPORTANT

We need XQuartz  works fromOS X 10.6.3 till  El Capitan  , Download and install this part output the images to the window and will get started from the terminal as soon Showoutput get executed.

Run in Terminal

stills2dv -tmpdir tmp -showoutput workfil_pano.s2d

Terminal returns and start prozessing your workfile and place all images in the tmp folder. My  workfil_pano is a simple pan from left to right

resolution 1200×830

fps 25

type jpg

img Kaiserpano.jpg zoom FITHEIGHT startpoint LEFT endpoint RIGHT duration 29.00Creating framCreating fCreaCreating frame #00024 at x= 244.22 y= 165.00 and zoom 4.06

After all Zoom Pan prozessed the tmp is full of single images now combine them with ffmpeg to get the final movie

ffmpeg -r 25.00 -f image2 -i tmp/%05d.jpg -i myaudiofile.mp3 -target pal-dvd -s 1920x1080 -vb 9000k outvid.mpg

I hope i dont forget anything , its already some days ago

Extending WordPress Revolution Slider for Cover area

Since i discovered the revolution Slider iam got a big fan of the Slider even its quite heavy load but on some pages its more than worth. But the problem as long its not a part of your theme the Slider will play only in my blog content area . So i wish to play revolutions slides even in the banner area . Socalled execute revolution Shortcodes on the single blog page and even on the frontpage slider .Where i normally chose images who should rotate.

Here a view lines of code i added to the theme frontpage theme template . To clarify i use the Blip Theme and Option Tree to setup theme options and more . Blimp is not any more maintenance so any change and upgrade i have to make myself.

<?php $sliders = ot_get_option('pxg_bliv_homepage_slider'); ?>
<div class="featured-inner flexslider">
 <ul class="slides">
 <?php 
 // ALL TIME RENDER BACKGROUND IMAGE 
 foreach ($sliders as $key => $slider) { ?>
 <li style="background-image: url('<?php echo $slider["image"] ?>')">
 <?php
 // IF REVOLUTION SLIDER 
 if (preg_match("/(?<=alias=\").*?(?=\"\])/s", $slider["title"], $result)){
 $revolID = $result[0];
 } 
 if (strpos($slider["title"],'');
 
 // RENDER ANY SHORTCODE WE FOUND IN TITEL 
 }elseif(strpos( $slider["title"], '[' ) !== false){ 
 
 echo do_shortcode($slider["title"]);
 
 // ELSE DAFULT SLider
 }else{ ?> 
 <div class="container">
 <span class="sub-title"><?php echo $slider["description"] ?></span>
 <span class="title"><?php echo $slider["title"] ?></span>
 </div>
 
 <?php } ?>
 </li> 
 <?php } ?>
 </ul>
 </div>

To explain the code , we check if a revolution slider shortcode is in the Title if so we extract the parameter and execute with do_shortcode the Slider . After we look if any other shortcode is in the Title if so we execute that . In my case i use iframe Advanced and sometime i would like to render some fancy D3 animation or Odyssey.js   in the header.  If No shortcode is found we render the default images set in the theme Settings.

this is probably not 100% foolproof but for now it works quite well. Code above is for the front-page.php but its nearly the same for the single blog post page . Below how it looks like from a test blog. header cover is with revolution slider and fully anim able from the backend . The Slider loads beforehand the default image still the Big Slider is finally loaded. This is nothing that make since for fast pages but since i seperate Blog and Main page it will not affect the blog.

Screen shot 2016-01-07 at 14.37.00

Just wrote this down to remember all the little changes for later, or if i change the theme one day. Formating of the code need to be changed to be a little bit clearer

 

The Reason We Decided to Change Locations

S eparated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. l using her.Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.

But nothing the copy said could convince her

and so it didn’t take long until a few insidious

Copy Writers ambushed her

The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane. Pityful a rethoric question ran over her cheek, then she continued her way. On her way she met a copy.Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. l using her.Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.

A New Beginning Awaits

Even the all-powerful Pointing has no control over the situation.

Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen.

She packed her seven versalia, put her initial into the belt and made herself on the way. l using her.Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.S eparated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way.

l using her.Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.

Sentences fly into your mouth.

far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.

Her hometown Bookmarksgrove.

far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. Click the edit button to add your testimonial. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen.

She packed her seven versalia, put her initial into the belt and made herself on the way. l using her.Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.

MLT mltframework install for OSX

A short overview how to install MLT on a Mac OSX since most hints are for Linux user and the path is not that simple for a non Linux User its a work in progress with a long way to debug the missing GTK . Without GTK we will not get any Text over the Videos as all other modules will fail to render Text.  These is a long journey to compile MLT and all needed packages on a OSX 10.6 with brew . I have to mention here that iam a total Unix nop and mostly i log the process here to repeat the same on a second framework or other versions. Why i document all steps and possible errors in that details ? At the moment i run my dev MAC on Snow Leopard the same procedure  i will need to repeat on upgrade to El Captain and hopefully this blog post helps a bit. Additional quote new in compiling software so its a learning procedure log. Pleas keep in mind iam just a beginner with compiling software so probably they are better ways.

What is MLT ? 

An open source multimedia framework, designed and developed for television broadcasting. For Processing Video Effect a very open plugin architecture make it easy to extend it . Probably the most powerful Multimedia Framework you can find with a very aktive Developer ! Kdenlive is only a GUI. All video processing is done by MLT. Recommended if you want to learn MLT is Shotcast APP a guy interface for MLT from the same developer.

Tell the User Stories

Need the MLT with ffmpeg to use for some movie generation via php . The first MLT install was quite smooth except that i don’t care to much about some missing libys and additional sound libs what result in a fail of text rendering on video. MLT Framework compiled from Source.

FFMpeg and IMAGEemagick was installed already and working on the MAMP environment using 10.6 Snow Leopard xcode  X11: 2.3.6 => /usr/X11

In my case i use Homebrew for most packages , the mltframeworks describe how to process with macports what i don’t want to install again . First of all check that your brew is updated and correct working. Keep in mind that some make prozess take very long  ! Best place to start was the kdenlive help page  even it was for linux.

Why Homebrew installs into /usr/local  ? Because its easy and save.

 Packages updated keep all fresh

Fix all errors you can find. Thats sound easy but will be the most important part. If the brew upgrade process fail or get stuck just execute one by one formula by brew update

brew update &  brew upgrade

brew doctor

Check the needed dependencies for MLT , below a list with marked Ok for brew formulas and NoP for none. UPDATE brew now offer a MLT formula but with no config option and default is with -disable-gtk  what means no text overlay 🙁

The Simple way with brew

brew install mlt

brew config : ./configure –prefix=/usr/local/Cellar/mlt/0.9.6 –disable-jackrack –disable-swfdec –disable-gtk

The downside it will install MLT without GTK so no text over video rendering engine. even if you change the config flags gtk it will not compile without some errors. But a good starting point to experiment with MLT.

If something runs wrong

brew install --verbose --debug mlt

Required packages for a Linux install, since the devel Dev versions are not available in a OSX we need compile them from source.To compile anything on OS X, you’ll need to have XCode .
Installing X11 : In OS X 10.8 Mountain Lion and later, X11 is not provided anymore. You need to install XQuartz, from http://xquartz.macosforge.org/landing/. In earlier version of OS X, this is not stricly necessary, but recommended as XQuartz is more robust and updated that the system-provided X11.
In our case GTK and Cairo can compiled with X11 or without ,default is without that will brake our build for MLT.One big problem compiling MLT with GTK was that it get the wrong libs. To force the build process to use our own gtk+ we place the PATH for GTK before the X11 PATH in our private_Bash ,Like below. How to compile gtk+ with the dev packages is excellent explained in Building GTK-OSX this was the only source who describe how to compile gtk -dev what is needed for MLT with GTK on OSX.  Mac OSX (Snow Leopard in this case) already ships with many libs  (or a own version of it). Brew will install this as keg-only to use it in your build you have to set the the CXXFLAGS LDFLAGS in your make file.

LDFLAGS

CXXFLAGS

export PKG_CONFIG_PATH=/usr/local/gtk/inst/lib/pkgconfig:/usr/X11/lib/pkgconfig/:/usr/X11/lib/pkgconfig/

Following Libs needet for compiling MLT on Linux :

libxml2 libsdl libsdl-image libavdevice (installed with ffmpeg) libswscale libvorbis libsamplerate frei0r (Built from source) libdv libavformat libquicktime           

KDNlive installing MLT

Highly recommended Audio Packages -dev builds are needed for compiling (Linux) libsox-dev libjack-dev ladspa-sdk

Tools for building MLT needed:  cmake , git ,subversion , pkg-config ,autoconf  default install dir for packages will be  /usr/local/include/

MLT GTK+ Install problems

It seems that many people have the same problem here and here  if you are not a soft pro. This post brought me to the right path general GTK+ problems read more about troubleshooting GTK 

missing symbols when gtk is built with Quartz backend

Installing required Libraries  brew  Modules Formulars :

If the package installer fails you can try to install every package one by one.

Cairo 

Cairo is a 2D graphics library with support for multiple output devices. Currently supported output targets include the X Window System (via both Xlib and XCB), Quartz, Win32, image buffers, PostScript, PDF, and SVG file output. Experimental backends include OpenGL, BeOS, OS/2, and DirectFB.  Cairo formula

brew install cairo

frei0r : Filter modul , install frei0r

brew install frei0r

Pango : Internationalized text layout and rendering library Install Pango

brew install pango

GTK2 Why is this package not being found ?

GTK+ : This was quite the  hardest nuts, MLT never found the gtk2 package respond after config with . Important remove any trace of fink and macport reported by brew doctor else it will brake your build since its a  jhbuild  Mixing Fink or MacPorts and GTK-OSX will fail.

Configuring modules/gtk2:
- GTK2 components not found: disabling

What is GTK ? Gtk is a unix graphical framework originally designed to run on Unix systems with X-Windows but it provides multiple backends including one for OS X’s Quartz graphics engine, so it can be built to run on OS X without enabling the X11 subsystem.

tray install GTK 2.0 first with  brew but still the development devels are missing

brew install gtk+

Debugging GTK2

In my case gtk2 never get recognsied by MLT ./config .

1. Check the config Flags for GTK, the first gives the option to link the libs, the second the paths; I usually use something like

pkg-config gtk+-2.0 --libs
pkg-config gtk+-2.0 --cflags

To debug the installer you can add following into the gdk build configure script  located in the melt0.8.9/src/modules/gtk2 . add the debugger for pkg-config around line 24 where it chose to brake your GTK . It will output all the single steps and paths to make it easy to find the bottle neck.

pkg-config $pkgconfig_prefix gtk+-2.0 --debug

FLAGS output

Package libpng16 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpng16.pc’
to the PKG_CONFIG_PATH environment variable
Package ‘libpng16’, required by ‘gdk-pixbuf-2.0’, not found

 

Libexif  :EXIF parsing library

brew install libexif

QT : Install

install QT important need some quite long time 120 min

brew install qt

SOX  SoX – Sound eXchange apply various effects and convert sound formats. Sound Modules

Install Sox

brew install sox

 

swfdecFlash  modul no brew formula  last update 2008 version 0.8 SWFDEC is also as binary available see FAQ . Mltframework have a own fork swfdec  2012  install swfdec

git clone git://anongit.freedesktop.org/swfdec/swfdec

cd swfdec

MoveIT :

openGL Filters    Release Movit 1.1.3.         2015 by Steinar H. Gunderson . Meanwhile in the Galaxy

git clone “http://git.sesse.net/movit/”

Install Ffmpeg with MAX options

MLT Config Option

To understand the MLT build script its build with jhbuild . Since we need the full developer envoirment for GTK we build our own GTK build for OSX   this guranti us that we have a mostly complete GTK developer Enable GPL is needed to activate all GPL modules   –enable-gpl . Check the MLT Dependencies 

Prefix MLT  –prefix=/usr

Additional we can add prefix for our GTK2 –prefix

Compile and Install MLT for Mac OSX

Thats the most easy part at least on the first run …

git clone git://github.com/mltframework/mlt.git
cd mlt

./configure --prefix=/usr --enable-gpl

 

Terminal out

Configuring framework:
Configuring modules:
Configuring modules/avformat:
Configuring modules/core:
Configuring modules/decklink:
Configuring modules/feeds:
Configuring modules/frei0r:
Configuring modules/gtk2:
- GTK2 components not found: disabling
Configuring modules/jackrack:
- ladspa not found; disabling
Configuring modules/kdenlive:
Configuring modules/linsys:
- does not build on OS X or Windows: disabling
Configuring modules/lumas:
Configuring modules/motion_est:
Configuring modules/normalize:
Configuring modules/oldfilm:
Configuring modules/opengl:
- movit not found: disabling
Configuring modules/plus:
Configuring modules/plusgpl:
Configuring modules/qt:
- Libexif found, enabling auto rotate
- Qt version 4.x detected
./configure: line 183: kde4-config: command not found
- fftw found, enabling lightshow
Configuring modules/resample:
Configuring modules/rtaudio:
Configuring modules/sdl:
Configuring modules/sox:
Configuring modules/swfdec:
- swfdec not found: disabling
Configuring modules/vid.stab:
- vid.stab not found: disabling
Configuring modules/videostab:
Configuring modules/vmfx:
Configuring modules/xine:
Configuring modules/xml:
Configuring mlt++:
Configuring swig:
GPLv2 license used; GPLv3 components disabled

GTK+ options:   –gtk2-prefix=path

make clean
make -j3
sudo make install

Get All Config Flags for MLT   ./configure –help

version: melt 0.9.7

 

After Recompiling GTK+ we get following output . GTK found but all packages installed with brew are now missing . Suggesting some PATH is missing in $PKG_CONFIG_PATH

./configure --prefix=/usr --enable-gpl

Configuring framework:
Configuring modules:
Configuring modules/avformat:
- libavformat not found: disabling
Configuring modules/core:
Configuring modules/decklink:
Configuring modules/feeds:
Configuring modules/frei0r:
Package frei0r was not found in the pkg-config search path.
Perhaps you should add the directory containing `frei0r.pc'
to the PKG_CONFIG_PATH environment variable
No package 'frei0r' found
Configuring modules/gtk2:
- Libexif not found, disabling exif features (auto rotate)
Configuring modules/jackrack:
- jackrack not found: disabling
- ladspa not found; disabling
Configuring modules/kdenlive:
Configuring modules/linsys:
- does not build on OS X or Windows: disabling
Configuring modules/lumas:
Configuring modules/motion_est:
Configuring modules/normalize:
Configuring modules/oldfilm:
Configuring modules/opengl:
- movit not found: disabling
Configuring modules/plus:
- fftw not found: disable fft and dance filters
Configuring modules/plusgpl:
Configuring modules/qt:
- Libexif not found, disabling exif features (auto rotate)
- Qt not found - disabling
./configure: line 183: kde4-config: command not found
- fftw not found: disabling lightshow filter
Configuring modules/resample:
- libsamplerate not found: disabling
Configuring modules/rtaudio:
Configuring modules/sdl:
Configuring modules/sox:
- sox not found: disabling
Configuring modules/swfdec:
- swfdec not found: disabling
Configuring modules/vid.stab:
- vid.stab not found: disabling
Configuring modules/videostab:
Configuring modules/vmfx:
Configuring modules/xine:
Configuring modules/xml:
Configuring mlt++:
Configuring swig:
GPLv2 license used; GPLv3 components disabled
echo $PKG_CONFIG_PATH
/usr/X11/lib/pkgconfig/:/usr/X11/lib/pkgconfig/

POST in Progress 

Video Editing with Scripts

And finaly got it GTK to work

What was the problem ? many libraries not linked since there was a version on the system. with the terminal command we debugg every single lib gtk is complaining and force a link . We needed a force link for cairo ,pixman ,fontconfig ,libpng   for Freetype with

–overwrite freetype

pkg-config --libs --cflags gtk+-2.0

 

Recent Config

./configure --prefix=/usr --enable-gpl

Configuring framework:
Configuring modules:
Configuring modules/avformat:
Configuring modules/core:
Configuring modules/decklink:
Configuring modules/feeds:
Configuring modules/frei0r:
Configuring modules/gtk2:
- Libexif found, enabling auto rotate
Configuring modules/jackrack:
Configuring modules/kdenlive:
Configuring modules/lumas:
Configuring modules/oldfilm:
Configuring modules/opengl:
- movit not found: disabling
Configuring modules/plus:
Configuring modules/rtaudio:
Configuring modules/sdl:
Configuring modules/sox:
Configuring modules/swfdec:
- swfdec not found: disabling
Configuring modules/vmfx:
Configuring modules/xml:
Configuring mlt++:
Configuring swig:
LGPLv2.1 license used; GPL components disabled

Now we can recompile MLT with all the sweet features that it offer . Probably thats not the clearest path but it works now .

Problems Errors that can cross your path :

pango producer, which is related to GTK and
only working, if gtk2 was compiled into MLT ! No text is rendering on video , probably Pango Composer . missing  GTK+ Libs

OpenSSL ≥ 0.9.8  Errors : SnowLeopard and earlier ship with 0.9.7, so if you’re on one of those old platforms you’ll need to upgrade

Perhaps you should add the directory containing `XYZ’
to the PKG_CONFIG_PATH environment variable

Failed to use the precompiled GTK Framework for X11  .

  1. Download the GTK_2.18.5-X11.pkg package from http://r.research.att.com/ and install it
  2. Add to your .profile file in the home directory

Command to edit your .Profile
touch ~/.bash_profile; open ~/.bash_profile

export PATH=/Library/Frameworks/GTK+.framework/Resources/bin:$PATH

Brew Doctor complains : “Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following “config” scripts:”

Check your installed Moduls

Query MLT : melt -query config

Terminal MLT Errors

After installed the new FFPEG you need to recompile MLT if you get following dylib error

mlt_repository_init: failed to dlopen /usr/lib/mlt/libmltavformat.dylib
  (dlopen(/usr/lib/mlt/libmltavformat.dylib, 2): Library not loaded: /usr/local/opt/ffmpeg/lib/libavcodec.54.92.100.dylib
  Referenced from: /usr/lib/mlt/libmltavformat.dylib

HOMEBREW help

Check homebrew log files cd

~/Library/Logs/Homebrew/

MLT USEFUL COMMANDS

-filter videostab2

Best resources

MLTframeworks

MLT config Script

kdenlive

MediaLibs MLT + flags

GTK OSX Building Gnome

Mac Terminal Command cheat list

How do I specify LDFLAGS and CPPFLAGS for ./configure?

Other Related Open Source Video Software :

Shotdetect :Shotdetect is a free software (LGPL) which detects shots and scenes from a video. The result produced is a simple XML file containing all the informations about the movie generated. How to install  shotdetect

Userfull Terminal Commands for debugging

Add path to pkconfig

$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Check if pkgconfig packets are where they should

$ pkg-config --libs --cflags gtk+-2.0