<?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>blog.forret.com &#187; scripting</title>
	<atom:link href="http://blog.forret.com/categories/scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.forret.com</link>
	<description>and I mean it</description>
	<lastBuildDate>Tue, 17 Nov 2009 19:00:00 +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>Screenshots of a DVD with &#8216;ffmpeg&#8217;</title>
		<link>http://blog.forret.com/2008/02/screenshots-of-a-dvd-with-ffmpeg/</link>
		<comments>http://blog.forret.com/2008/02/screenshots-of-a-dvd-with-ffmpeg/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 21:18:37 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[audio-video]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[extract]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[rip]]></category>

		<guid isPermaLink="false">http://blog.forret.com/2008/02/screenshots-of-a-dvd-with-ffmpeg/</guid>
		<description><![CDATA[I&#8217;ve been playing around a lot with video conversion lately and one of the tools I use often is the Swiss armyknife for video manipulation &#8216;ffmpeg&#8216;. It does format conversion (MPEG1/2/4, Quicktime, AVI &#8230;) , rescaling, recompressing, frame rate conversion &#8230; almost everything. It exists for all flavours of Linux/Unix, and also for Windows.
To give [...]


Related posts:<ol><li><a href='http://blog.forret.com/2008/02/apple-trailers-when-720p-isnt-always-720p/' rel='bookmark' title='Permanent Link: Apple trailers: when 720p isn&#8217;t always 720p'>Apple trailers: when 720p isn&#8217;t always 720p</a> <small>One of the best places to look for high-quality movie...</small></li><li><a href='http://blog.forret.com/2009/07/my-quest-for-lets-get-lost-chet-baker-by-bruce-weber/' rel='bookmark' title='Permanent Link: My quest for &#8220;Let&#8217;s get lost&#8221; &#8211; Chet Baker by Bruce Weber'>My quest for &#8220;Let&#8217;s get lost&#8221; &#8211; Chet Baker by Bruce Weber</a> <small> Let&#8217;s Get Lost (1988) is a American documentary film...</small></li><li><a href='http://blog.forret.com/2007/08/id3exe-ideal-tool-for-tagging-and-renaming-mp3-files/' rel='bookmark' title='Permanent Link: id3.exe &#8211; ideal tool for tagging and renaming MP3 files'>id3.exe &#8211; ideal tool for tagging and renaming MP3 files</a> <small>I want to mention a little tool that helped me...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around a lot with video conversion lately and one of the tools I use often is the Swiss armyknife for video manipulation &#8216;<a href="http://ffmpeg.mplayerhq.hu/">ffmpeg</a>&#8216;. It does format conversion (MPEG1/2/4, Quicktime, AVI &#8230;) , rescaling, recompressing, frame rate conversion &#8230; almost everything. It exists for all flavours of Linux/Unix, and also for <a href="http://www.videohelp.com/tools/ffmpeg">Windows</a>.</p>
<p>To give you an example: this is a script I wrote to extract screenshots of DVD files, straight from the disk.</p>
<p><strong>1) the naive version</strong><br />
<code>ffmpeg -i [input file] -r .05 -y [output name]%%03d.png</code><br />
This does indeed extract a PNG image every 20 seconds (framerate = 0.05), but it does not take into account that the DVD image material is stored anamorphically. What you get is this:<br />
<a href="http://www.flickr.com/photos/pforret/2251354130/" title="V4Vendetta_1_720.012 by PeterForret, on Flickr"><img width="240" src="http://farm3.static.flickr.com/2410/2251354130_3c70d04cdf_m.jpg" alt="V4Vendetta_1_720.012" height="192" /></a><br />
Natalie Portman looks really thin, but that&#8217;s because the image dimensions (720&#215;576 pixels &#8211; PAL standard) are for 5:4 aspect ratio, and whereas the actual image should be 16:9. So let&#8217;s make the image wider while keeping it the same height.</p>
<p><strong>2) Rescale to 16:9</strong><br />
<code>ffmpeg -i [input file] -r .05 -s 1024x576 -y [output name]%%03d.png</code><br />
The result looks better:<br />
<a href="http://www.flickr.com/photos/pforret/2251353732/" title="V4Vendetta_1_1024.012 by PeterForret, on Flickr"><img width="240" src="http://farm3.static.flickr.com/2125/2251353732_f0d3c9c74f_m.jpg" alt="V4Vendetta_1_1024.012" height="135" /></a></p>
<p>As you see, there are still black borders on the top and bottom. This is because a feature film is made in &#8217;scope&#8217; format, with an aspect ratio of 2.39 instead of 1.78 (the decimal equivalent of 16/9). So, while the full width of the image is used, only 428 pixels of the height are actually in use. Let&#8217;s crop those black borders off.</p>
<p><strong>3) Crop black borders away</strong><br />
<code>ffmpeg -i [input file] -r .05 -croptop 74 -cropbottom 74 -s 1024x428 -y [output name]%%03d.png</code></p>
<p><a href="http://www.flickr.com/photos/pforret/2250661505/" title="V for Vendetta: cropped by PeterForret, on Flickr"><img src="http://farm3.static.flickr.com/2159/2250661505_42377134ee.jpg" width="500" height="209" alt="V for Vendetta: cropped" /></a></p>
<p><strong>4) old 4:3 movies</strong><br />
The older movies used a 4:3 aspect ratio, so when you extract them as 16:9 they look like a weight feel on them:<br />
<a href="http://www.flickr.com/photos/pforret/2250556757/" title="MammaRoma_1024 by PeterForret, on Flickr"><img width="240" src="http://farm3.static.flickr.com/2142/2250556757_9a5cdf6576_m.jpg" alt="MammaRoma_1024" height="135" /></a><br />
In those cases, you can use the &#8216;naive&#8217; version above, which will give you:<br />
<a href="http://www.flickr.com/photos/pforret/2250556101/" title="MammaRoma_720 by PeterForret, on Flickr"><img width="240" src="http://farm3.static.flickr.com/2149/2250556101_cc7d436950_m.jpg" alt="MammaRoma_720" height="192" /></a></p>
<p>Here also, the actual 4:3 image is &#8216;letterboxed&#8217; to the 5:4 DVD image.</p>
<p><span id="more-987"></span>Why did I need to figure this out? Well, guess what movie is running on my LCD photo frame:<br />
<a href="http://www.flickr.com/photos/pforret/2250618987/" title="Lucia y el sexo by PeterForret, on Flickr"><img width="500" src="http://farm3.static.flickr.com/2028/2250618987_04117271a2.jpg" alt="Lucia y el sexo" height="281" /></a></p>
<h4>Windows batch script</h4>
<p>For those who like a ready-made script (for Windows machines), here it goes:</p>
<p><code>set FFMPEG=C:\Program Files\ffmpeg\ffmpeg.exe<br />
set SOURCE=e:\video_ts<br />
set TITLE=[movie name]<br />
set DESTIN=%CD%</code></p>
<p><code></code><code>pushd %SOURCE%<br />
for %%F in (*.VOB) do (<br />
  call :vob2img %%F<br />
)<br />
popd<br />
goto :end<br />
:vob2img<br />
set FNAME=%1<br />
set NAME=%FNAME:.VOB=%<br />
set NAME=%NAME:VTS_=%<br />
set NAME=%NAME:01_=%<br />
set NAME=%NAME:_TS=%<br />
set NAME=%NAME:VIDEO=%<br />
set ROOT=%TITLE%_%NAME%<br />
"%FFMPEG%" -i %FNAME% -r .05 -croptop 74 -cropbottom 74 -s 1024x428 -y %DESTIN%\%ROOT%.%%03d.png<br />
:end</code></p>
<p>Which will give, for a 90 minute movie, 270 images called like <code>V4Vendetta_1.NNN.png</code>.</p>


