Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎵 MP3 Tag Reader and Editor

A command-line tool written in C that reads and edits ID3v2 metadata tags in MP3 files — Title, Artist, Album, Year, Genre, and Composer — without touching the audio data.

Built as part of the Emertxe Advanced C / Embedded Systems training (Skill India / NSDC — QP ELE/Q1501).


📌 What Are ID3v2 Tags?

MP3 files store metadata in a structured header called ID3v2, located at the beginning of the file. Each piece of metadata is stored in a frame with a 4-byte ID:

Frame ID Metadata
TIT2 Title
TPE1 Artist
TALB Album
TYER Year
TCON Genre
TCOM Composer

Each frame has: 4-byte Frame ID + 4-byte Size + 2-byte Flags + 1-byte Encoding + Text data.


✨ Features

  • View all ID3v2 metadata tags from any MP3 file
  • Edit any individual tag (Title, Artist, Album, Year, Genre, Composer)
  • Auto-creates a backup before editing (filename_backup.mp3)
  • Safe editing via temporary file — audio data is never touched
  • Input validation with detailed error messages
  • Help menu (--help)

🗂️ Project Structure

MP3-Tag-Reader-Editor/
├── main.c        → CLI argument parsing, operation dispatcher
├── view.c        → ID3v2 header parsing and tag display
├── view.h        → View function declarations
├── edit.c        → Frame editing with temp file and backup
├── edit.h        → Edit function declarations
├── operations.c  → Shared utility functions
├── operations.h  → Shared function declarations
├── sample.mp3    → Sample MP3 file for testing
└── Makefile

⚙️ Build & Run

Compile

make

View tags

./mp3tag -v sample.mp3

Edit a tag

./mp3tag -e -t "New Title"    sample.mp3   # Edit Title
./mp3tag -e -a "New Artist"   sample.mp3   # Edit Artist
./mp3tag -e -A "New Album"    sample.mp3   # Edit Album
./mp3tag -e -y "2025"         sample.mp3   # Edit Year
./mp3tag -e -m "New Genre"    sample.mp3   # Edit Genre
./mp3tag -e -c "New Composer" sample.mp3   # Edit Composer

Help

./mp3tag --help

📋 Sample Output

View

-----SELECTED VIEW DETAILS-------
MP3 TAG READER AND EDITOR FOR ID3V2
Title    : Sunny Sunny
Artist   : Yo Yo Honey Singh
Album    : Yaariyan
Year     : 2013
Genre    : Bollywood Music - [SongsPk.CC]
Composer : Downloaded From SongsPk.CC

Edit

-----SELECTED EDIT OPERATION-----
Backup created: sample.mp3_backup.mp3
Editing TIT2...
Tag updated successfully!

--------UPDATED MP3 DETAILS--------
Title    : New Title
Artist   : Yo Yo Honey Singh
Album    : Yaariyan
Year     : 2013

🧠 Key Concepts Used

  • Binary File I/Ofopen("rb"/"wb"), fread, fwrite, fseek for precise byte-level MP3 parsing
  • ID3v2 Frame Parsing — reading 4-byte frame IDs and sizes from binary header
  • Safe File Editing — write to temp.mp3, then replace original; backup created before any change
  • Command-line Argumentsargc/argv with flag parsing (-v, -e, -t, --help)
  • Modular Design — view.c / edit.c / operations.c with separate headers
  • String Functionsstrcmp, strncmp, strcpy for frame ID matching

⚠️ Limitations

  • Supports ID3v2.3 only (not ID3v1 or ID3v2.4)
  • Text encoding assumed to be ISO-8859-1 (encoding byte = 0x00)
  • Edit rewrites all 6 supported frames — unsupported frames are preserved but not parsed
  • No support for multi-value tags (e.g., multiple artists)

👩‍💻 Author

Suchithra S
B.E. ECE — Gopalan College of Engineering & Management, VTU (2025)
Advanced Embedded Systems Training — Emertxe Information Technologies, Bengaluru
GitHub: github.com/suchithrasr
LinkedIn: linkedin.com/in/suchithrasr

About

MP3 ID3v2 tag reader and editor in C — view and edit Title, Artist, Album, Year, Genre, Composer using binary file parsing.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages