Read music meta data and length of MP3, OGG, OPUS, MP4, M4A, FLAC, WMA and Wave files with python 2 or 3

Related tags

Audiotinytag
Overview

tinytag

tinytag is a library for reading music meta data of MP3, OGG, OPUS, MP4, M4A, FLAC, WMA and Wave files with python

Build Status Build status Coverage Status

Install

pip install tinytag

Features:

  • Read tags, length and cover images of audio files
  • supported formats
    • MP3 (ID3 v1, v1.1, v2.2, v2.3+)
    • Wave/RIFF
    • OGG
    • OPUS
    • FLAC
    • WMA
    • MP4/M4A/M4B
  • pure python, no dependencies
  • supports python 2.7 and 3.4 or higher
  • high test coverage
  • Just a few hundred lines of code (just include it in your project!)

tinytag only provides the minimum needed for reading MP3, OGG, OPUS, MP4, M4A, FLAC, WMA and Wave meta-data. It can determine track number, total tracks, title, artist, album, year, duration and more.

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)

Alternatively you can use tinytag directly on the command line:

$ python -m tinytag --format csv /some/music.mp3
> {"filename": "/some/music.mp3", "filesize": 30212227, "album": "Album", "albumartist": "Artist", "artist": "Artist", "audio_offset": null, "bitrate": 256, "channels": 2, "comment": null, "composer": null, "disc": "1", "disc_total": null, "duration": 10, "genre": null, "samplerate": 44100, "title": "Title", "track": "5", "track_total": null, "year": "2012"}