<p>Related posts:<ol><li><a href='http://blog.forret.com/2008/02/apple-trailers-when-720p-isnt-always-720p/' rel='bookmark' title='Permanent Link: Apple trailers: when 720p isn&#8217;t always 720p'>Apple trailers: when 720p isn&#8217;t always 720p</a> <small>One of the best places to look for high-quality movie...</small></li><li><a href='http://blog.forret.com/2009/07/my-quest-for-lets-get-lost-chet-baker-by-bruce-weber/' rel='bookmark' title='Permanent Link: My quest for &#8220;Let&#8217;s get lost&#8221; &#8211; Chet Baker by Bruce Weber'>My quest for &#8220;Let&#8217;s get lost&#8221; &#8211; Chet Baker by Bruce Weber</a> <small> Let&#8217;s Get Lost (1988) is a American documentary film...</small></li><li><a href='http://blog.forret.com/2007/08/id3exe-ideal-tool-for-tagging-and-renaming-mp3-files/' rel='bookmark' title='Permanent Link: id3.exe &#8211; ideal tool for tagging and renaming MP3 files'>id3.exe &#8211; ideal tool for tagging and renaming MP3 files</a> <small>I want to mention a little tool that helped me...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.forret.com/2008/02/screenshots-of-a-dvd-with-ffmpeg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Barcamp video saga: background</title>
		<link>http://blog.forret.com/2007/06/the-barcamp-video-saga-background/</link>
		<comments>http://blog.forret.com/2007/06/the-barcamp-video-saga-background/#comments</comments>
		<pubDate>Tue, 12 Jun 2007 18:30:14 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[audio-video]]></category>
		<category><![CDATA[barcamp]]></category>
		<category><![CDATA[nokia]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://blog.forret.com/2007/06/the-barcamp-video-saga-background/</guid>
		<description><![CDATA[I&#8217;ve had a number of requests from attendees of the Barcamp Brussels 3 event. &#8220;The speeches were recorded on Nokia N95 phones, right? How come we haven&#8217;t seen them yet on Youtube/Google? What&#8217;s taking so long?&#8221; Well, here&#8217;s the answer.
The reason is purely me. I received the N95 video&#8217;s (3DVDs, about 12GB in total) from [...]


Related posts:<ol><li><a href='http://blog.forret.com/2007/04/barcamp-brussels-one-month-to-go/' rel='bookmark' title='Permanent Link: Barcamp Brussels: one month to go'>Barcamp Brussels: one month to go</a> <small> In about 30 days, a bunch of Internet entrepreneurs,...</small></li><li><a href='http://blog.forret.com/2007/03/barcamp-brussels-3-may-5th-in-the-marolles/' rel='bookmark' title='Permanent Link: Barcamp Brussels #3: May 5th in the Marolles!'>Barcamp Brussels #3: May 5th in the Marolles!</a> <small>It has been decided, the bullet is through the church...</small></li><li><a href='http://blog.forret.com/2007/11/barcamp-brussels-4-10-days-to-go/' rel='bookmark' title='Permanent Link: Barcamp Brussels #4: 10 days to go'>Barcamp Brussels #4: 10 days to go</a> <small> Barcamp Brussels #4 is coming closer: Saturday Dec 1st...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a number of requests from attendees of the <a href="http://barcamp.forret.com/">Barcamp Brussels 3</a> event. &#8220;<em>The speeches were recorded on Nokia N95 phones, right? How come we haven&#8217;t seen them yet on Youtube/Google? What&#8217;s taking so long?</em>&#8221; Well, here&#8217;s the answer.</p>
<p>The reason is purely me. I received the N95 video&#8217;s (3DVDs, about 12GB in total) from <a href="http://www.druppels.be">Fré</a> quite soon after the event. At the time, I was &#8216;just going to throw them&#8217; on Google Video, maybe with a title image before the movie that included a Barcamp and Nokia logo. How hard would that be, right? Well, slightly harder than I thought. The files were huge, so had to be transcoded to something smaller, there were too many files to do things manually, so I needed to start scripting, and the tools I used for it, <a href="http://www.imagemagick.org">ImageMagick</a> and <a href="http://ffmpeg.mplayerhq.hu/">FFMPEG</a> are powerful but tricky. That combined with my tango activities, a holiday, a girlfriend abroad and the non-negligeable fact of having a day-time job made for this delay of over a month. Mea culpa. But the wait is over.</p>
<p>These are the first videos. Feedback on video, sound and other details are welcome! I will then proceed with the conversion of the other ones. I will also do a post on what tricks I used to do the video rendering of the title, the transcoding and the merging of video files.</p>
<p><a href="http://www.carreconfiture.be/meneertjeconfituur/">Jeroen De Cock</a> &#8211; &#8220;Online communities &#038; offline events&#8221;<br />
<embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=-2591296822346380965&#038;hl=nl" flashvars=""> </embed></p>
<p><a href="http://hamstersoup.wordpress.com">Will Moffat</a> &#8211; &#8220;<a href="http://hamstersoup.wordpress.com/2007/05/05/barcamp-brussels-my-freebase-talk/">Introduction to Freebase</a>&#8221;<br />
<embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=-6855326294452811605&#038;hl=nl" flashvars=""> </embed></p>


<p>Related posts:<ol><li><a href='http://blog.forret.com/2007/04/barcamp-brussels-one-month-to-go/' rel='bookmark' title='Permanent Link: Barcamp Brussels: one month to go'>Barcamp Brussels: one month to go</a> <small> In about 30 days, a bunch of Internet entrepreneurs,...</small></li><li><a href='http://blog.forret.com/2007/03/barcamp-brussels-3-may-5th-in-the-marolles/' rel='bookmark' title='Permanent Link: Barcamp Brussels #3: May 5th in the Marolles!'>Barcamp Brussels #3: May 5th in the Marolles!</a> <small>It has been decided, the bullet is through the church...</small></li><li><a href='http://blog.forret.com/2007/11/barcamp-brussels-4-10-days-to-go/' rel='bookmark' title='Permanent Link: Barcamp Brussels #4: 10 days to go'>Barcamp Brussels #4: 10 days to go</a> <small> Barcamp Brussels #4 is coming closer: Saturday Dec 1st...</small></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.forret.com/2007/06/the-barcamp-video-saga-background/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BlogCentral: your blog dashboard</title>
		<link>http://blog.forret.com/2006/06/blogcentral-your-blog-dashboard/</link>
		<comments>http://blog.forret.com/2006/06/blogcentral-your-blog-dashboard/#comments</comments>
		<pubDate>Thu, 08 Jun 2006 14:34:00 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[scripting]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://blog.forret.com/2006/06/blogcentral-your-blog-dashboard/</guid>
		<description><![CDATA[I just updated one of my web tools that definitely needed it: the Blogcentral Blog Dashboard.The idea is to give the relevant data for your blog (blog name, blog URL, feed URL, author name) and then get a dashboard page (that you can bookmark) which gives you easy access to all blog search engines, rankings [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I just updated one of my <a href="http://web.forret.com/tools/">web tools</a> that definitely needed it: the <a href="http://web.forret.com/tools/blogcentral.asp">Blogcentral Blog Dashboard</a>.The idea is to give the relevant data for your blog (blog name, blog URL, feed URL, author name) and then get a dashboard page (that you can bookmark) which gives you easy access to all blog search engines, rankings and ping services.</p>
<p><a href="http://www.flickr.com/photos/pforret/162569433/" title="Photo Sharing"><img width="500" src="http://static.flickr.com/67/162569433_f4ef95f405.jpg" alt="Web tool: blogcentral" height="385" /></a></p>
<p>I have been using the old version for quite a time already (mainly for Technorati stats), but now it even includes Alexa ranking, Egosurf, BlogPulse, -Digger, -Lines, -Shares, Google/Blogger, Sphere and Icerocket. Try it out and investigate that blog ego!</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.forret.com/2006/06/blogcentral-your-blog-dashboard/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 2.007 seconds -->
