Media Field generating a duration in a new field

I’m working on setting up a daybook for my public radio station, but I’d also like the daybook to pump out FCC logs with certain columns to streamline the process. Is there a way to generate a duration based on the media length posted in another column? For example, if I post a spot that is 1:32 long, could a separate duration field be populated with 1:32? Thank you in advance for any help on this.

Welcome to the community, @Sasa_Woodruff! :smiley: That’s definitely possible. Could you please share more about the design of your table, specifically the field where the spot length is stored?

So, we would upload an audio spot in the form of a .wav file into one field. That file will have varying durations. Would that wav file have metadata with the duration that could be output automatically into another field?

Thanks for the update, @Sasa_Woodruff. I’m afraid I’ll have to change “definitely possible” to “uncertain” based on that new information. Would the file have metadata? Definitely. Is that metadata accessible from within Airtable? That’s where it gets tricky.

Using a formula field, the filename and file path are the only immediately-available data points for files in an attachment field. To get more will require some programming. A quick search turns up several JavaScript libraries that would be really helpful, but unfortunately external libraries aren’t available via Airtable’s scripting block. Options that use the HTML DOM are also off the table.

This means that you’re basically left with two options:

  1. Code a solution that connects from the outside using Airtable’s REST API, on a platform without the restrictions of Airtable’s scripting system.
  2. Use a service like Zapier or Integromat. With either of those, you would probably need to pull the file from Airtable to yet another service, provided that any of the services tied to Zapier or Integromat will give you access to the file’s metadata.

I wish that I had better answers. I got the impression from your initial post that the duration was stored in another field as easily-readable data. Because it’s not, this has become a much more challenging problem.

Although formula fields and scripting block cannot get the duration from an audio file, it might be possible with a Custom Block (currently in beta). While the Scripting block does not have access to the HTML DOM, and thus cannot get the duration of an audio file from the DOM, Custom Blocks have fewer restrictions, but they can be trickier to implement if you are not comfortable with coding.

1 Like

Hi @Sasa_Woodruff,

As others have mentioned, there is no way to do this natively in Airtable, outside of possibly writing your own JavaScript code for a custom block.

It’s probably easiest to just manually type in the duration of your videos.

However, if you really need the duration field automated for you, you could easily use YouTube & Zapier to do this for you, and it would only take a few minutes to setup.

Simply upload your videos to YouTube instead of Airtable, and Zapier will automatically recognize when you have uploaded a new video.

Then, Zapier can grab both the duration of the video and the URL of your video, and place that information into Airtable for you.

Here’s the big difference between this and what you’re currently doing:

It wouldn’t actually be putting the video itself into an Airtable attachment field for you, but instead it would be putting a link to your YouTube video into a URL field.

Then, once the link is in your URL field, you could watch your YouTube video within Airtable using the URL Preview Block.

So the video would be stored on YouTube instead of within Airtable, but you could still watch the video within Airtable.

Similarly, you could do this with Vimeo as well, but note that only paid Vimeo accounts allow their videos to be streamed into Airtable’s URL Preview Block. Airtable’s support documents don’t mention this limitation, so it’s important to know ahead of time.

If you went with a paid Vimeo account, you could automate this process with either Integromat or Zapier. Integromat is generally preferred over Zapier, because it has a lot more power & flexibility, and is cheaper as well.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.