Skip to main content

Program to extract metadata using Hachoir library

Project description

hachoir-metadata extracts metadata from multimedia files: music, picture, video, but also archives. It supports most common file formats:

  • Archives: bzip2, gzip, zip, tar
  • Audio: MPEG audio (“MP3”), WAV, Sun/NeXT audio, Ogg/Vorbis (OGG), MIDI, AIFF, AIFC, Real audio (RA)
  • Misc: Torrent
  • Program: EXE
  • Video: ASF format (WMV video), AVI, Matroska (MKV), Quicktime (MOV), Ogg/Theora, Real media (RM)

It tries to give as much information as possible. For some file formats, it gives more information than libextractor for example, such as the RIFF parser, which can extract creation date, software used to generate the file, etc. But hachoir-metadata cannot guess informations. The most complex operation is just to compute duration of a music using frame size and file size.

hachoir-metadata has three modes:

  • classic mode: extract metadata, you can use –level=LEVEL to limit quantity of information to display (and not to extract)
  • –type: show on one line the file format and most important informations
  • –mime: just display file MIME type

The command ‘hachoir-metadata –mime’ works like ‘file –mime’, and ‘hachoir-metadata –type’ like ‘file’. But today file command supports more file formats then hachoir-metadata.



Example on AVI video (RIFF file format):

$ hachoir-metadata pacte_des_gnous.avi
- Duration: 4 min 25 sec
- Comment: Has audio/video index (248.9 KB)
- MIME type: video/x-msvideo
- Endian: Little endian
Video stream:
- Image width: 600
- Image height: 480
- Bits/pixel: 24
- Compression: DivX v4 (fourcc:"divx")
- Frame rate: 30.0
Audio stream:
- Channel: stereo
- Sample rate: 22.1 KHz
- Compression: MPEG Layer 3

Modes –mime and –type

Option –mime ask to just display file MIME type (works like UNIX “file –mime” program):

$ hachoir-metadata --mime logo-Kubuntu.png sheep_on_drugs.mp3 wormux_32x32_16c.ico
logo-Kubuntu.png: image/png
sheep_on_drugs.mp3: audio/mpeg
wormux_32x32_16c.ico: image/x-ico

Option –file display short description of file type (works like UNIX “file” program):

$ hachoir-metadata --type logo-Kubuntu.png sheep_on_drugs.mp3 wormux_32x32_16c.ico
logo-Kubuntu.png: PNG picture: 331x90x8 (alpha layer)
sheep_on_drugs.mp3: MPEG v1 layer III, 128.0 Kbit/sec, 44.1 KHz, Joint stereo
wormux_32x32_16c.ico: Microsoft Windows icon: 16x16x32

Similar projects

A lot of other libraries are written to read and/or write metadata in MP3 music and/or EXIF photo.

hachoir-metadata 1.3.3 (2010-07-26)

  • Support WebM video (update Matroska extractor)
  • Matroska parser extracts audio bits per sample

hachoir-metadata 1.3.2 (2010-02-04)

  • Include hachoir_metadata/qt/ in
  • ignores pyuic4 error if is present
  • installs hachoir_metadata.qt module

hachoir-metadata 1.3.1 (2010-01-28)

  • compiles dialog.ui to and install hachoir-metadata-qt. Create –disable-qt option to skip hachoir-metadata-qt installation.
  • Create a file to include extra files like ChangeLog, AUTHORS, gnome and kde subdirectories,, etc.

hachoir-metadata 1.3 (2010-01-20)

  • Create hachoir-metadata-qt: a graphical interface (Qt toolkit) to display files metadata
  • Create ISO9660 extractor
  • Hide Hachoir warnings by default (use –verbose to show them)
  • hachoir-metadata program: create –force-parser option to choose the parser

hachoir-metadata 1.2.1 (2008-10-16)

  • Using –raw, strings are not normalized (don’t strip trailing space, new line, nul byte, etc.)
  • Extract much more informations from Microsoft Office documents (.doc, .xsl, .pps, etc.)
  • Improve OLE2 (Word) extractor
  • Fix ASF extractor for hachoir-parser 1.2.1

hachoir-metadata 1.2 (2008-09-03)

  • Create –maxlen option for hachoir-metadata program: –maxlen=0 disable the arbitrary string length limit
  • Create FLAC metadata extractor
  • Create hachoir_metadata.config, especially MAX_STR_LENGTH option (maximum string length)
  • GIF image may contains multiple comments

hachoir-metadata 1.1 (2008-04-01)

  • More extractors are more stable and fault tolerant
  • Create basic Gtk+ GUI: hachoir-metadata-gtk
  • Catch error on data conversion
  • Read width and height DPI for most image formats
  • JPEG (EXIF): read GPS informations
  • Each data item can has its own “setter”
  • Add more ID3 keys (TCOP, TDAT, TRDA, TORY, TIT1)
  • Create datetime filter supporting timezone
  • Add “meters”, “pixels”, “DPI” suffix for human display
  • Create SWF extractor
  • RIFF: read also informations from headers field, compute audio compression rate
  • MOV: read width and height
  • ASF: read album artist

hachoir-metadata 1.0.1 (???)

  • Only use hachoir_core.profiler with –profiler command line option so ‘profiler’ Python module is now optional
  • Set shebang to “#!/usr/bin/python”

hachoir-metadata 1.0 (2007-07-11)

  • Real audio: read number of channel, bit rate, sample rate and compute compression rate
  • JPEG: Read user commment
  • Windows ANI: Read frame rate
  • Use Language from hachoir_core to store language from ID3 and MKV
  • OLE2 and FLV: Extractors are now fault tolerant

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hachoir-metadata, version 1.3.3
Filename, size File type Python version Upload date Hashes
Filename, size hachoir_metadata-1.3.3-py2.4.egg (96.3 kB) File type Egg Python version 2.4 Upload date Hashes View
Filename, size hachoir_metadata-1.3.3-py2.5.egg (94.8 kB) File type Egg Python version 2.5 Upload date Hashes View
Filename, size hachoir_metadata-1.3.3-py2.6.egg (94.7 kB) File type Egg Python version 2.6 Upload date Hashes View
Filename, size hachoir-metadata-1.3.3.tar.gz (52.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page