MyTetra Share
Делитесь знаниями!
Прочитать мета-данные аудиофайлов из Python при помощи tinytag
Время создания: 03.07.2019 17:31
Автор: br0ke
Текстовые метки: python, audio, audiofile, file, meta, data, tag, tags, id3, mp3, opus, ogg, tinytag
Раздел: Информационные технологии - Python - Библиотеки
Запись: and-semakin/mytetra_data/master/base/1562157108auo736c6qz/text.html на raw.githubusercontent.com

Установка:


pip install tinytag


Поддерживает следующие форматы:

  • MP3 (ID3 v1, v1.1, v2.2, v2.3+)
  • Wave/RIFF
  • OGG
  • OPUS
  • FLAC
  • WMA
  • MP4/M4A/M4B


Использование:


from tinytag import TinyTag

tag = TinyTag.get('/some/music.mp3')

print('This track is by %s.' % tag.artist)

print('It is %f seconds long.' % tag.duration)



Список доступных данных:


tag.album # album as string

tag.albumartist # album artist as string

tag.artist # artist name as string

tag.audio_offset # number of bytes before audio data begins

tag.bitrate # bitrate in kBits/s

tag.comment # file comment as string

tag.composer # composer as string

tag.disc # disc number

tag.disc_total # the total number of discs

tag.duration # duration of the song in seconds

tag.filesize # file size in bytes

tag.genre # genre as string

tag.samplerate # samples per second

tag.title # title of the song

tag.track # track number as string

tag.track_total # total number of tracks as string

tag.year # year or data as string


Так же можно получить обложку альбома из ID3:


tag = TinyTag.get('/some/music.mp3', image=True)

image_data = tag.get_image()

 
MyTetra Share v.0.59
Яндекс индекс цитирования