Screenshots of a DVD with ‘ffmpeg’

I’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 ‘ffmpeg‘. It does format conversion (MPEG1/2/4, Quicktime, AVI …) , rescaling, recompressing, frame rate conversion … almost everything. It exists for all flavours of Linux/Unix, and also for Windows.

To give you an example: this is a script I wrote to extract screenshots of DVD files, straight from the disk.

1) the naive version
ffmpeg -i [input file] -r .05 -y [output name]%%03d.png
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:
Natalie Portman looks really thin, but that’s because the image dimensions (720×576 pixels – PAL standard) are for 5:4 aspect ratio, and whereas the actual image should be 16:9. So let’s make the image wider while keeping it the same height.

2) Rescale to 16:9
ffmpeg -i [input file] -r .05 -s 1024x576 -y [output name]%%03d.png
The result looks better:

As you see, there are still black borders on the top and bottom. This is because a feature film is made in ‘scope’ 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’s crop those black borders off.

3) Crop black borders away
ffmpeg -i [input file] -r .05 -croptop 74 -cropbottom 74 -s 1024x428 -y [output name]%%03d.png

V for Vendetta: cropped

4) old 4:3 movies
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:
In those cases, you can use the ‘naive’ version above, which will give you:

Here also, the actual 4:3 image is ‘letterboxed’ to the 5:4 DVD image.

Continue reading Screenshots of a DVD with ‘ffmpeg’

The Barcamp video saga: background

I’ve had a number of requests from attendees of the Barcamp Brussels 3 event. “The speeches were recorded on Nokia N95 phones, right? How come we haven’t seen them yet on Youtube/Google? What’s taking so long?” Well, here’s the answer.

The reason is purely me. I received the N95 video’s (3DVDs, about 12GB in total) from Fré quite soon after the event. At the time, I was ‘just going to throw them’ 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, ImageMagick and FFMPEG 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.

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.

Jeroen De Cock – “Online communities & offline events”

Will Moffat – “Introduction to Freebase

BlogCentral: your blog dashboard

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 and ping services.

Web tool: blogcentral

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!