  
<div id="snippet_341" class="snippet">
  <h2><a href="/snippets/341-How-to-Install-Readline-5-2-on-OSX-Leopard" title="How to Install Readline 5.2 on OSX Leopard - Shell Script (Bash) - readline, osx, leopard">How to Install Readline 5.2 on OSX Leopard</a></h2>
  <div class="details">
    <a style="background-color: #FFFF94;" href="http://snippets.aktagon.com/languages/131-Shell-Script-Bash-">
      Shell Script (Bash)</a> posted 9 months ago by christian
          
  </div>

  <div class="body">
    <h2>Install Readline 5.2</h2>
<p><pre class="active4d"><span class="line-numbers">   1 </span> curl -O ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz
<span class="line-numbers">   2 </span> tar xzf readline-5.2.tar.gz
<span class="line-numbers">   3 </span> cd readline-5.2
<span class="line-numbers">   4 </span> ./configure <span class="Operator">&amp;&amp;</span> make <span class="Operator">&amp;&amp;</span> sudo make install
</pre></p>
<h2>Troubleshooting</h2>
<p>Error:</p>
<p><pre class="active4d"><span class="line-numbers">   1 </span> Thread model: posix
<span class="line-numbers">   2 </span> gcc version 4.0.1 (Apple Inc. build 5465)
<span class="line-numbers">   3 </span> i686-apple-darwin9-gcc-4.0.1: -compatibility_version only allowed with -dynamiclib
<span class="line-numbers">   4 </span> make[1]: *** [libreadline.5.2.dylib] Error 1
<span class="line-numbers">   5 </span> make: [shared] Error 2 (ignored)
</pre></p>
<p>Solution:</p>
<p><pre class="active4d"><span class="line-numbers">   1 </span> make static
<span class="line-numbers">   2 </span> sudo make install-static
</pre></p>
  </div>

  <div style="font-size: 0.8em;margin:0.5em;">
    
      Tagged <a href="/tags/133-readline">readline</a>, <a href="/tags/198-osx">osx</a>, <a href="/tags/337-leopard">leopard</a>
    
    
  </div>
</div>



  
<div id="snippet_171" class="snippet">
  <h2><a href="/snippets/171-Installing-ImageMagick-mini-magick-and-rmagick-on-Mac-OS-X-Leopard" title="Installing ImageMagick, mini-magick and rmagick on Mac OS X Leopard - Ruby - imagemagick, attachment_fu, rails, ruby, mac, osx, leopard, mini-magick, rmagick">Installing ImageMagick, mini-magick and rmagick on Mac OS X Leopard</a></h2>
  <div class="details">
    <a style="background-color: #FFFF94;" href="http://snippets.aktagon.com/languages/124-Ruby">
      Ruby</a> posted about 1 year ago by christian
          
  </div>

  <div class="body">
    <p>I had no success installing ImageMagick and mini-magick with the instructions I found on <a href="http://www.aldenta.com/2007/11/26/installing-imagemagickrmagick-on-leopard/">this page</a> but after some googling I found  <a href="http://nullstyle.com/2007/10/27/how-to-build-imagemagick-and-install-rmagick-with-macports-on-mac-os-x-leopard/">this blog post</a>, which had the magic commands that worked for me:
<pre class="active4d"><span class="line-numbers">   1 </span> sudo port install tiff <span class="Operator">-</span>macosx  <span class="LineComment"><span class="LineComment">#</span>disables the linkage with Apple's open gl</span>
<span class="line-numbers">   2 </span> sudo port install <span class="Variable">ImageMagick</span>
<span class="line-numbers">   3 </span> 
<span class="line-numbers">   4 </span> sudo gem install rmagick
<span class="line-numbers">   5 </span> sudo gem install mini_magick
</pre></p>


	<p>To test mini-magick, open an irb console and paste in the following code:</p>


	<p><pre class="active4d"><span class="line-numbers">   1 </span> <span class="Keyword">require</span> <span class="String"><span class="String">'</span>rubygems<span class="String">'</span></span>
