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
Port Hitsuboku Kumi Chinese CVVC voicebank to deepvocal. / 筆墨クミDeepvocal中文音源

Hitsuboku Kumi (筆墨クミ) is a UTAU virtual singer developed by Cubialpha. This project ports Hitsuboku Kumi Chinese CVVC voicebank to deepvocal. This is the first open-source deepvocal voicebank on Gith

8 Apr 26, 2022
A lightweight yet powerful audio-to-MIDI converter with pitch bend detection

Basic Pitch is a Python library for Automatic Music Transcription (AMT), using lightweight neural network developed by Spotify's Audio Intelligence La

Spotify 1.4k Jan 01, 2023
🎵 A music bot for discord servers!

music bot A music bot for Discord Servers Features Play songs in your discord server Get the lyrics without going on a web explorer Commands Command P

1 Jul 25, 2022
An AI for Music Generation

An AI for Music Generation

Hao-Wen Dong 1.3k Dec 31, 2022
An app made in Python using the PyTube and Tkinter libraries to download videos and MP3 audio.

yt-dl (GUI Edition) An app made in Python using the PyTube and Tkinter libraries to download videos and MP3 audio. How do I download this? Windows: Fi

1 Oct 23, 2021
Gradient - A Python program designed to create a reactive and ambient music listening experience

Gradient is a Python program designed to create a reactive and ambient music listening experience.

Alexander Vega 2 Jan 24, 2022
Use android as mic/speaker for ubuntu

Pulse Audio Control Panel Platforms Requirements sudo apt install ffmpeg pactl (already installed) Download Download the AppImage from release page ch

19 Dec 01, 2022
This is an AI that runs in the terminal. It is a voice assistant that can do common activities and can also help in your coding doubts like

This is an AI that runs in the terminal. It is a voice assistant that can do common activities and can also help in your coding doubts like

OneBit 1 Nov 05, 2021
AudioDVP:Photorealistic Audio-driven Video Portraits

AudioDVP This is the official implementation of Photorealistic Audio-driven Video Portraits. Major Requirements Ubuntu = 18.04 PyTorch = 1.2 GCC =

232 Jan 03, 2023
Audio book player for senior visually impaired.

PI Zero W Audio Book Motivation and requirements My dad is practically blind and at 80 years has trouble hearing and operating tiny or more complicate

Andrej Hosna 29 Dec 25, 2022
live coding in python + supercollider

live coding in python + supercollider

Zack 6 Feb 06, 2022
DeepMusic is an easy to use Spotify like app to manage and listen to your favorites musics.

DeepMusic is an easy to use Spotify like app to manage and listen to your favorites musics. Technically, this project is an Android Client and its ent

Labrak Yanis 1 Jul 12, 2021
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
Python game programming in Jupyter notebooks.

Jupylet Jupylet is a Python library for programming 2D and 3D games, graphics, music and sound synthesizers, interactively in a Jupyter notebook. It i

Nir Aides 178 Dec 09, 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
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
gentle forced aligner

Gentle Robust yet lenient forced-aligner built on Kaldi. A tool for aligning speech with text. Getting Started There are three ways to install Gentle.

1.2k Dec 30, 2022
MusicBrainz Picard

MusicBrainz Picard MusicBrainz Picard is a cross-platform (Linux/Mac OS X/Windows) application written in Python and is the official MusicBrainz tagge

MetaBrainz Foundation 3k Dec 31, 2022
A voice control utility for Spotify

Spotify Voice Control A voice control utility for Spotify · Report Bug · Request

Shoubhit Dash 27 Jan 01, 2023
🎵 A repository for manually annotating files to create labeled acoustic datasets for machine learning.

🎵 A repository for manually annotating files to create labeled acoustic datasets for machine learning.

Jim Schwoebel 28 Dec 22, 2022