time length of an mp3 file

前端 未结 6 2121
别那么骄傲
别那么骄傲 2020-12-01 07:11

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

6条回答
  •  北海茫月
    2020-12-01 07:32

    simply use mutagen

    $pip install mutagen
    

    use it in python shell:

    from mutagen.mp3 import MP3
    audio = MP3(file_path)
    print audio.info.length
    

提交回复
热议问题