<?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>SavvyAdmin.com &#187; batch</title>
	<atom:link href="http://savvyadmin.com/tag/batch/feed/" rel="self" type="application/rss+xml" />
	<link>http://savvyadmin.com</link>
	<description>For savvy admins everywhere...</description>
	<lastBuildDate>Fri, 21 Jan 2011 17:53:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Batch MP3 Encoding with Linux and LAME</title>
		<link>http://savvyadmin.com/batch-mp3-encoding-with-linux-and-lame/</link>
		<comments>http://savvyadmin.com/batch-mp3-encoding-with-linux-and-lame/#comments</comments>
		<pubDate>Sun, 02 Dec 2007 20:32:14 +0000</pubDate>
		<dc:creator>gmendoza</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[LAME]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MP3]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.savvyadmin.com/2007/12/02/batch-mp3-encoding-with-linux-and-lame/</guid>
		<description><![CDATA[If you have a number of audio files that you would like to convert to mp3, but don&#8217;t want to hassle with graphical applications, there is a simple way to accomplish the task using Linux, LAME and a little shell scripting. By performing a basic &#8220;for loop&#8221; to invoke LAME, you can easily convert any [...]
Related posts:<ol>
<li><a href='http://savvyadmin.com/add-stereo-audio-tracks-to-mkv-files/' rel='bookmark' title='Add Stereo Audio Tracks to MKV Files'>Add Stereo Audio Tracks to MKV Files</a></li>
<li><a href='http://savvyadmin.com/mp3-tag-editing-in-linux/' rel='bookmark' title='MP3 Tag Editing in Linux'>MP3 Tag Editing in Linux</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>If you have a number of audio files that you would like to convert to mp3, but don&#8217;t want to hassle with graphical applications, there is a simple way to accomplish the task using Linux, LAME and a little shell scripting.  By performing a basic &#8220;for loop&#8221; to invoke LAME, you can easily convert any group of audio files using one line of shell code.</p>
<p>Here is an example of a &#8220;for loop&#8221; that runs the command &#8220;lame&#8221; against a set of files in your current working directory with the .wav file extension.</p>
<blockquote><pre>$ for f in *.wav ; do lame $f ; done</pre>
</blockquote>
<p>If your audio file names have spaces in them, then you will need to use quotation marks around &#8220;$f&#8221; variable.</p>
<blockquote><pre>$ for f in *.wav ; do lame "$f" ; done</pre>
</blockquote>
<p>I typically create my original audio files <em>without</em> the file name extension of <em>.wav</em> or <em>.au</em>.   This is because when you run lame against a file name, and do not omit the extension in the output option, the resulting file will have two extensions in the file name.  e.g. <em>filename.wav.mp3</em>.  Yes, I can use <em>sed</em> or <em>basename</em> in the for loop to prevent this, but to keep it simple, I just choose to not use the file extension to begin with.</p>
<p>If you are working with a group of files that have all been named using the convention of &#8220;Artist &#8211; Album &#8211; ## &#8211; Track Title&#8221;, (notice the spaces in the name), the following will work.</p>
<blockquote><pre>$ for f in Artist\ -\ Album* ; do lame "$f" ; done</pre>
</blockquote>
<p>Once the job is finished, you will be left with a directory full of your original audio files, and your newly created mp3&#8242;s.</p>
<p><strong>Extra Credit</strong></p>
<p>Okay, since we&#8217;re on the topic of shell scripting.  If you want to delete  all the original audio files (the ones without any file name extensions), and without first moving the new mp3&#8242;s to a different directory, one overly complicated example would be the following.</p>
<blockquote><pre>for f in *.mp3 ; do AUFILE=`basename "$f" .mp3` ; rm "$AUFILE"; done</pre>
</blockquote>
<p>This would have been easier if the original files could have been identified with .wav extensions, (rm *.wav), but since they had no file extensions to begin with, a wild card alone would not work.  Now folks, this is <em>just</em> an example, and there&#8217;s a million other ways you can go about this.  But in any case, I hope it helps you start exploring on your own!</p>
<p>Related posts:<ol>
<li><a href='http://savvyadmin.com/add-stereo-audio-tracks-to-mkv-files/' rel='bookmark' title='Add Stereo Audio Tracks to MKV Files'>Add Stereo Audio Tracks to MKV Files</a></li>
<li><a href='http://savvyadmin.com/mp3-tag-editing-in-linux/' rel='bookmark' title='MP3 Tag Editing in Linux'>MP3 Tag Editing in Linux</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://savvyadmin.com/batch-mp3-encoding-with-linux-and-lame/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>

