An open API service indexing awesome lists of open source software.

https://github.com/maximelafarie/embed_lyrics

A script to embed lyrics in audio files
https://github.com/maximelafarie/embed_lyrics

audio audio-processing ffmpeg lyrics lyrics-plugin

Last synced: 30 days ago
JSON representation

A script to embed lyrics in audio files

Awesome Lists containing this project

README

          

# embed_lyrics

A zsh script that embeds `.lrc` (synced lyrics) files directly into audio file metadata, in a completely **lossless** way.

Particularly useful for making lyrics compatible with [beets](https://beets.io/) and other tools that don't support standalone `.lrc` files.

---

## Dependencies

- [ffmpeg](https://ffmpeg.org/) — embedding for mp3, m4a, ogg, opus, wav, aiff
- [flac](https://xiph.org/flac/) (`metaflac`) — native lossless embedding for FLAC files

Install via Homebrew:

```zsh
brew install ffmpeg flac
```

---

## Installation

```zsh
chmod +x embed_lyrics.sh
mv embed_lyrics.sh /usr/local/bin/embed_lyrics
```

The script is then available from any directory.

---

## Usage

```zsh
# Current directory (recursive)
embed_lyrics

# Specified directory
embed_lyrics ~/Music
embed_lyrics /Volumes/NAS/Albums
```

---

## Behaviour

The script recursively scans the target directory and, for each audio file found, checks whether a `.lrc` file with the same name exists in the same folder.

```
Artist - Album/
├── 01 - Track.flac ← audio file
├── 01 - Track.lrc ← will be embedded then deleted
├── 02 - Track.flac
└── ... ← no .lrc → silently skipped
```

- ✅ **Successful embed** → the `.lrc` file is deleted
- ❌ **Failure** → the `.lrc` file is kept and an error is displayed

---

## Supported formats

| Format | Method | Re-encoding |
| ---------------- | ------------------------- | ----------- |
| `.flac` | `metaflac` (`LYRICS` tag) | ❌ No |
| `.mp3` | `ffmpeg -c copy` | ❌ No |
| `.m4a` | `ffmpeg -c copy` | ❌ No |
| `.ogg` | `ffmpeg -c copy` | ❌ No |
| `.opus` | `ffmpeg -c copy` | ❌ No |
| `.wav` | `ffmpeg -c copy` | ❌ No |
| `.aiff` / `.aif` | `ffmpeg -c copy` | ❌ No |

Audio quality is **always preserved** — only metadata is modified.

---

## Sample output

```
[INFO] Scanning: /Users/you/Music
[INFO] Embedding: 01 - Song.lrc → 01 - Song.flac
[OK] Done → 01 - Song.flac
[INFO] Embedding: 02 - Other.lrc → 02 - Other.flac
[OK] Done → 02 - Other.flac

[INFO] ────────────────────────────────
[OK] Embedded : 2 file(s)
[INFO] ────────────────────────────────
```