<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Muziboo Development Blog &#187; muziboo</title>
	<atom:link href="http://devblog.muziboo.com/category/muziboo/feed/" rel="self" type="application/rss+xml" />
	<link>http://devblog.muziboo.com</link>
	<description>Muziboo development stories. Mostly set in ruby land</description>
	<lastBuildDate>Fri, 01 Apr 2011 04:52:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Audio File Handling in Ruby</title>
		<link>http://devblog.muziboo.com/2008/06/17/audio-file-handling-in-ruby/</link>
		<comments>http://devblog.muziboo.com/2008/06/17/audio-file-handling-in-ruby/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 14:29:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[muziboo]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://prateekdayal.net/tech/?p=15</guid>
		<description><![CDATA[
			
				
			
		
Last few days I have been looking to handling different audio format uploads in Muziboo. We currently support only mp3 files but I see a lot of wma and m4a uploads being attempted. FFMPEG can convert these files easily to mp3 but the real issue is in validating uploads and then finding out when to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fdevblog.muziboo.com%2F2008%2F06%2F17%2Faudio-file-handling-in-ruby%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fdevblog.muziboo.com%2F2008%2F06%2F17%2Faudio-file-handling-in-ruby%2F&amp;source=muziboo&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Last few days I have been looking to handling different audio format uploads in <a href="http://muziboo.com" >Muziboo</a>. We currently support only mp3 files but I see a lot of wma and m4a uploads being attempted. <a href="http://ffmpeg.mplayerhq.hu/" onclick="javascript:pageTracker._trackPageview('/outbound/article/ffmpeg.mplayerhq.hu');">FFMPEG</a> can convert these files easily to mp3 but the real issue is in validating uploads and then finding out when to fire a conversion. I am currently using <a href="http://clarkware.com/cgi/blosxom/2007/02/24" onclick="javascript:pageTracker._trackPageview('/outbound/article/clarkware.com');">attachment_fu</a> plugin for managing uploads.</p>
<p><strong>Mime information using file command</strong></p>
<p>A way to get mime type is by running this command</p>
<pre><code>$ file -bi filename</code></pre>
<p>The problem with this approach is that it gave me different results on gentoo and debian. Ofcourse the  file executable version were different (4.16 and 4.23) but I still feel this approach is not very robust.</p>
<p><strong>Using ruby libraries to find out audio file information</strong></p>
<p>Another approach is to use a ruby library to check for file type. However the issue is that there is no single library that can check for different kinds of files. The only way I have been able to figure out is to try and open the files in different libraries (and catching exceptions). I found a list of popular ruby audio libraries <a href="http://raa.ruby-lang.org/cat.rhtml?category_major=Library;category_minor=Audio" onclick="javascript:pageTracker._trackPageview('/outbound/article/raa.ruby-lang.org');">here</a>.</p>
<p>In fact on searching some more, I found a similar approach being followed in <a href="http://github.com/kig/metadata/tree/master" onclick="javascript:pageTracker._trackPageview('/outbound/article/github.com');">metadata extractor</a> library too.</p>
]]></content:encoded>
			<wfw:commentRss>http://devblog.muziboo.com/2008/06/17/audio-file-handling-in-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

