AVAsset.Duration
----------------

Returns the duration of a asset in seconds.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [AVAsset](component_AVAsset.md) | [5.2](newinversion52.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

MBS( "AVAsset.Duration"; Asset ) 

**MBS**( **"AVAsset.Duration";** /\* Returns the duration of a asset in seconds. \*/  
**$Asset**) /\* The reference number of the asset. Please use [AVAsset.OpenContainer](AVAssetOpenContainer.md), [AVAsset.OpenFile](AVAssetOpenFile.md) or [AVAsset.OpenURL](AVAssetOpenURL.md) function to get asset reference. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Asset | The reference number of the asset. Please use [AVAsset.OpenContainer](AVAssetOpenContainer.md), [AVAsset.OpenFile](AVAssetOpenFile.md) or [AVAsset.OpenURL](AVAssetOpenURL.md) function to get asset reference. | $asset |

### Result

Returns value or error.

### Description

Returns the duration of a asset in seconds.  
### Examples

Query duration of a video:

 MBS ( "AVAsset.Duration"; $asset )  
### See also

- [AVAsset.OpenContainer](AVAssetOpenContainer.md)
- [AVAsset.OpenFile](AVAssetOpenFile.md)
- [AVAsset.OpenURL](AVAssetOpenURL.md)

### Example Databases

- [Mac and iOS/AVExport](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/AVExport.shtml#1ScriptAnchor_)
- [Mac only/Movies/AVAsset Test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/Movies/AVAsset%20Test.shtml#1ScriptAnchor_)

This function is free to use.

Created 19th June 2015 , last changed 13th January 2021

  
[AVAsset.AvailableMetadataFormats](AVAssetAvailableMetadataFormats.md) - [AVAsset.Framerate](AVAssetFramerate.md)

[HTML Version](AVAssetDuration.shtml)