How to batch convert all Video files to webm with ffmpeg

The task was quite easy to convert a bunch of video files in a Folder to webm format .

There are several free so called free software who announce to do that but most are bumpy and even my so loved miro convertor produce a webm files that don’t play in google chrome . the ffmpeg package inside was outdated.

First check if you have ffmpeg installed on your mac , open the terminal and enter

 

ffmpeg -v 

to  get the version or

wich ffmpeg  

to get the path where its installed

SINGEL WEBM CONVERT WITH FFMPEG

To Convert a single mp4 video file we start with this ffmpeg command


ffmpeg -i myvideofile.mp4 -acodec libvorbis -aq 5 -ac 2 -qmax 25 -threads 2 myvideofile.webm

Markup : ffmpeg  -i INPUT File  Use acodec Libvorbis AC QMAX : qmax and qmin are the ‘quality-ranges’ in which you define to encode.  Expect  that higher the values the lower the quality.

qmin 50 an qmax 51 gives the lowest quality

qmin 0 -qmax 1 gives the highest quality

If we need aditional mp4 files from our quiteime mov file we can use this ffmpeg command. The command line can alos replaced in our batch file below .

ffmpeg -i myvideofile.mov -qscale 0 myvideofile.mp4

WEBM BATCH SCRIPT

Since we have several quicktime mov video files we write a little bash script to to automate this .


#!/bin/bash
for i in *.mov;
do name=`echo $i | cut -d'.' -f1`;
echo $name;
ffmpeg -i "$i" -acodec libvorbis -aq 5 -ac 2 -qmax 25 -threads 2 "${name}.webm";
done

Edit this file with any text editor or code editor like sublime Text . Save it in the folder where your videos are in my case saved as

webmconvert 

Now we need to chmod the file to make it executable

CHMOD 700  webmconvert 

Thats it the basch script takes every video from the folder and convert it to a webml video that plays nice in your HTML5 video player .

Now start the bash script with

./webmconvert 

The first line #!/bin/bash tells the terminal that we are using bash shell,  we loop all files with ending mov output echo the name and save it with the same name as webm.

Install Node on OSX El Capitan for beginner

Problems when installing Node on OSX with brews, the default node path on OSX. For some reason my node modules where all installed in /Users/[homedir]/.npm_packages and Node Modules end up here 

 /Users/[homedir]/.npm_packages/lib/.node_modules

This result in a lot of errors when i try to install JS-Minify for Sublime Text. special if i install modules Globally. 

This is a BlogLog post to reproduce the path if sometime a similar Error occurs in my node environment. At the end you find the stackoverflow links who helped to solve most problems

Installing node through Homebrew can cause problems with npm for globally installed packages. .
$ rm -rf /usr/local/lib/node_modules $ brew uninstall node $ brew install node --without-npm $ echo prefix=~/.npm-packages >> ~/.npmrc $ curl -L https://www.npmjs.com/install.sh | sh </code></p> <p>to the new npm to  PATH environment variable <code class="prettyprint">$ export PATH="$HOME/.npm-packages/bin:$PATH"</code></p> <p>To make the new Path permanent we add it to our .bash_profile add following line <code> #NODE GLOBAL PATH PATH=$HOME/.npm-packages/bin:$PATH </code></p> <p>Reload the bash in Terminal</p> <p><code>source ~/.bash_profile</code></p> <p>Check PATH <code>$ echo $PATH</code></p> <p>Edit $PATH</p> <p><span>vi $HOME/.bash_profile</span></p> <h2>NODE Commands:</h2> <p><code>$ npm config get prefix</code></p> <p><strong><em>Show Version</em></strong></p> <p>$ npm -v</p> <p><strong><em>Show node Version</em></strong></p> <p><span>$ node –version </span></p> <p><em><strong>Get Path where NPM is installed</strong></em></p> <pre class="lang-js prettyprint prettyprinted"><code><span class="pln">$ npm config </span><span class="kwd">get</span><span class="pln"> prefix</span></code>

Set the nvm default Dir DONT use Sudo

$ npm config set prefix /usr/local

List Global NPM Packages
$ npm list -g

Will show the global installation root regardless of current working directory.

npm root -g</code><span> </span></p> <h4 class="gh-header-title instapaper_title">Complete Remove NODE.JS</h4> <pre class="lang-bash prettyprint prettyprinted"><code><span class="pln">brew uninstall node</span><span class="pun">;</span><span class="pln"> </span><span class="com"># or `brew uninstall --force node` which removes all versions</span><span class="pln"> brew prune</span><span class="pun">;</span><span class="pln"> rm </span><span class="pun">-</span><span class="pln">f </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">npm </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">dtrace</span><span class="pun">/</span><span class="pln">node</span><span class="pun">.</span><span class="pln">d</span><span class="pun">;</span><span class="pln"> rm </span><span class="pun">-</span><span class="pln">rf </span><span class="pun">~/.</span><span class="pln">npm</span><span class="pun">;</span></code>

Reinstall  NODE.JS

brew install node;
which node # => /usr/local/bin/node
export NODE_PATH='/usr/local/lib/node_modules' # <--- add this ~/.bashrc

Get Node info regarding your node installs

brew info node

Temporary show hidden Files

defaults write com.apple.finder AppleShowAllFiles TRUE

killall Finder

and at the end set back to hide the files again

defaults write com.apple.finder AppleShowAllFiles FALSE

killall Finder

Installing global node modules

Installing Node MAC Linux Nodeschool 

Complete Unistall & reinstall Node  

Install Minify for Sublime Text 

 

Source : DAnHerbert GIST

Trello to WordPress Plugin

Try to debug the Trello 2 WordPress Plugin , a wonderful idea but sadly the Plugin is not updated or supported by the developer now for quite a time .

Why is the concept of using a Trello board to edit & rearrange content on your website sweet ? Trello offers a very intuitive drag and drop style card system with a json api . This way we can reorganise content by simply dragging it from one place to a other we can assign multiple user to the board as editor , no WordPress skills or admin Editor rights are needed.

What the Plugin supports : Trello List and  Cards

Shortcut Parameter : ID , type , link

 

How to find the Trello Board ID

To get temporary get the plugin work on the front end
If your Board have a link like

https://trello.com/b/mOu3B0ce/web-developer
just add “.json” at the end it will show a json file with a section for the id
the url will now look like
https://trello.com/b/mOu3B0ce/web-developer.json

What works : The authentication with your Trello account. REndering of your trello content with minimal styles – here is some work to do to make it realy sweet

What don’t works : The Selection of a Trello Card or Board ID in the admin section .

Trello API : Reffernce https://developers.trello.com/advanced-reference/board

Solution : Was to simple to believe , after a lot of code change and Trello APi Responds later . You need a Organization in your trello Board. as my Board was Private only the Plug don’t work in this mode and fail to update the Trello Ids in the admin screen .

Now its time to make something beautiful out of the simple links .

 

  • Saved Facebook Posts from Treallo
  • Recommended Twitter Follower from Trello
  •  Team Post Planing from Trello with WP Front end
  • Google Material Cards from trello
  • Dynamic Member User List Sortable from Trello
  • Idea Board
  • ect

 

Test Cards from Trello embedded with the shortlink

BOARDS

Thu, Jan 01. 12:00 AM

To Do

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

MARKETING-BIZZ

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

Doing

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

Done

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

DESCRIPTION TXT

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

RESOURCES

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

IDEAS PLUS

By Code Cowboy Thu, Jan 01. 12:00 AM

Thu, Jan 01. 12:00 AM

InstaApps

By Code Cowboy Thu, Jan 01. 12:00 AM

MLT Shotcust Video Stream to Facebook and Youtube

Just a shoot note about video streaming with a Video Editor and MLT Framework. Why a Video Editor for

Why a Video Editor for streaming ?

On the fly dynamic re-editing or adding content to the Video based on the interaction of the user with a simple user interface of a Video Editor.

The Editor  Shotcuts backend is based on MLT a highly aktive edeveloped Video Framework . Shotcut can be easy intergrated into  a CasparCG workflow. Supported stream format

  • Network stream playback (HTTP, HLS, RTMP, RTSP, MMS, UDP)

 

 

There is a command line for streaming to Youtube :

melt -verbose -profile square_ntsc_wide ~/Videos/tears_of_steel_1080p.mov -repeat 999 -filter crop center=1 -consumer avformat:rtmp://a.rtmp.youtube.com/live2/secret properties=x264-medium-main f=flv r=24 g=48 bf=0 refs=1 frequency=44100 real_time=1 vb=1000k ab=128k

Result: https://www.youtube.com/watch?v=nadu0EcA2dE

 

