简体   繁体   中英

How to find duration of online audio file without downloading it using python?

I have url of a wav format audio file which is basically an audio of a call . I want to find the duration of the wav file, which means the duration of the call. I do not want to download the wav file, as I have to repeat this set for a large number of such records. Is there any way to do this in python ?

A little more information about where the audio file would be helpful. Such as the URL or the location of the file. You might be able to use beautiful soup to scrape for the length if it's mentioned on a webpage, otherwise, you might be able to use some sort of an API call.

https://github.com/quodlibet/mutagen would helpful to look at

You will need to download some of the WAV files to be able to read the header and parse it with eg the builtin wave module .

Alternately, if all of the files are uncompressed PCM, and have the same format, you can just look at the file size (which you can get with a HTTP HEAD request) and guess the approximate duration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM