Getting the length of an audio asset? I'm trying to create a podcast feed with Craft, and I seem to have everything working... except I can't find out how to grab the length of an audio file dynamically. I can get the filesize in bytes, and if it's an image asset you can get width... but there doesn't seem to be a way to get the play-time for an audio file; which is needed for the &lt;itunes:duration&gt; tag.

Anyone know how to do this?
Craft doesn't come with a PHP library for audio, so there's no core solution for your problem.

But what you could do is to make a plugin, add such a library to it and provide duration and bitrate Twig filters to your templates.

EDIT:

You could try out my new "Asset Metadata" plugin. It makes use of the getID3 PHP library to extract all sort of metadata from your assets.

To make your life a bit easier, I added further beautified metadata properties like a sound file's playtime duration in ISO 8601 date interval format (i.e. PT1H21M48S), or a photo's exposure time as a ratio.