<?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>Bluehorn's Blog &#187; mlt</title>
	<atom:link href="http://www.landschoff.net/blog/tag/mlt/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.landschoff.net/blog</link>
	<description>Ramblings of Torsten Landschoff</description>
	<lastBuildDate>Sun, 07 Nov 2010 18:24:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Postprocessing conference videos</title>
		<link>http://www.landschoff.net/blog/2010/07/postprocessing-conference-videos/</link>
		<comments>http://www.landschoff.net/blog/2010/07/postprocessing-conference-videos/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 22:03:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[mlt]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.landschoff.net/blog/?p=167</guid>
		<description><![CDATA[I was planning to attend DebConf New York this year, but for a number of reasons I decided not to go. Fortunately, Ferdinand Thommes organized a MiniDebConf in Berlin at LinuxTag and I managed to attend. Thanks, Ferdinand! There were a number of interesting Talks. I especially liked the talk of our DPL, and those [...]]]></description>
			<content:encoded><![CDATA[<p>I was planning to attend <a href="http://debconf10.debconf.org/">DebConf New York</a> this year, but for a number of reasons I decided not to go. Fortunately, Ferdinand Thommes organized a <a href="http://www.minidebconf.de/2010/berlin/">MiniDebConf</a> in Berlin at <a href="http://www.linuxtag.org/">LinuxTag</a> and I managed to attend. Thanks, Ferdinand!</p>
<p>There were a number of interesting <a href="http://wiki.debconf.org/wiki/Miniconf-LT-Berlin/2010#Schedule">Talks</a>. I especially liked the talk of our DPL, and those about piuparts and git-buildpackage. In contrast to the other LinuxTag talks, we had a livestream of our talks and recorded (most) of them. The kudos for setting this up goes to Alexander Wirt, who spent quite a few hours to get it up and running.</p>
<p>I have to apologize for being late in bringing my Notebook, which was intended to do the theora encoding of the livestream. This was a misunderstanding on my part, I should have known that this is not going to be setup in the night before show time&#8230; So to compensate the extra hours he had to put in for me, I offered to do the post processing of the videos.</p>
<h2>Basic approach for post processing</h2>
<p>The main goal of post processing the videos was (of course) to compress them to a usable size from the original 143 GB. I also wanted to have a title on each video, and show the sponsors at the end of the video.</p>
<p>My basic idea to implement that consisted of the following steps:</p>
<ol>
<li>Create a title animation template.</li>
<li>Generate title animations from template for all talks.</li>
<li>Use a video editor to create a playlist of the parts title &#8211; talk &#8211; epilogue.</li>
<li>Run the video editor in batch mode to generate the combined video.</li>
<li>Encode the resulting video as ogg theora.</li>
</ol>
<p>As always with technology, it turned out that the original plan needed a few modifications.</p>
<h2>Title animations</h2>
<div style="float:right; border:1px dashed; padding:3px;"><video width="360 "height="288" src="http://www.landschoff.net/blog/uploads/2010/07/mdc2010_title_anim1.ogv" controls="controls"></video></div>
<p>Originally I wanted to use <a href="http://www.blender.org/">Blender</a> for the title animation, but I knew it is quite a complicated bit of software. So I looked for something simpler, and stumbled across an <a href="https://www.lwn.net/Articles/377939/">article</a> that pointed me towards <a href="http://www.synfig.org/">Synfig Studio</a> for 2D animation. This is also in Debian, so I gave it a try.</p>
<p>I was delighted that Synfig Studio has a command line renderer which is just called <tt>synfig</tt> and that the file format is XML, which would make it simple to batch-create the title animations. My title template can be found in <a href="http://landschoff.net/git/?p=mdc-video.git;a=summary">this git repository</a>.</p>
<h3>Batch creation of title animations</h3>
<p>I used a combination of <tt>make</tt> and a simple <a href="http://landschoff.net/git/?p=mdc-video.git;a=blob;f=doit.py;h=2601eac32d653056e6f516ce148bb8a7bda70dd5;hb=18026583d915c166b19fd26535cb49019d1158af">python script</a> to replace the author name and the title of the talk into the synfig XML file. The data for all talks is another XML file <tt>talks.xml</tt>. Basically, I used a simple <a href="http://www.w3.org/TR/xpath/">XPath</a> expression to find the relevant text node and change the data using the ElementTree API of <a href="http://codespeak.net/lxml/">lxml python module</a>.</p>
<p>The same could be done using <a href="http://www.w3.org/TR/xslt">XSLT</a> of course (for a constant replacement, see <a href="http://landschoff.net/git/?p=mdc-video.git;a=blob;f=test.xsl;h=ba2a20d545c5076ea1b78707ab5e585ffa219262;hb=18026583d915c166b19fd26535cb49019d1158af">this file</a>) but I found it easier to combine two XML files in python.</p>
<p>Note that I create PNG files with synfig and use <a href="http://www.ffmpeg.org/">ffmpeg</a> to generate a DV file from those. Originally, I had synfig create DV files directly but those turned out quite gray for some reason. I am now unable to reproduce this problem.</p>
<h2>Combining the title animation with the talk</h2>
<p>For joining the title animation with the talk, I originally went with <a href="http://www.openshotvideo.com/">OpenShot</a>, which somebody of the video team had running at the conference. My idea was to mix a single video manually and just replace the underlying data files for each talk. I expected that this would be easy using the <tt>openshot-render</tt> command, which renders the output video from the input clips and the <a href="http://landschoff.net/git/?p=mdc-video.git;a=blob;f=master/master.osp;h=f32c0c2dc5e8ca88c69eff88fd46f70318064beb;hb=18026583d915c166b19fd26535cb49019d1158af">OpenShot project file</a>. However, OpenShot stores the video lengths in the project file and will take those literally, so this did not work for talks of different play times&#8230;</p>
<p>I considered working with <a href="http://www.kinodv.org/">Kino</a> or <a href="http://kdenlive.org/">Kdenlive</a> but they did not look more appropriate for this use case. I noticed that OpenShot and Kdenlive both use the <a href="http://www.mltframework.org/">Media Lovin&#8217; Toolkit</a> under the hood, and OpenShot actually serializes the MLT configuration to <tt>$HOME/.openshot/sequence.xml</tt> when rendering. I first tried to read that XML file from python (using the mlt python bindings from the <tt>python-mlt2</tt> package) but did not find an API function to do that. So I just hard coded the <a href="http://landschoff.net/git/?p=mdc-video.git;a=blob;f=sequence.py;h=030ea9e2b2cfcb279d0baa19d03f09397583d644;hb=18026583d915c166b19fd26535cb49019d1158af">video sequence</a> in python.</p>
<p>I ran into a few gotchas on the way:</p>
<ul>
<li>it&#8217;s easy to segfault MLT from Python (something is wrong with the refcounting)</li>
<li>generating ogg theora using MLT from Python (which uses libavformat) resulted in a bad audio/video synchronisation of the output (more than 1 second for 1 hour of video)</li>
<li>generating dv from MLT and running <a href="http://v2v.cc/~j/ffmpeg2theora/">ffmpeg2theora</a> on the result is disk-bound on my quad core system &#8211; so use a pipe to ffmpeg2theora</li>
</ul>
<h2>Things to improve</h2>
<p>While the results look quite okay for me now, there is a lot of room for improvement.</p>
<ul>
<li>What bothers me the most is the unequal audio volume between talks. We should apply something like <a href="http://replaygain.hydrogenaudio.org/">replay gain</a> for normalization. I did not find an easy way to add this to the processing pipeline, otherwise it would have been included already.</li>
<li>Original recordings have different aspect ratios, so after combining them, there is a letterbox added. This is the case for <a href="http://meetings-archive.debian.net/pub/debian-meetings/2010/minidebconf-berlin/MDC2010_Brederlow_MultiArch.ogv">Goswin&#8217;s talk on Multiarch</a> for example. I&#8217;d rather have the title distorted or letter boxed, if I get around to it, I will fix it in the script.</li>
<li>Most of the recordings concentrate on showing the slides. As we did not keep the raw camera data, but recorded the <a href="http://dvswitch.alioth.debian.org/wiki/">DVswitch</a> output, we missed the opportunity to show the speaker more often in full screen. Looking at the same slide becomes quite boring after half a minute, so it would be better<br />
to show the speaker more often. That would require quite a bit of man power for post processing though, I have to admit that I did not watch all the hours of video.</li>
<li>We could cut a bit off the talk at start and end, when the speaker discusses where he is available for questions. It is not of interest anymore after the conference is over.</li>
</ul>
<h2>Availability</h2>
<ul>
<li>git repo (browsing): <a href="http://www.landschoff.net/git/?p=mdc-video.git;a=summary">http://www.landschoff.net/git/?p=mdc-video.git;a=summary</a></li>
<li>git repo (clone): <a href="git://landschoff.net/mdc-video">git://landschoff.net/mdc-video</a></li>
<li>Videos: <a href="http://meetings-archive.debian.net/pub/debian-meetings/2010/minidebconf-berlin/">http://meetings-archive.debian.net/pub/debian-meetings/2010/minidebconf-berlin/</a> (<strong>note:</strong> most of these are in german, apart from the DPL and the LXDE talk)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.landschoff.net/blog/2010/07/postprocessing-conference-videos/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
<enclosure url="http://www.landschoff.net/blog/uploads/2010/07/mdc2010_title_anim1.ogv" length="369157" type="video/ogg" />
<enclosure url="http://meetings-archive.debian.net/pub/debian-meetings/2010/minidebconf-berlin/MDC2010_Brederlow_MultiArch.ogv" length="426287215" type="video/ogg" />
		</item>
	</channel>
</rss>

