# Output ID3 tags from a group of MP3 files as a CSV file

I would like to export all ID3 tags (both ID3v1 and ID3v2) in a group of MP3 files as a CSV file or something similar. I currently use Mp3tag for tagging, but its export feature requires that I specify which tags I want to export; I'd simply like to export all tags that exist (and ideally only those that exist) in any of the MP3 files (including user-defined "TXXX" tags). For "APIC" tags storing embedded images, it would be enough to output that the tag exists (or even better, a count of the number of embedded images).

I'm using Microsoft Windows and I'm looking for a freeware solution. I'm happy to use command-line tools (indeed I often prefer them).

Thanks

I would suggest taking a look at EyeD3 which is both a command line tool and a python library for doing exactly the sort of thing that you are looking for. On it's own it will do a lot of what you need - with a trivial python script it should be able to do exactly what you are looking for using pythons built in csv library.

Both EyeD3 and python are free, cross platform and command line.

First install python on your system then use pip install eyeD3 to get EyeD3.

## For Future Reference, (captured from comments):

The OP being more experienced in Perl than Python used the perl MP3::Tag library to perform the task, there are also similar libraries for a number of other languages, e.g. taglib-ruby

• Just to follow up - I wasn't able to get EyeD3 working - I've no Python experience. But you did give me the idea to try it with Perl, with which I have more experience. I used the Perl module MP3::Tag and wrote my own script, which I now have up and running outputting the information I need. – osullic Jul 2 '15 at 10:45
• @osullic, Given that the perl MP3::Tag solved your issue, and this answer pushed you in the right direction, I would suggest accepting it as your answer. Alternatively, you could do a self-answer and accept that. – holroy Aug 30 '15 at 23:27

# Command Line tools to batch output ID3 tags

Here is my collection of ID3 tag viewers. I collected them over the last couple of months for another project I'm currently working on. You can manipulate the PowerShell script to process as many files as you want. But for easier understanding I demonstrated it with a single input file in a first step.

• Pro: shows all tags including non-standard ones
• Contra: no cover dimensions
• Pro: shows all tags including non-standard ones
• Contra: no cover dimensions
• Pro: shows all tags including non-standard ones, shows cover dimensions
• Contra: Cannot read Comment tag
• Pro: shows all tags including non-standard ones, shows cover dimensions
• Contra: Cannot read Comment tag
• Pro: shows all tags including non-standard ones, shows cover dimensions
• Contra: Cannot read Comment tag
• Pro: shows all tags including non-standard ones
• Contra: no cover dimensions
• Pro: shows all tags including non-standard ones
• Contra: no cover dimensions
• Pro: shows all tags including non-standard ones
• Contra: shows TXXX tags without contents
• Contra: no TXXX tags
• Pro: Shows TXXX and replay_gain tags
• Contra: no Album, Genre, Comment tags
• Original source is down. I uploaded a backup
• Pro: Shows TXXX and replay_gain tags
• Contra: no Album, Genre, Comment tags
• You need do download 2 additional DLL files and place them in the same folder as sox.exe
• Contra: no Albumartist, Composer, Performer, Comment or TXXX tags
• Contra: no ID3V2 tags at all

The following Powershell scripts demonstrates the most useful syntax for each tool to only view ID3 tags. You have to download all tools and change all paths in the script, or course.

### Syntax

# Choose mp3 file to view ID3 tags from
$input = "D:\_input\musicfile.mp3"$outDir    = "D:\_output"

$taglib = "D:\tag-lib\taglib-sharp.dll"$exiftool  = "D:\exiftool\exiftool.exe"
$ffprobe = "D:\ffmpeg\ffprobe.exe"comment)$ffmpeg    = "D:\ffmpeg\ffmpeg.exe"
$handbrake = "D:\handbrake\handbrakeCLI.exe"$mediainfo = "D:\MediaInfo\MediaInfo.exe"
$metamp3 = "D:\metamp3\metamp3.exe"$gettags   = "D:\gettags\gettags_mingw.exe"
$tagger = "D:\Tagger\TaggerSharp.exe"$mpgtx     = "D:\mpgtx\mpgtx.exe"
$tag = "D:\Tag\Tag.exe"$sox       = "D:\sox\sox.exe"
$mp3info = "D:\mp3info\mp3info.exe" # Load taglib library, read ID3 tags and save output to specified folder [void][system.reflection.assembly]::loadfile($taglib)
$media = [taglib.MPEG.file]::create($input)
[TagLib.Id3v2.Tag] $Id3v2 =$media.GetTag([TagLib.TagTypes]::Id3v2)
$Id3v2.GetFrames() | Out-File "$outDir\taglib.txt"

# Run all external CMD utilities and save their output to specified folder
& $exiftool -ee -e -a -f -g1 -s$input 2>&1                       | Out-File "$outDir\exiftool.txt" &$ffprobe -loglevel quiet -show_streams -show_format -print_format flat=h=1 $input 2>&1 | Out-File "$outDir\ffprobe.txt"
[string](& $ffmpeg -hide_banner -i$input -f NULL nul 2>&1 )       | Out-File "$outDir\ffmpeg.txt" [string](&$handbrake -v0 --scan --input $input 2>&1) | Out-File "$outDir\handbrake.txt"
& $mediainfo --full$input 2>&1                                    | Out-File "$outDir\mediainfo.txt" &$metamp3 --info $input 2>&1 | Out-File "$outDir\metamp3.txt"
& $gettags$input 2>&1                                             | Out-File "$outDir\gettags.txt" &$tagger $input 2>&1 | Out-File "$outDir\tagger.txt"
(& $mpgtx -i$input 2>&1 ) -replace "0"                           | Out-File "$outDir\mpgtx.txt" &$tag --test $input 2>&1 | Out-File "$outDir\tag.txt"
& $sox --info$input 2>&1                                          | Out-File "$outDir\sox.txt" &$mp3info $input 2>&1 | Out-File "$outDir\mp3info.txt"


My personal favorite is taglib-sharp since it outputs the most information. After it comes ExifTool and ffprobe

• I think this answer is better than selected one. The only thing, that I'm missing here is any example to actually answer the question -- i.e. command-line syntax to actually put ID3 tags of many files into .csv file. While you're showing off a large variety of tools, that can be used to solved given problem, you seems to be focusing to dumping ID3 tags as a command-line output. IMHO, your answer would be really valuable, if it had at least one example of dumping ID3 tag data into .csv` file. But thanks, anyway, for all the effort. Pity, that I can vote up this answer only once. – trejder Nov 26 '15 at 21:46

I am a little late to the game but my answer may help someone else.

I think that you are selling Mp3tag a little short for this task. Its export function is quite robust and will allow you to create almost any text-based format you choose: html, xml, csv, tsv, and json to state a few.

For example, I use the following to dump all fields from all files on a per album basis. Go to File > Export > New (button) > enter a meaningful name > replace the standard with the following:

$filename(%_folderpath%__Tags, All.txt,utf-8)$loop(%_path%)^%_parent_directory%|%_directory%|$regexp($list(,:'',''|),\r\n,U+000DU+000A)$char(13)$char(10)\$loopend() Created: %_datetime%

Select the "one file per directory" checkbox and run. You will get a csv with pipe "|" as the delimiter in each directory processed. And one may process thousands of directories in one go.