Ref: https://plus.google.com/+MltframeworkOrg/posts/iBu4DKNT6J4

 

Posted in

VLC Screen Capture and Streaming with ffmpeg to Facebook

Work path for Mac Screen recording with VLC  screen recording per command line to a Social Platform via FFmpeg. The task: I’m looking for is to capture the screen with VLC Command line and stream the result with FFmpeg as video RTSP live stream to Facebook youtube or any other Platform without the need of additional expensive or complicated software. Some Examples can be found for Linux but not so much for MAC, it should work for El Capitan. This is mostly a work log . Here I will document what worked for me and what problems occur. Later on allow those snippets to create a bash script to auto stream on an interval to facebook for example a Birdsnest, Weather camera, or any IPTV Camera . Even some simple  Video Effect Switcher like CAmTwist can be used to stream and manage video sources for the Facebook Lifestream.

The idea behind is that sometimes you need to stream some short piece of video where a full Stream software like Wirecast or OBS is an Overkill . One core reason Live stream is very CPU process intensive the less additional software you run the more you have to process and stream your Video.It makes streaming with the desktop so simple once the procedure is ready.

Video Screen Recording on mac

Full-Screen Recording as Mp4

vlc screen:// -I rc --screen-fps 25 ":sout=#transcode{vcodec=h264}:std{access=file,dst=metaoutput.mp4"}

With Cropped Mac Screen Video Capture

We use a minimum screen-top of 50 to hide the chromee browserr navigation and some mac offset
vlc screen:// -I rc --screen-fps 25 --screen-index 1 --screen-width 500 --screen-height 500 --screen-top 50 --screen-left 0  ":sout=#transcode{vcodec=h264}:std{access=file,dst=metaCropout3.mp4"}

This will add the Recording into the virtual playlist Que of our VLC CLI , to start capturing we need the command play  and quit to stop the stream .

VLC CLI Parameter

To limit the area being captured we add parameter to the screen
Video crop (right,left,top,bottom) Number of pixels to crop at the right of the video.

--screen-index 1 --screen-width 500 --screen-height 500 --screen-top 95 --screen-left 0
One example we will capture a screen at 25 fps – cropping 500 x 500 the top, left ZERO , a window at the top left of our screen where we can place what we whant to show without the Chrome & mac window boarders.
The output video is encoded into mp4 video as file “metaout.mp4” into the same dir you CD in the Terminal .

vlc screen:// -I rc --screen-fps 25 --screen-index 1 --screen-width 500 --screen-height 500 --screen-top 95 --screen-left 0 ":sout=#transcode{vcodec=h264}:std{access=file,dst=metaout.mp4"}

FFMpeg live Stream to Facebook Live with Terminal

Here are some snippets to live stream your previous screen recording to Facebook .

FFmpeg Stream to Facebook Live


ffmpeg -re -i metaout.mp4 -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 6000k -vb 400k -maxrate 1500k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -f flv "rtmp://rtmp-api.facebook.com:80/rtmp/XXXXXXXXXX?ds=1&s_l=1&a=XXXXXXXXXXXX"

Lets change the Input source we would like to stream the desktop instead for that we use the little Free Tool called Camtwist
Avfoundation show us all available input sources
OSX ffmpeg -f avfoundation -list_devices true -i ""
WIN ffmpeg -y -f vfwcap -i list

This example will produce framerate not supported
ffmpeg -f avfoundation -i "CamTwist" ffmpegout.mpg

Facebook Life Stream from Camtwist (experimental )
ffmpeg -f avfoundation -r 30 -i "CamTwist" -pix_fmt yuv420p -profile:v baseline -s 320x240 -bufsize 2048k -vb 400k -maxrate 800k -deinterlace -vcodec libx264 -x264opts "keyint=48:min-keyint=48:no-scenecut" -preset ultrafast -r 30 -f flv "rtmp://rtmp-api.facebook.com:80/rtmp/11111111111111111=1&a=2222222222222222"
-f avfoundation -r 30 -i “CamTwist”     Input source the CamTwist Virtual Camera must fit . 

-pix_fmt yuv420p            Pixel Format of the input source this will fall back if not suported

-profile:v baseline -s 320×240 -bufsize 2048k -vb 400k -maxrate 800k -deinterlace     We chose a Low Profile and smal size for testing 320×240 Set this in ther Camtwist settings 