<span class="line-numbers">   2 </span> <span class="Keyword">require</span> <span class="String"><span class="String">'</span>mini_magick<span class="String">'</span></span>
<span class="line-numbers">   3 </span> 
<span class="line-numbers">   4 </span> path <span class="Operator">=</span> <span class="String"><span class="String">&quot;</span>public/images/0000/0003/logo.jpg<span class="String">&quot;</span></span>
<span class="line-numbers">   5 </span> image <span class="Operator">=</span> <span class="LibraryClassType">MiniMagick</span>::<span class="FunctionName">Image</span>.<span class="FunctionName">new</span>(path)
<span class="line-numbers">   6 </span> 
<span class="line-numbers">   7 </span> <span class="LineComment"><span class="LineComment">#</span>print width and height</span>
<span class="line-numbers">   8 </span> puts image[<span class="UserDefinedConstant"><span class="UserDefinedConstant">:</span>width</span>]
<span class="line-numbers">   9 </span> puts image[<span class="UserDefinedConstant"><span class="UserDefinedConstant">:</span>height</span>]
</pre></p>
  </div>

  <div style="font-size: 0.8em;margin:0.5em;">
    
      Tagged <a href="/tags/113-imagemagick">imagemagick</a>, <a href="/tags/428-attachment-fu">attachment_fu</a>, <a href="/tags/9-rails">rails</a>, <a href="/tags/8-ruby">ruby</a>, <a href="/tags/386-mac">mac</a>, <a href="/tags/198-osx">osx</a>, <a href="/tags/337-leopard">leopard</a>, <a href="/tags/429-mini-magick">mini-magick</a>, <a href="/tags/430-rmagick">rmagick</a>
    
    
  </div>
</div>



  
<div id="snippet_132" class="snippet">
  <h2><a href="/snippets/132-How-to-install-ffmpeg-mencoder-and-flvtool2-on-Mac-OSX-Leopard-convert-an-AVI-to-FLV-and-view-the-FLV-video-with-FlowPlayer" title="How to install ffmpeg, mencoder and flvtool2 on Mac OSX Leopard, convert an AVI to FLV, and view the FLV video with FlowPlayer - Shell Script (Bash) - ffmpeg, osx, leopard, flvtool2, flv, mencoder, h.264">How to install ffmpeg, mencoder and flvtool2 on Mac OSX Leopard, convert an AVI to FLV, and view the FLV video with FlowPlayer</a></h2>
  <div class="details">
    <a style="background-color: #FFFF94;" href="http://snippets.aktagon.com/languages/131-Shell-Script-Bash-">
      Shell Script (Bash)</a> posted over 2 years ago by christian
          
  </div>

  <div class="body">
    <p>This is a short tutorial on how to quickly get up to speed with  FLV  movie creation (transcoding) and viewing (Flash player).</p>


	<p>I tried to install ffmpeg using ports and fink, but had problems. The instructions I found <a href="http://www.macosxhints.com/article.php?story=20061220082125312">here</a> work though.</p>


	<p>The following is my adaptation of the instruction, where I show you how to install both ffmpeg and flvtool2.</p>


	<p>First, download ffmpegx, which contains ffmpeg from <a href="http://ffmpegx.com/download.html">http://ffmpegx.com/download.html</a></p>


	<p>Then, mount the .dmg file, navigate to the mounted disk, and control-click on the ffmpegX application (ffmpegX.app), choose Show Package Contents from the pop-up menu, and copy the ffmpeg binary to, for example, /tmp.</p>


	<p>Now execute the following commands in a terminal shell:
<pre class="active4d"><span class="line-numbers">   1 </span> <span class="LineComment"><span class="LineComment">#</span> Move ffmpeg to /usr/local/bin:</span>
<span class="line-numbers">   2 </span> sudo mv /tmp/ffmpeg /usr/local/bin/
<span class="line-numbers">   3 </span> 
<span class="line-numbers">   4 </span> <span class="LineComment"><span class="LineComment">#</span> Change owner and make executable</span>
<span class="line-numbers">   5 </span> sudo chown root:wheel /usr/local/bin/ffmpeg
<span class="line-numbers">   6 </span> sudo chmod 755 /usr/local/bin/ffmpeg
</pre></p>


	<p>You&#8217;re now ready to use ffmpeg; the following command lists all the supported input and output formats:</p>


	<p><pre class="active4d"><span class="line-numbers">   1 </span> ffmpeg -formats
