development

Enclosure Support for lastRSS

A brief search for a lightweight RSS parser for PHP led me to lastRSS. It supports caching and character encoding -- major plusses for the project I was working on. Unfortunately, lastRSS lacks decent support for enclosures, which was a show stopper for me. I also considered MagpieRSS, which I've heard good things about, but development on the 2.0 version (which purports to support RSS enclosures) seems to have stalled -- the developer hasn't posted an update since last Fall, and the link to the development version was broken.

lastRSS is a pretty clean chunk of code, and extending it to provide support for XML attributes (in turn, supporting the enclosure element) seemed like the simplest option.

Note that this modified version of the code will return an array of attributes, for RSS elements that contain them. If the element also has content, this will be stored in an array element named value.

Posted In

PEG Access Centers and New Technology

These notes are part of my presentation "PEG Access Centers and New Technology" at the Northeast Alliance for Community Media Conference on November 17.

Posted In

HTML to Add Streaming Video to Your Site

<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
    WIDTH="320" HEIGHT="256" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">
    <PARAM name="SRC" VALUE="http://ltc.org/files/hik_poster_240.mov">
    <PARAM name="QTSRC" VALUE="rtsp://streaming.yoursite.org/filename.mov">
    <PARAM name="AUTOPLAY" VALUE="true">
    <PARAM name="CONTROLLER" VALUE="true">
    <EMBED SRC="http://ltc.org/files/hik_poster_240.mov"
        QTSRC="rtsp://streaming.yoursite.org/filename.mov"
        WIDTH="320" HEIGHT="256" AUTOPLAY="true" CONTROLLER="true"
        PLUGINSPAGE="http://www.apple.com/quicktime/download/">
    </EMBED>
</OBJECT>
Posted In

Extracting still images from video using ffmpeg

Several interested parties contacted me about getting ffmpeg to spit out a series of stills from a video file. I spent a few minutes googling, and wasn't getting anywhere, so I put together this quick walkthrough.

ffmpeg can do it, but it's always been a bit akward for me to make it to do *exactly* what I want it to do. But not altogether difficult.

Try this:

ffmpeg -i inputfile.mov -ss 1.000 -r 1 -vframes 10 -an -s 320x240 -f image2 frame%d.jpg

Ok, so the breakdown is as follows:

  • inputfile.mov is obviously your video, which can be pretty much any file format
  • ss - the seek point, where you want to start from, in seconds
  • r - the frame rate -- I set it to 1, so it exports a single frame each second. Otherwise it's a clusterfuck and you get 30fps of jpeg stills. You can even set it to a decimal, like .5 to get 1 frame every 2 seconds.
  • vframes - the number of frames to export. You can set it to a higher number than the number of frames in the video -- ffmpeg won't blow up or throw exceptions. Of course, if you already know how long the video is, you could have a script that dynamically tells ffmpeg how many frames to use.
  • an - drops the audio processing, probably unnessary, but might spare a few cpu cycles.
  • s - size in pixels, WxH
  • f - file format. image2 works, so I use it. There's lots of options if you feel inclined to experiment, just type ffmpeg -formats
  • frame%d.jpg - "frame" is just an arbitrary name, you can call it anything, just use double quotes if there are spaces in the name. %d tells ffmpeg where to put the incremental numbers. No idea if there is a way to force leading zeros, that would be nice.

Bug: the first two frames ffmpeg exports are always the same. I don't know any way to avoid this, other than to have your calling script toss the first file out. Or just live with it.

Posted In

Firefox extensions for web development

I've been using Firefox for over a year now (and through a number of name changes), and as many of my co-workers can attest, I'm a huge fan. And while many of the built in features that Firefox boasts are excellent (popup blocking, tabbed browsing, etc.), it's the plethora of extensions that really make this browser great.

Extensions are basically plugins -- they add some new functionality to the browser. There are great collections of Firefox extensions at: Mozilla Update and Extension Room

As a developer, I have a number of favorites, which include:

  • ColorZilla - Extract color information and CSS class/id names by hovering over elements in a page.
  • Web Developer toolbar - A very useful set of tools for web development work.
  • Googlebar - Excellent set of tools for navigating Google search results and locating/highlighting keywords within a page.
  • TabBrowser extensions - Organize tabs easily, drag and drop tabs, and set default behaviors for opening links into new or existing tabs. Lots of other options too.
  • Live HTTP Headers - Great tool for examining HTTP requests/responses, very useful for developing web-enabled applications.
  • AdBlock - Very useful extension. I'm all for ad-supported content, but when the ads overwhelm the content it becomes necessary to invoke the power of this little extension. It also blocks annoying Flash ads/animations, unless you click to enable them.
  • MozCC - Resides in the status bar and displays Creative Commons licensing details when the content of a page contains an embedded Creative Commons license.

If it's not evident by my list, I make pretty frequent use of Firefox as a development tool, and not just a browser.

Posted In

Flickr Photos

Get Firefox

Random Quote

Those who give up liberty for the sake of security deserve neither liberty nor security.

— Benjamin Franklin