-vcodec libx264      Video Codec 

-x264opts “keyint=48:min-keyint=48:no-scenecut”     Producer Keyframes every 2 second  g- ist not related for RTMP

 

Looping FFmpeg Stream for Facebook Live
for streams like the endless stream option we would like to use this case
ffmpeg -re -stream_loop -1 -i metaout.mp4 -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 6000k -vb 400k -maxrate 1500k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -f flv "rtmp://rtmp-api.facebook.com:80/rtmp/XXXXXXXX?ds=1&s_l=1&a=XXXXXXXXXXXX"

Optional Loop many Videos Files to Facebook like a Set of Timeline Videos

VLC Mixing Audio and Silent Video
Now we add a Audio source in this case a test.mp3 to our silent metaout.mp4 video , outputing the result to the GUI Player with macosx important is the -noaudio parameter it will abort if not present ,defining Audio codec acodec=mp3 with the audio specs we like.

vlc -vvv -I macosx metaout.mp4 --noaudio --input-slave=test.mp3 --audio-track=1 --sout="#transcode{vcodec=mp4v,vb=800,acodec=mp3,ab=128,channels=2,samplerate=44100}:duplicate{dst=display}"

Same just save the final new mixed File we use h264 codec

vlc -vvv -I macosx test2.mp4 --noaudio --input-slave=test.mp3 --audio-track=1 --sout="#transcode{vcodec=h264,vb=1024,acodec=mp3,ab=128,channels=2,samplerate=44100}:duplicate{dst=std{access=file,mux=mp4,dst="test1outsound.mp4"},dst=display}"

Useful VLC CLI commands:

Build Alias for VLC Command to bash

echo "alias vlc='/Applications/VLC.app/Contents/MacOS/VLC -I rc'" >> ~/.bash_profile

Restart Terminal after execution

Enable Logging

Log in same Folder the log file vlc-META.log

vlc --extraintf=logger --verbose=2 --logfile=vlc-META.log --logmode=text --file-logging
or
vlc -I http --extraintf logger --log-verbose=2 --verbose-objects=+all -vvv --fullscreen

Where is the log file ? Mac will name the file vlc-log.txt and place your logfile in USERS/YOURMAC/Library/logs/vlc-log.txt

VLC Stream Audio Input on Mac list the devices

Usage: qtsound://"Built-In Input" or qtsound://"iMic USB audio system"
vlc -vvv qtsound:// 

vlc -vvv qtsound://”AppleHDAEngineInput:8,0,1,0:1″

For windows


vlc dshow:// :dshow-vdev="None" :dshow-adev="Your Audio-Device"  
 Open a VLC telnet connection :

vlc -I telnet -vvv --telnet-password password --telnet-host 198.168.0.x:4212

Play a Youtube Video
vlc --preferred-resolution 720 https://www.youtube.com/watch?v=m2Oo4kBHBNU
Qualitys preferred-resolution :
-1 : default,best available
1080 :Full HD: 1080p
720 :HD: 720p
576 :SD 576 or 480 lines
360 :Low: 360 lines)
240 :Very Low: 240 lines

VLC Streaming How To Final to Facebook

We Learned how to Capture with VLC , we tested how to Stream with FFmpeg to Facebook . Now lets make the final step the super easy just one tool fast stream my desktop version .

VLC Streams a File to our Fanpage

vlc metaout.mp4 --sout '#transcode{vcodec=h264,vb=300,fps=25,scale=1,acodec=mp4a,ab=64,channels=2}:std{access=rtmp,mux=ffmpeg{mux=flv},dst=rtmp://rtmp-api.facebook.com:80/rtmp/XXXXXXXXXXXX=1&s_l=XXXXXXXXXXX}'

Now Streaming our Desctop like described above this example is full Desctop
vlc -I rc screen:// --sout '#transcode{vcodec=h264,vb=300,fps=25,scale=1,acodec=mp4a,ab=64,channels=2}:std{access=rtmp,mux=ffmpeg{mux=flv},dst=rtmp://rtmp-api.facebook.com:80/rtmp/XXXXXXXXXXXXXXX?ds=1&s_l=1&XXXXXXXXXXXXXXXXX}'

 

Still need Sound added to the VLC Recording here Some Experimental Snippet

