<?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>Behind the Scenes &#187; Mencoder</title>
	<atom:link href="http://backstar.com/blog/tag/mencoder/feed/" rel="self" type="application/rss+xml" />
	<link>http://backstar.com/blog</link>
	<description>of cutting edge art, media + technology</description>
	<lastBuildDate>Wed, 19 May 2010 18:49:08 +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>Append Videos With Mencoder</title>
		<link>http://backstar.com/blog/2009/11/10/append-videos-with-mencoder/</link>
		<comments>http://backstar.com/blog/2009/11/10/append-videos-with-mencoder/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 20:24:25 +0000</pubDate>
		<dc:creator>Ben Baker-Smith</dc:creator>
				<category><![CDATA[Media]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Encoding]]></category>
		<category><![CDATA[Mencoder]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://backstar.com/blog/?p=538</guid>
		<description><![CDATA[Mencoder, the free audio / video transcoding software packaged with MPlayer, offers a free command line (CLI) method for combining many video clips into one.
Why would you choose this over the multitude of free GUI transcoding programs out there?

Mencoder is super-fast
Allows the process to be scripted
Wide range of codecs
Cross-platform compatible

Once you get the feel for [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mplayerhq.hu">Mencoder</a>, the free audio / video transcoding software packaged with MPlayer, offers a free command line (CLI) method for combining many video clips into one.<span id="more-538"></span></p>
<p>Why would you choose this over the multitude of free GUI transcoding programs out there?</p>
<ul>
<li>Mencoder is super-fast</li>
<li>Allows the process to be scripted</li>
<li>Wide range of codecs</li>
<li>Cross-platform compatible</li>
</ul>
<p>Once you get the feel for it, you can append videos much quicker with Mencoder than a more &#8220;user friendly&#8221; GUI program.  And, it works on Linux, Macintosh, and Windows machines, so you don&#8217;t have to learn 3 different programs if you work on multiple operating systems.</p>
<p>Here&#8217;s the basic format of a Mencoder append command:</p>
<pre>
mencoder -oac copy -ovc copy -o 'combined_clip.avi'
'clip1.avi' 'clip2.avi'
</pre>
<p>Simple as that.  The breakdown is as follows:</p>
<ul>
<li><strong>-oac</strong><br />
Tell Mencoder what audio codec to use.  For a complete list of options, check out the <a href="http://www.mplayerhq.hu/design7/info.html#docs">Mencoder documentation</a>.  In this case we have simply used &#8220;copy&#8221;, which will keep the current audio codec the same without transcoding (this option should only be used if the audio codecs are the same for all the clips).</li>
<li><strong>-ovc</strong><br />
Tell Mencoder what video codec to use.  Otherwise, same as above.</li>
<li><strong>-o</strong><br />
Define the paths to input and output files.  First list the output filename, then all the clips in the order which they will be appended.</li>
</ul>
<p>Knowing this, it is easy enough to script the process.  Say I have a whole directory of video files that I want to combine (ex: VID001.AVI, VID002.AVI, VID003.AVI, etc.).  I could use the following ruby script to string them all together in their numbered order:</p>
<pre>
vlist = String.new()
vpath = "/path/to/my/video/directory/"
vdir = Dir.new(vpath)
vdir.each do |v|
  if v.include?(".AVI") == true
    vlist << "\'#{vpath}#{v}\' "
  end
end

cmd = "mencoder -oac copy -ovc copy -o \'combined_clip.avi\'
#{vlist}"
system cmd
</pre>
<p>Save the script as VAppend.rb and run it like so:</p>
<pre>
ruby VAppend.rb
</pre>
<p>(you must be in the same directory as the script in order to run it with the above command)</p>
<p><strong>Final Notes</strong><br />
The command in the first code box is all one line, and the line in the second code box starting with "cmd =" is also all one line that continues onto a second for formatting purposes (in other words, #{vlist}" belongs at the end of the previous line).</p>
]]></content:encoded>
			<wfw:commentRss>http://backstar.com/blog/2009/11/10/append-videos-with-mencoder/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