</pre></p>


	<p>Use the following command to transcode an  AVI  to  FLV  (Flash video) format:
<pre class="active4d"><span class="line-numbers">   1 </span> fmpeg -i mymovie.avi -s 320x240 -ar 44100 -r 12 mymovie.flv
<span class="line-numbers">   2 </span> cat mymovie.flv <span class="Operator">|</span> flvtool2 -U stdin mymovie.flv
</pre></p>


	<p>To add metadata to the  FLV  file&mdash;such as video length, which is required for the Flash player progress bar&mdash;you need to install <a href="http://rubyforge.org/projects/flvtool2/">flvtool2</a>.</p>


	<p>This is done with the following command (note this requires Ruby and RubyGems, which are not part of all  OSX  Leopard installations):
<pre class="active4d"><span class="line-numbers">   1 </span> sudo gem install flvtool2
</pre></p>


	<p>Now add the metadata to the  FLV  file:
<pre class="active4d"><span class="line-numbers">   1 </span> flvtool2 -UP mymovie.flv
</pre></p>


	<p>To test the  FLV  movie you just created, download and extract <a href="http://flowplayer.org">FlowPlayer</a>  to your folder of choice. Now create a page that loads your  FLV  movie; note that you need to update the paths:
<pre class="active4d"><span class="line-numbers">   1 </span> <span class="Operator">&lt;</span>html<span class="Operator">&gt;</span>
<span class="line-numbers">   2 </span> 	<span class="Operator">&lt;</span>head<span class="Operator">&gt;</span>
<span class="line-numbers">   3 </span> 		<span class="Operator">&lt;</span>script type=<span class="String"><span class="String">&quot;</span>text/javascript<span class="String">&quot;</span></span> src=<span class="String"><span class="String">&quot;</span>../flowplayer/html/swfobject.js<span class="String">&quot;</span></span><span class="Operator">&gt;</span><span class="Operator">&lt;</span>/script<span class="Operator">&gt;</span>
<span class="line-numbers">   4 </span> 	<span class="Operator">&lt;</span>/head<span class="Operator">&gt;</span>
<span class="line-numbers">   5 </span> <span class="Operator">&lt;</span>body<span class="Operator">&gt;</span>
<span class="line-numbers">   6 </span> 	<span class="Operator">&lt;</span>div id=<span class="String"><span class="String">&quot;</span>flowplayerholder<span class="String">&quot;</span></span><span class="Operator">&gt;</span>
<span class="line-numbers">   7 </span> 		This will be replaced by the player. 
<span class="line-numbers">   8 </span> 	<span class="Operator">&lt;</span>/div<span class="Operator">&gt;</span>
<span class="line-numbers">   9 </span> 	
<span class="line-numbers">  10 </span> <span class="Operator">&lt;</span>script type=<span class="String"><span class="String">&quot;</span>text/javascript<span class="String">&quot;</span></span><span class="Operator">&gt;</span>
<span class="line-numbers">  11 </span> // <span class="Operator">&lt;</span><span class="Operator">!</span>[CDATA[
<span class="line-numbers">  12 </span> var fo = new SWFObject(<span class="String"><span class="String">&quot;</span>../flowplayer/FlowPlayerDark.swf<span class="String">&quot;</span></span>, <span class="String"><span class="String">&quot;</span>FlowPlayer<span class="String">&quot;</span></span>, <span class="String"><span class="String">&quot;</span>468<span class="String">&quot;</span></span>, <span class="String"><span class="String">&quot;</span>350<span class="String">&quot;</span></span>, <span class="String"><span class="String">&quot;</span>7<span class="String">&quot;</span></span>, <span class="String"><span class="String">&quot;</span>#000000<span class="String">&quot;</span></span>, true)<span class="Operator">;</span>
<span class="line-numbers">  13 </span> 	// need this next line <span class="Keyword">for</span> local testing, it<span class="String"><span class="String">'</span>s optional if your swf is on the same domain as your html page</span>
<span class="line-numbers">  14 </span> <span class="String">	fo.addParam(&quot;allowScriptAccess&quot;, &quot;always&quot;);</span>
<span class="line-numbers">  15 </span> <span class="String">	fo.addVariable(&quot;config&quot;, &quot;{ countryCode: <span class="String">'</span></span><span class="Keyword">fi</span><span class="String"><span class="String">'</span>, playList: [ {overlayId: <span class="String">'</span></span>play<span class="String"><span class="String">'</span> }, { url: <span class="String">'</span></span>/mockup/mymovie.flv<span class="String"><span class="String">'</span> } ], initialScale: <span class="String">'</span></span>scale<span class="String"><span class="String">'</span>,  fullScreenScriptURL: <span class="String">'</span></span>fullscreen.js<span class="String"><span class="String">'</span> }&quot;);</span>
<span class="line-numbers">  16 </span> <span class="String">	fo.write(&quot;flowplayerholder&quot;);</span>
<span class="line-numbers">  17 </span> <span class="String">// ]]&gt;</span>
<span class="line-numbers">  18 </span> <span class="String">&lt;/script&gt;</span>
<span class="line-numbers">  19 </span> <span class="String">&lt;/body&gt;</span>
<span class="line-numbers">  20 </span> <span class="String">&lt;/html&gt;</span>
</pre></p>


	<p>I&#8217;ve <a href="http://www.macosxhints.com/article.php?story=20060923203722112&#38;query=dec">been told</a> that <a href="http://www2.mplayerhq.hu/MPlayer/releases/">mencoder</a> produces higher quality  FLV  videos, so lets compare the mencoder output to ffmpeg by first downloading and extracting mencoder to /tmp.</p>


	<p>Now move mencoder to /usr/local/bin:</p>


	<p><pre class="active4d"><span class="line-numbers">   1 </span> sudo mv /tmp/mencoder /usr/local/bin/
<span class="line-numbers">   2 </span> 
<span class="line-numbers">   3 </span> sudo chown root:wheel /usr/local/bin/mencoder
<span class="line-numbers">   4 </span> sudo chmod 755 /usr/local/bin/mencoder
</pre></p>


	<p>Next transcode the video to  FLV  format using mencoder:
<pre class="active4d"><span class="line-numbers">   1 </span> mencoder mymovie.avi -ofps 12 -o mymovie.flv -of lavf -lavfopts \
<span class="line-numbers">   2 </span> i_certify_that_my_video_stream_does_not_use_b_frames -oac lavc -lavcopts \
<span class="line-numbers">   3 </span> acodec=mp3:abitrate=32 -srate 22050  -ovc lavc -lavcopts vcodec=flv:\
<span class="line-numbers">   4 </span> vbitrate=100:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:\
<span class="line-numbers">   5 </span> vmax_b_frames=0:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2 \
<span class="line-numbers">   6 </span> -vop scale=360:240
</pre></p>


	<p>View the video in the Flash player; you should notice the difference in quality&#8230;</p>


	<p>For even higher quality encode the videos using the H.264 format, which FlowPlayer also supports; instructions can be found <a href="http://www.brad-x.com/2007/05/19/yet-another-linuxnix-video-h264-howto/">here</a>.</p>
  </div>

  <div style="font-size: 0.8em;margin:0.5em;">
    
      Tagged <a href="/tags/24-ffmpeg">ffmpeg</a>, <a href="/tags/198-osx">osx</a>, <a href="/tags/337-leopard">leopard</a>, <a href="/tags/28-flvtool2">flvtool2</a>, <a href="/tags/21-flv">flv</a>, <a href="/tags/338-mencoder">mencoder</a>, <a href="/tags/339-h-264">h.264</a>
    
    
  </div>
</div>