Check python -m tinytag --help for all CLI options, for example other output formats`

List of possible attributes you can get with TinyTag:

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

Additionally you can also get cover images from ID3 tags:

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

Changelog:

  • 1.5.0 (2020-11-05):
    • fixed data type to always return str for disc, disc_total, track, track_total #97 (thanks to kostalski)
    • fixed package install being reported as UNKNOWN for some python/pip variations #90 (thanks to russpoutine)
    • Added automatic detection for certain MP4 file headers
  • 1.4.0 (2020-04-23):
    • detecting file types based on their magic header bytes, #85
    • fixed opus duration being wrong for files with lower sample rate #81
    • implemented support for binary paths #72
    • always cast mp3 bitrates to int, so that CBR and VBR output behaves the sam
    • made str deterministic and use json as output format
  • 1.3.0 (2020-03-09):
    • added option to ignore encoding errors ignore_errors #73
    • Improved text decoding for many malformed files
  • 1.2.2 (2019-04-13):
    • Improved stability when reading corrupted mp3 files
  • 1.2.1 (2019-04-13):
    • fixed wav files not correctly reporting the number of channels #61
  • 1.2.0 (2019-04-13):
    • using setup.cfg instead of setup.py (thanks to scivision)
    • added support for calling TinyTag.get with pathlib.Path (thanks to scivision)
    • added appveyor windows test CI (thanks to scivision)
    • using pytest instead of nosetest (thanks to scivision)
  • 1.1.0 (2019-04-13):
    • added new field "composer" (Thanks to Phil Borman)
  • 1.0.1 (2019-04-13):
    • fixed ID3 loading for files with corrupt header (thanks to Ian Homer)
    • fixed parsing of duration in wav file (thanks to Ian Homer)
  • 1.0.0 (2018-12-12):
    • added comment field
    • added wav-riff format support
    • use MP4 parser for m4b files
    • added simple cli tool
    • fix parsing of FLAC files with ID3 header (thanks to minus7)
    • added method TinyTag.is_supported(filename)
  • 0.19.0 (2018-02-11):
    • fixed corrupted images for some mp3s (#45)
  • 0.18.0 (2017-04-29):
    • fixed wrong bitrate and crash when parsing xing header
  • 0.17.0 (2016-10-02):
    • supporting ID3v2.2 images
  • 0.16.0 (2016-08-06):
    • MP4 cover image support
  • 0.15.2 (2016-08-06):
    • fixed crash for malformed MP4 files (#34)
  • 0.15.0 (2016-08-06):
    • fixed decoding of UTF-16LE ID3v2 Tags, improved overall stability
  • 0.14.0 (2016-06-05):
    • MP4/M4A and Opus support
Owner
Tom Wallroth
Tom Wallroth
python script for getting mp3 files from yaoutube playlist

mp3-from-youtube-playlist python script for getting mp3 files from youtube playlist. Do your non-tech brown relatives ask you for downloading music fr

Shuhan Mirza 7 Oct 19, 2022
extract unpack asset file (form unreal engine 4 pak) with extenstion *.uexp which contain awb/acb (cri/cpk like) sound or music resource

Uexp2Awb extract unpack asset file (form unreal engine 4 pak) with extenstion .uexp which contain awb/acb (cri/cpk like) sound or music resource. i ju

max 6 Jun 22, 2022
All-In-One Digital Audio Workstation and Plugin Suite

How to install Windows Mac OS X Fedora Ubuntu How to Build Debian and Ubuntu Fedora All Other Linux Distros Mac OS X Windows What is MusiKernel? MusiK

j3ffhubb 111 Sep 21, 2021
Voice helper on russian

Voice helper on russian

KreO 1 Jun 30, 2022
Stream Music ๐ŸŽต ๐˜ผ ๐™—๐™ค๐™ฉ ๐™ฉ๐™๐™–๐™ฉ ๐™˜๐™–๐™ฃ ๐™ฅ๐™ก๐™–๐™ฎ ๐™ข๐™ช๐™จ๐™ž๐™˜ ๐™ค๐™ฃ ๐™๐™š๐™ก๐™š๐™œ๐™ง๐™–๐™ข ๐™‚๐™ง๐™ค๐™ช๐™ฅ ๐™–๐™ฃ๐™™ ๐˜พ๐™๐™–๐™ฃ๐™ฃ๐™š๐™ก ๐™‘๐™ค๐™ž๐™˜๐™š ๐˜พ๐™๐™–๐™ฉ๐™จ ๐˜ผ๐™ซ๐™–๐™ž๐™ก?

Stream Music ๐ŸŽต ๐˜ผ ๐™—๐™ค๐™ฉ ๐™ฉ๐™๐™–๐™ฉ ๐™˜๐™–๐™ฃ ๐™ฅ๐™ก๐™–๐™ฎ ๐™ข๐™ช๐™จ๐™ž๐™˜ ๐™ค๐™ฃ ๐™๐™š๐™ก๐™š๐™œ๐™ง๐™–๐™ข ๐™‚๐™ง๐™ค๐™ช๐™ฅ ๐™–๐™ฃ๐™™ ๐˜พ๐™๐™–๐™ฃ๐™ฃ๐™š๐™ก ๐™‘๐™ค๐™ž๐™˜๐™š ๐˜พ๐™๐™–๐™ฉ๐™จ ๐˜ผ๐™ซ๐™–๐™ž๐™ก?

Sadew Jayasekara 15 Nov 12, 2022
This Is Telegram Music UserBot To Play Music Without Being Admin

This Is Telegram Music UserBot To Play Music Without Being Admin

Krishna Kumar 36 Sep 13, 2022
Scrap electronic music charts into CSV files

musiccharts A small python script to scrap (electronic) music charts into directories with csv files. Installation Download MusicCharts.exe Run MusicC

Dustin Scharf 1 May 11, 2022
This bot can stream audio or video files and urls in telegram voice chats

Voice Chat Streamer This bot can stream audio or video files and urls in telegram voice chats :) ๐ŸŽฏ Follow me and star this repo for more telegram bot

WiskeyWorm 4 Oct 09, 2022
GNOME powered sound conversion

SoundConverter A simple sound converter application for the GNOME environment. It reads anything the GStreamer library can read, and writes Ogg Vorbis

Gautier Portet 188 Dec 17, 2022
cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding for Python

audioread Decode audio files using whichever backend is available. The library currently supports: Gstreamer via PyGObject. Core Audio on Mac OS X via

beetbox 419 Dec 26, 2022
A tool for retrieving audio in the past

Rewinder A tool for retrieving audio in the past. Ever felt like, I need to remember that discussion which happened 10 min back. Now you can! Rewind a

Bharat 1 Jan 24, 2022
Tradutor de um arquivo MIDI para ser usado em um simulador RISC-V(RARS)

Tradutor_MIDI-RISC-V Tradutor de um arquivo MIDI para ser usado em um simulador RISC-V(RARS) *O resultado sai com essa formataรงรฃo: nota,duraรงรฃo,nota,d

Gabriel B. G. 4 Sep 02, 2022
Music player - endlessly plays your music

Music player First, if you wonder about what is supposed to be a music player or what makes a music player different from a simple media player, read

Albert Zeyer 482 Dec 19, 2022
Synthesia but open source, made in python and free

PyPiano Synthesia but open source, made in python and free Requirements are in requirements.txt If you struggle with installation of pyaudio, run : pi

DaCapo 11 Nov 06, 2022
A simple voice detection system which can be applied practically for designing a device with capability to detect a babyโ€™s cry and automatically turning on music

Auto-Baby-Cry-Detection-with-Music-Player A simple voice detection system which can be applied practically for designing a device with capability to d

2 Dec 15, 2021
Scalable audio processing framework written in Python with a RESTful API

TimeSide : scalable audio processing framework and server written in Python TimeSide is a python framework enabling low and high level audio analysis,

Parisson 340 Jan 04, 2023
A simple python script to play bell sound in your system infinitely, just for fun and experimental purposes

A simple python script to play bell sound in your system infinitely, just for fun and experimental purposes

ู†ุงูุน ุงู„ู‡ู„ุงู„ูŠ 1 Oct 29, 2021
Audio pitch-shifting & re-sampling utility, based on the EMU SP-1200

Pitcher.py Free & OS emulation of the SP-12 & SP-1200 signal chain (now with GUI) Pitch shift / bitcrush / resample audio files Written and tested in

morgan 13 Oct 03, 2022
Any-to-any voice conversion using synthetic specific-speaker speeches as intermedium features

MediumVC MediumVC is an utterance-level method towards any-to-any VC. Before that, we propose SingleVC to perform A2O tasks(Xi โ†’ Yฬ‚i) , Xi means utter

่ฐทไธ‹้›จ 47 Dec 25, 2022
A Python wrapper around the Soundcloud API

soundcloud-python A friendly wrapper around the Soundcloud API. Installation To install soundcloud-python, simply: pip install soundcloud Or if you'r

SoundCloud 84 Dec 31, 2022