<?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>AmirWatad.com &#187; Shell Scripts</title>
	<atom:link href="http://www.amirwatad.com/blog/archives/category/shell-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.amirwatad.com/blog</link>
	<description>Remember the name ;)</description>
	<lastBuildDate>Wed, 22 Sep 2010 22:04:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Playing With Youtube Videos in Linux</title>
		<link>http://www.amirwatad.com/blog/archives/2009/01/26/playing-with-youtube-videos-in-linux/</link>
		<comments>http://www.amirwatad.com/blog/archives/2009/01/26/playing-with-youtube-videos-in-linux/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 00:40:09 +0000</pubDate>
		<dc:creator>Amir Watad</dc:creator>
				<category><![CDATA[Shell Scripts]]></category>
		<category><![CDATA[Command Line Interface]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.amirwatad.com/blog/?p=207</guid>
		<description><![CDATA[In this short post I&#8217;ll introduce a csh script I wrote recently. I wrote it for a certain purpose and it&#8217;s definitely not &#8220;general purpose&#8221;. I&#8217;m posting it here so you/I can use it as a reference. The script uses these programs: 1. youtube-dl    (In ubuntu, you can get it by typing : sudo apt-get [...]<p>---------
Note:
Some RSS readers might display this post with incorrect format.
View original post at <a href="http://www.amirwatad.com/blog">AmirWatad.com </a><br/><br/><a href="http://www.amirwatad.com/blog/archives/2009/01/26/playing-with-youtube-videos-in-linux/">Playing With Youtube Videos in Linux</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In this short post I&#8217;ll introduce a csh script I wrote recently. I wrote it for a certain purpose and it&#8217;s definitely not &#8220;general purpose&#8221;. I&#8217;m posting it here so you/I can use it as a reference.</p>
<p>The script uses these programs:</p>
<p>1. youtube-dl    (In ubuntu, you can get it by typing : sudo apt-get install youtube-dl).</p>
<p>2. ffmpeg   (Again: sudo apt-get install ffmpeg)</p>
<p>3. avimerge (part of the transcode package: sudo apt-get install transcode)</p>
<p><span id="more-207"></span></p>
<p>The script will download videos from youtube, convert them into avi files, and finally merge them into one avi video.</p>
<p>To use the script, you need call it from inside a directory with only one file in it: file name needs to be &#8220;links&#8221; and it should include the URLs of the videos you want to download from youtube, one URL per line, in the order you want them to appear in the merged video. The output will be a file &#8220;all.avi&#8221; in the same directory. Of course, you&#8217;re free to modify this script to let be more flexible etc&#8230;</p>
<p>Here is the script:</p>
<pre>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/tcsh</span><br />
<br />
<span style="color: #666666; font-style: italic;"># download movies</span><br />
<span style="color: #000000; font-weight: bold;">set</span> x = <span style="color: #000000;">1</span><br />
foreach line <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> links<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; youtube-dl <span style="color: #660033;">-o</span> vid<span style="color: #007800;">$x</span>.flv <span style="color: #ff0000;">&quot;<span style="color: #007800;">$line</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">@</span> x = <span style="color: #007800;">$x</span> + <span style="color: #000000;">1</span><br />
end<br />
<br />
<span style="color: #666666; font-style: italic;"># convert from flv to avi</span><br />
foreach <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #000000; font-weight: bold;">*</span>.flv <span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">ffmpeg</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$file</span>&quot;</span> <span style="color: #660033;">-ab</span> <span style="color: #000000;">56</span> <span style="color: #660033;">-ar</span> <span style="color: #000000;">22050</span> <span style="color: #660033;">-b</span> <span style="color: #000000;">500</span> <span style="color: #660033;">-s</span> 320x240 <span style="color: #660033;">-vcodec</span> copy <span style="color: #660033;">-acodec</span> copy <span style="color: #ff0000;">&quot;<span style="color: #007800;">$file</span>&quot;</span>.avi<br />
end<br />
<br />
<span style="color: #666666; font-style: italic;"># merge all avi files into one file</span><br />
avimerge <span style="color: #660033;">-i</span> <span style="color: #000000; font-weight: bold;">*</span>.avi <span style="color: #660033;">-o</span> all.avi<br />
<br />
<span style="color: #666666; font-style: italic;"># remove intermediate files</span><br />
<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">rm</span> vid<span style="color: #000000; font-weight: bold;">*</span>.avi vid<span style="color: #000000; font-weight: bold;">*</span>.flv</div></td></tr></tbody></table></div>
</pre>
<p>Please ignore the &#8220;BASH&#8221; title of the script, it&#8217;s because GeSHi doesn&#8217;t support csh, and as far as I know bash is the closest thing to csh</p>
<p>Hope it helps somebody <img src='http://www.amirwatad.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' title="Playing With Youtube Videos in Linux" /> <br class="spacer_" /></p>
<p>---------
Note:
Some RSS readers might display this post with incorrect format.
View original post at <a href="http://www.amirwatad.com/blog">AmirWatad.com </a><br/><br/><a href="http://www.amirwatad.com/blog/archives/2009/01/26/playing-with-youtube-videos-in-linux/">Playing With Youtube Videos in Linux</a></p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=Playing+With+Youtube+Videos+in+Linux+http://bit.ly/VbMLM" title="Post to Twitter"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big3.png" alt="Post to Twitter" style="margin:0;" title="Playing With Youtube Videos in Linux" /></a> <a target="_blank" class="tt" href="http://delicious.com/post?url=http://www.amirwatad.com/blog/archives/2009/01/26/playing-with-youtube-videos-in-linux/&amp;title=Playing+With+Youtube+Videos+in+Linux" title="Post to Delicious"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious-big3.png" alt="Post to Delicious" style="margin:0 0 0 2px;" title="Playing With Youtube Videos in Linux" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://www.amirwatad.com/blog/archives/2009/01/26/playing-with-youtube-videos-in-linux/&amp;title=Playing+With+Youtube+Videos+in+Linux" title="Post to Digg"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-digg-big3.png" alt="Post to Digg" style="margin:0 0 0 2px;" title="Playing With Youtube Videos in Linux" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://www.amirwatad.com/blog/archives/2009/01/26/playing-with-youtube-videos-in-linux/&amp;t=Playing+With+Youtube+Videos+in+Linux" title="Post to Facebook"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big3.png" alt="Post to Facebook" style="margin:0 0 0 2px;" title="Playing With Youtube Videos in Linux" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://www.amirwatad.com/blog/archives/2009/01/26/playing-with-youtube-videos-in-linux/&amp;title=Playing+With+Youtube+Videos+in+Linux" title="Post to Reddit"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit-big3.png" alt="Post to Reddit" style="margin:0 0 0 2px;" title="Playing With Youtube Videos in Linux" /></a> <a target="_blank" class="tt" href="http://stumbleupon.com/submit?url=http://www.amirwatad.com/blog/archives/2009/01/26/playing-with-youtube-videos-in-linux/&amp;title=Playing+With+Youtube+Videos+in+Linux" title="Post to StumbleUpon"><img class="nothumb" src="http://www.amirwatad.com/blog/wp-content/plugins/tweet-this/icons/tt-su-big3.png" alt="Post to StumbleUpon" style="margin:0 0 0 2px;" title="Playing With Youtube Videos in Linux" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.amirwatad.com/blog/archives/2009/01/26/playing-with-youtube-videos-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 1.611 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-09 23:47:11 -->

