mp3文件的时间长度 [英] time length of an mp3 file

查看:157
本文介绍了mp3文件的时间长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不使用外部库确定给定mp3文件长度(以秒为单位)的最简单方法是什么? (高度赞赏python源)

What is the simplest way to determine the length (in seconds) of a given mp3 file, without using outside libraries? (python source highly appreciated)

推荐答案

您可以使用 pymad .它是一个外部库,但不要落入此处未发明"陷阱.您不希望使用任何外部库的任何特殊原因?

You can use pymad. It's an external library, but don't fall for the Not Invented Here trap. Any particular reason you don't want any external libraries?

import mad

mf = mad.MadFile("foo.mp3")
track_length_in_milliseconds = mf.total_time()    

此处发现.

-

如果您真的不想使用外部库,请在此处进行检查知道他是如何做到的.警告:这很复杂.

If you really don't want to use an external library, have a look here and check out how he's done it. Warning: it's complicated.

这篇关于mp3文件的时间长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