vlc -vvv -I rc screen:// --input-slave qtsound://AppleHDAEngineInput:1B,0,1,0:1 --sout '#transcode{vcodec=h264,vb=1024,fps=25,scale=2,acodec=mp4a,ab=44,channels=1}:std{access=rtmp,mux=ffmpeg{mux=flv},dst=rtmp://rtmp-api.facebook.com:80/rtmp/XXXXXXXXXXXXX&s_l=1&a=XXXXXXXXXXXXXX}'

Facebook Stream FAQ

Can we have multiple live streams on one page ?  yes, its possible if you don’t terminate them you can even continue with the same key on the stream.

Can we interrupt a Livestream and continue later on ? Yes that’s possible as the last test show in the Video overview the Videos stay Live even if there is no more stream (probably a bug or concept for future functions)

Should we stream over Wifi or Lan ?  It’s all time better to stream over Lan as on wifi you will generate more packet errors in your stream

What is the lowest Frame rate we can stream to Facebook ?  FB recommend 30 Frames (for US NTSC ) 25 Frames is standard in Europe PAL Norm . For lower Frame Rates we need some more experiments. It reduce your bandwidth usage and left space for quality. Facebook Live Event log will complain if Framerate drops below 16 frames , but still stream

How to find coordinates of screen in Mac OS X and crop position to Capture ? Press CTR SHIFT 4 to pixel exact position and Screen capture size for the VLC crop settings. It’s the same shortcut you use for a single screen capture to disk. The Crosshair shows the pixel position and window size

How long is the delay to the Livestream ?

How long is the live stream Key Valid ? ? ?

Record Periscope Livestream with FFMpeg

ffmpeg -i HLS_URL out.mp4

Control the VLC from the Command Line.

After we executed the command line we can start and stop the recording from the CLI with play and quit . The command stop would not work as expected as the stream can’t be continued . To see the Playlist Elements you can use playlist there shoud be your cli command visible .

playlist  : to get the playlist position

start

help

vlc -l  Use --list or --list-verbose to list available modules.
vlc -p [module_name] --advanced  display help for each module

Mac Terminal Commands

Show which processes are listening to which ports Sockets
lsof -i | grep LISTEN

VLC Terminal Errors to clear out

the Lua interface gave us some errors when we start Screen capturing and when we quite the process but it don’t affect our recording , probably the CLI and HTTP interface don’t work together as they should , so we don’t see our CLI executed commands on the web interface . We can live with that for now.

[http] core interface error: socket bind error: Permission denied  

vlc is trying to use is always 8080, if you have something other running it will result in a error .Dosent matter what port you define for VLC

[http] lua interface error: Error loading script /Applications/VLC.app/Contents/MacOS/share/lua/intf/http.luac

intf/http.lua:336: Failed to create HTTP host

MODUL Error

Main Error Es_out_set_ Group Pcr Is Called Too Late  

Facebook Event Log Error

Some events logged  , so we need to add keyframes and a stable frame rate .

Too low video key frame rate 0.038965

Too low video frame rate 5.844763

VLC CLI Parameter 

-I macosx  Output Preview in the GUI Player
--http-password <your password here

-vvv  "Verbose verbose verbose". Verbose output

VLC CLI Parameter for FFMepg

--input-slave qtsound    add sound to the stream 
--input-slave timecode:// --timecode-fps 30/1001

vb  option  to set  transcoded video stream, in kbit/s

ab  option  to set  transcoded Audio stream, in kbit/s

scale   ratio from which the video should be rescaled while being transcoded ,to reduce stream Bandwith

keyint=<number of frames>

mux encapsulation method used to send the stream

hurry-up  allow the encoder to decrease the quality if processor can’t handle 

dst    location where the video streams should be sent

VBR Mode x264 Does a better job at keeping the media around the desired bitrate takes longer encoding time x264 –pass 1 –bitrate 1500 -o <output> <input>  # ABR Mode   x264 –pass 2 –bitrate 1500 -o <output> <input>  # VBR Mode This is called 2-pass mode, not VBR mode. ABR is a form of VBR.
VLC Streaming to Chromecast Only for Windows Version VLC 3.0

References and additional resources & Developer 

VLC CLI command wiki 
Joergens Blog Livecasting 

GoPro Live streaming Hero3 Hero4 with VLC

Wowza Ffmpeg  Examples

VLC Forum 

VLC RTSP Streaming

Streaming How To 

VLM How To

Advanced Streaming Parameter VLC FFmpeg

VLC GIT Important changes New CLI commands and more OSXMAc related

Additional Extras 

CefWithSyphon  Chrome Browser with Syphon Interface , capturing web content GIT

Screengif GIT
CTstreamOutput  XCode Projekt for Camtwist to stream directly with FFmpeg (not tested compiled)

VLC Streaming Windows related

As an Input source we can use on Windows vlc dshow://    what is equivalent Direct Show input

Detect all recording sources Cameras with ffmpeg

To discover all potential camera sources for our live stream we can list them in the Terminal with following commands

avfoundation lib is used for MAC
ffmpeg -f avfoundation -list_devices true -i ""
DirectX  the command directshow  equivalent for windows
ffmpeg -y -f dshow -i list

Additional Input Sources for VLC Capture & Stream

Version 3.0

Support DVB-T2  [Windows] [Austria]  !

Version 2.2

QTKit  Quicktime API  Audio & Video

Linear Systems (HD-)SDI cards input support  [LINUX]

Blackmagic DeckLink SDI cards input support [LINUX]

DVB-S scanning support [Unix]

DVB-C scanning [Unix]

VLC & Versions Info installed

VLC 2.1.2 (working Screen Capture)
VLC 2.2.4 Weatherwax (newest Public Build) Web Interface outdated broken – Rewriting new Flowplayer v.6
VLC 3.o.o (nighty testing Chromecast)
FFmpeg : ffmpeg version 3.1.5
Web Interface : http://localhost:8080/
Video Player MPEG Streamclip SQUARED  still the best video player and converter

Facebook Live Broadcasting Parameter

  • Video Resolution: max 720p (1280 x 720), PAL 25 frames, NTSC  30 frames per second
  • Key-Frame Interval of 1 every 2 seconds ,every 50   PAL , 60 Frames NTSC
  • Max bit rate 4000Kbps
  • Rate control: CBR (see above desc.)
  • 240 minute or 4 hour max on a default stream
  • Audio Sample Rate: 22KHz | 44.1 kHz
  • Audio Bitrate: 64-128 Kbps

Unzip all Files in Folder MAC OSX

To automatically Prozess a lot of Zip Files in a Folder this Terminal command is quite useful

Open Terminal

CD to the Directory you need to prozess

# Change Directory you need to prozess
cd /Users/meta/Downloads/myfolderzips

# extract all Zip on request to overwrite .txt conform aith [A]  all 
unzip \*.zip

# if we need to remove cleanup the extracted zips
rm -f *.zip

Find all ZIP in a Folder and Subfolder

find ./ -name ‘*zip’

Un Zip all files in subfolder of the Folder

find ./ -name \*.zip -exec unzip {} \

 

Same prozess can be done with bz2 or rar files

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.

[divider line_type=”Small Line” line_thickness=”1″ divider_color=”default”]

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
[nectar_gradient_text heading_tag=”h1″ color=”extra-color-gradient-1″ gradient_direction=”horizontal” text=”WP Sweep”]

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 host

The image below show the wp sweep admin screen after cleanup .

[nectar_image_with_hotspots image=”5933″ preview=”https://metaprime.at/blogapp/wp-content/uploads/2016/09/Screen-Shot-2016-09-29-at-12.53.49.jpg” color_1=”Accent-Color” hotspot_icon=”plus_sign” tooltip=”hover” tooltip_shadow=”none”][nectar_hotspot left=”96.31236442516268%” top=”37.2093023255814%” position=”top”][/nectar_hotspot][nectar_hotspot left=”11.496746203904555%” top=”41.08527131782946%” position=”top”][/nectar_hotspot][nectar_hotspot left=”13.882863340563992%” top=”13.178294573643413%” position=”top”][/nectar_hotspot][/nectar_image_with_hotspots]

MYSQL query to delete orphaned postmeta

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>

[image_with_animation image_url=”5938″ alignment=”center” animation=”Fade In” box_shadow=”small_depth” max_width=”100%”]

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/[FORMULA]/   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 [FORMULA]

All installed Packages via brew

brew list

All Homebrew Logs

[USER]/Library/Logs/Homebrew

How to turn on Debug mode for Brew ?

brew install --verbose --debug [Formula]

More Brew install with flags

brew install [FORMULA]--universal
brew install [FORMULA]--build-from-source

Unistall Brew Package

brew uninstall [FORMULA]

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]

 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