Answers.Body: <p>Craft doesn't come with a PHP library for audio, so there's no core solution for your problem.</p>
  
  <p>But what you could do is to make a plugin, add such a library to it and provide <code>duration</code> and <code>bitrate</code> Twig filters to your templates.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>You could try out my new <a href="https://github.com/carlcs/craft-assetmetadata" rel="nofollow">"Asset Metadata"</a> plugin. It makes use of the <a href="https://github.com/JamesHeinrich/getID3/" rel="nofollow">getID3</a> PHP library to extract all sort of metadata from your assets.</p>
  
  <p>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. <code>PT1H21M48S</code>), or a photo's exposure time as a ratio.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-21T14:33:19.653Z
Answers.LastActivityDate: 2015-03-19T19:43:00.963Z
Answers.LastEditDate: 2015-03-19T19:43:00.963Z
Answers.UserDisplayName: carlcs
Body: <p>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.</p>
  
  <p>Anyone know how to do this?</p>
  
Tags: <assets>
Title: Getting the length of an audio asset?
ThreadText: # Getting the length of an audio asset?
  
  (Asked by: username_0 on 2015-02-21)
  
  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 <itunes:duration> tag.
  
  Anyone know how to do this?
  
  **Tags:** assets
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-02-21. Score: 6 | Accepted answer
  
  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"](https://github.com/username_1/craft-assetmetadata) plugin. It makes use of the [getID3](https://github.com/JamesHeinrich/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.
  
  
  ---
  
  