Fix MP3 Files Without Tags or Covers Using Just Two Prompts (Windows PC Required)
If your MP3 files have missing tags and album covers, you can organize your music collection using ChatGPT (Codex), and Mp3tag for free.
(Time Management: Get started in under 15 Minutes, let the ai do the rest)
Let's get started!
Step 1: Install Mp3tag for free
Download Mp3tag from its official website:
https://www.mp3tag.de/en/download.html
Install the program on your Windows PC.
Step 2: Open Mp3tag and load your music files
Open Mp3tag and add the folder containing your music files. You should now see your music collection in the program.
Step 3: Edit the Title and Artist fields
Edit the Title and Artist fields for your music files. I used the free Musixmatch app for this step
where you can use the recognition function.
These two fields help Codex identify the correct songs and research the missing information later.
Step 4: Install ChatGPT and Codex for free
Download the official ChatGPT (including Codex) desktop app here:
Step 5: Open Codex and create a new project
Open the ChatGPT desktop app, switch to Codex, and create a new project.
Step 6: Open your music folder
Select the folder containing your music files as the project folder. Make sure you select the correct folder.
Step 7: Enter Prompt 1 and wait for Codex to finish
Copy the entire prompt below into a new Codex chat. Codex will research missing tags, write the information into your music files, and verify the results.
PROMPT 1: Automatically Research and Fill in Missing Music Tags
Task: Automatically Research and Fill in Missing Music Tags
Work directly in the backup music folder currently open in your working environment. Determine the actual folder path yourself. Do not create another backup folder.
Goal
Process all music files in the folder and fill in the following missing tags:
- Album Artist
- Album
- Track
- Disc Number
- Year
- Genre
Research
Use the regular internet and all browser and search tools that are actually available.
Search for matching information using the existing "Title" and "Artist" fields. Use multiple sources, such as Google, Bing, YouTube, Spotify, Apple Music, MusicBrainz, Discogs, and artist or album pages.
If a source is unavailable, switch to another one. Do not stop because of a failed API request or DNS problem.
Plausible matches are acceptable even if every detail cannot be confirmed with absolute certainty. If no exact match can be found, use the best plausible match. Leave values empty only when no reasonable information can be found with an appropriate amount of effort.
Do not invent track numbers or disc numbers. Only use these values when they belong to a plausible release.
Tag Rules
- Never modify "Title".
- Never modify "Artist".
- Modify only the six fields listed above.
- Never overwrite existing values in these six fields.
- Do not rename, move, or delete any files.
- Do not convert audio files.
- Write the researched values directly into the music files so that Mp3tag can recognize them afterward.
Autonomous Execution
Do not merely generate another report and wait for my approval.
Process the entire collection automatically in reasonable batches. Research the information, write the tags, and verify every processed file afterward. If one method fails, try another available method.
Continue until all files have been checked and all missing tags that can reasonably be determined have been filled in. Do not stop after processing only a few files just because some songs are more difficult to identify.
Create a final report containing the following information:
- Number of files checked
- Number of files actually modified
- Which tags were added
- Which fields remain empty
- Which files could not be matched confidently
- Confirmation that "Title" and "Artist" remained unchanged
Save the report to "C:\Backup 2\music_metadata_results.csv", provided that the path is available.
Final Verification
The primary objective is to write the missing tags into the actual music files. A report alone does not count as successful completion.
After writing the tags, reopen or reread the modified files and verify that the changes were saved correctly. Confirm that existing tag values were preserved and that "Title" and "Artist" remain unchanged.
Do not claim that changes were saved until they have been verified.
The Prompt ends here
Step 8: Want to add album covers as well?
You can do that in two simple steps. First, check that the required tools are installed. Then give Codex the second prompt to find and embed covers directly into your music files.
Step 9: Open PowerShell on your computer and run this environment check
Open a PowerShell terminal and paste the following code. It checks whether Python, Mutagen, Pillow, Requests, and FFmpeg are available.
$Host.UI.RawUI.WindowTitle = "Environment Check"
$items = @(
@{ Name = "Python"; Type = "Python" }
@{ Name = "Mutagen"; Type = "Module"; Module = "mutagen" }
@{ Name = "Pillow"; Type = "Module"; Module = "PIL" }
@{ Name = "Requests"; Type = "Module"; Module = "requests" }
@{ Name = "FFmpeg"; Type = "Command"; Command = "ffmpeg" }
)
$results = @{}
# Check Python
try {
py --version *> $null
$results["Python"] = ($LASTEXITCODE -eq 0)
} catch {
$results["Python"] = $false
}
# Check Python packages
foreach ($item in $items | Where-Object { $_.Type -eq "Module" }) {
py -c "import $($item.Module)" 2>$null
$results[$item.Name] = ($LASTEXITCODE -eq 0)
}
# Check FFmpeg
$results["FFmpeg"] = [bool](Get-Command ffmpeg -ErrorAction SilentlyContinue)
# Display results
Clear-Host
Write-Host ""
Write-Host "==================================================" -ForegroundColor DarkCyan
Write-Host " ENVIRONMENT STATUS" -ForegroundColor Cyan
Write-Host "==================================================" -ForegroundColor DarkCyan
Write-Host ""
foreach ($item in $items) {
$name = $item.Name
if ($results[$name]) {
$status = "(installed)"
$color = "Green"
} else {
$status = "(not installed)"
$color = "Red"
}
Write-Host (" {0,-12}" -f $name) -NoNewline -ForegroundColor White
Write-Host $status -ForegroundColor $color
}
Step 10: Install anything that is missing
Check the results displayed in your terminal. If a component is marked as (not installed), use the corresponding command below.
1. Python
winget install --id Python.Python.3.14 -e
2. Mutagen
py -m pip install --upgrade mutagen
3. Pillow
py -m pip install --upgrade pillow
4. Requests
py -m pip install --upgrade requests
5. FFmpeg
winget install --id Gyan.FFmpeg.Shared -e
Run the environment check again after installing the missing components. If you install Python, you may need to restart PowerShell before checking it again.
Step 11: Open Codex again and enter Prompt 2
Once the required tools are installed, open Codex, select the folder containing your music files and their existing tags, and start a new chat inside that project.
Copy and paste the complete prompt below. Codex will search for suitable covers, embed them directly into your existing music files, and verify the results.
PROMPT 2: Complete Album Cover Automation for My Music Collection
PROJECT: Complete Album Cover Automation for My Music Collection
Objective
Develop and execute a working Python program that examines all music files in my provided backup folder, searches for a suitable cover for every song, and embeds the image directly into the existing music file.
At the end, my music folder must contain exactly the same files and subfolders as before the program started. The only intended permanent changes are the newly embedded cover images inside the existing music files.
No additional files, scripts, images, backups, logs, or temporary files created by the program may remain in the music folder after completion.
My music is already backed up elsewhere. Do not create any additional backups.
1. Mandatory Rules
- Use Python.
- Use free libraries and free online services.
- Do not use paid APIs or subscriptions.
- Do not create ".bak" files or additional backups.
- Modify only cover-related tags inside the existing music files.
- Do not modify titles, artists, albums, track numbers, disc numbers, years, genres, comments, lyrics, or any other metadata.
- Do not convert the audio data or change the sound quality.
- Do not rename any existing files.
- Do not delete any existing music files.
- Do not create separate cover image files inside the music folder.
- Do not store reports or scripts in the music folder.
- Remove all temporary files created by the program after completion.
- Never claim that a file was successfully processed if verification has not succeeded.
2. Identify the Working Folder
Work exclusively in the music folder provided in my Codex environment.
First, determine and display the complete folder path.
If multiple possible music folders exist or the correct folder cannot be identified unambiguously, ask me for the correct path before modifying any files.
Never automatically use a folder from previous chats or projects.
Before processing, create an inventory of all existing files and subfolders. Keep this inventory in the program's memory or store it outside the music folder.
Use this inventory to verify at the end that no additional files have been left behind in the music folder.
3. Examine the Music Files First
Search the selected folder and all its subfolders for existing music files.
Examine at least MP3 files. Identify other existing audio formats, such as M4A, FLAC, OGG, or WAV, and process them only if embedding the cover can be performed reliably without re-encoding or changing any other existing metadata.
Read the available information for every file:
- Title
- Artist
- Album
- Album Artist
- File format
- Existing embedded images
- Whether an existing cover can be read successfully
Create a clear inventory and display it in the Codex output. Do not write an inventory file into the music folder.
If a file already contains a valid cover, leave it unchanged. If an existing cover is obviously damaged or unreadable, you may attempt to replace only that cover with a verified new image.
4. Free Online Research
For every song without a valid embedded cover, search for the most accurate matching album cover available.
Prefer the following sources:
- MusicBrainz to identify the album or specific release.
- Cover Art Archive to retrieve the corresponding cover.
- Other reputable, free sources if the first sources do not provide a suitable cover.
Use the existing tags as the basis for your searches whenever possible.
If a search fails, try multiple approaches:
- Artist and album
- Title and artist
- Artist, album, and release year, if available
- Specific releases, singles, or album editions
- Alternative spellings and sensible search variations
If multiple files belong to the same album, reuse a previously verified cover instead of repeating the same research for every song.
Follow the terms of use and request limits of the services you use. For MusicBrainz, use a descriptive User-Agent and make no more than one request per second.
Do not use paid APIs or services that require paid API keys.
5. Select the Correct Covers
The objective is to embed the most accurate cover for every song. Do not simply accept the first search result.
Whenever possible, verify:
- Whether the artist and album match
- Whether the release is correct
- Differences between the original album, single, remix, live version, and deluxe edition
- Image quality and readability
- Whether the image is actually the front cover rather than an artist photograph, logo, back cover, or booklet page
Prefer the official front cover of the matching release.
If a result is questionable, continue searching. Do not use unrelated images and present them as official covers.
If complete metadata is unavailable, use the existing information and filename as additional search clues. Do not modify the existing text tags during this process.
6. No Song Should Be Left Without an Embedded Image
Systematically try additional free search methods for every song without a cover.
If no official cover can be found, the program may generate its own visually appealing replacement cover as a last resort. Use a free Python library such as Pillow for this purpose.
A replacement cover must:
- Be square.
- Display the existing title and artist, if available.
- Be visually appealing and readable.
- Be clearly identifiable as a replacement cover.
- Never be presented as an official album cover.
Prefer graphics generated locally over paid AI services or external APIs.
Use replacement covers only for files for which no suitable official image can be found despite thorough searching.
The correct, genuine album cover always takes priority.
If a file cannot be processed technically, for example because its format is damaged or its tags are unreadable, explicitly document the exception. Do not claim that every song was successfully processed if this is not true.
7. Python Program and Libraries
For MP3 files, preferably use Mutagen to modify the embedded cover tags directly.
Use Pillow only for image processing and generating local replacement covers when necessary.
Other libraries may be used if they are free and genuinely required.
The program must:
- Have a clear and understandable structure.
- Handle errors affecting individual files.
- Handle network errors and missing search results.
- Avoid installing unnecessary dependencies.
- Recognize files that have already been processed.
- Support resuming after interruptions whenever possible, without unnecessary repeated modifications.
Install any required Python libraries exclusively outside the music folder.
Store the Python source code, virtual environments, and other project files outside the music folder. Use the project directory provided by Codex or another suitable directory outside the target folder.
8. Modify Only the Embedded Cover Inside Existing Music Files
Embed the images directly into the existing files.
For MP3 files, store the image as an embedded front cover, for example, using an ID3 APIC frame with the appropriate image type and MIME type.
Pay particular attention to preserving existing metadata:
- Do not modify tags other than the necessary cover tags.
- Do not rewrite existing text tags.
- Do not delete any tags.
- Preserve the existing ID3 version whenever possible.
- Do not re-encode audio data.
- Do not rename files.
- Do not unnecessarily replace existing valid covers.
If a library cannot reliably preserve all other tags unchanged for a particular file, do not use it for that file without further verification.
Whenever possible, the program should add only the missing cover tag instead of rewriting all metadata.
9. No Additional Files in the Music Folder
This is an especially important requirement.
The music folder must contain only the files and subfolders that were already present at the beginning. Their original filenames and folder structure must remain unchanged.
The only permitted changes are the intended modifications inside existing music files, particularly embedding a cover.
Never create the following inside the music folder:
- ".py" files
- ".bak" files
- JPG or PNG files
- CSV or TXT reports
- JSON files
- Temporary music files
- Cache files
- Helper folders
- Additional backup copies
If images must be downloaded for embedding, use a temporary directory outside the music folder.
At the end, remove all temporary images, downloads, and other files created by the program. Also clean up any temporary working directories created by the program itself.
Do not save permanent reports to disk. Display all results directly in the Codex output.
Important: Never delete a file that existed in the target folder before work began. Remove only temporary files that can be positively identified as having been created by the program itself.
10. Careful Processing
Start with the first music file in alphabetical order by relative file path.
If it already contains a valid cover, skip it without making any changes.
If a cover is missing, research the appropriate image, embed it, and verify the result.
Once this process has been successfully tested and verified, process the rest of the collection using the same procedure. Do not ask for confirmation again for every song.
Process files individually and inspect each file immediately after modifying it.
Do not create backups. My collection is already backed up elsewhere, and I deliberately do not want additional copies.
Do not modify files outside the selected working folder, except for necessary temporary files and project code stored outside the target folder.
11. Verify Every Processed File
After each modification, the program must check:
- Is the cover embedded directly inside the music file?
- Is it identifiable as the front cover?
- Can the image be read back from the file?
- Are the title, artist, and album unchanged?
- Is all other existing metadata unchanged?
- Has the audio data remained unmodified and un-re-encoded?
- Can the music file still be opened correctly?
- Has no new file been left behind in the music folder?
Compare all non-cover tags before and after processing. Use appropriate verification methods to determine whether the compressed audio data remains unchanged.
If a modification cannot be verified successfully, mark the file as problematic and report it. Do not claim successful completion without the corresponding verification.
12. Final Inspection of the Entire Folder
After processing, examine all original music files again.
For every file, verify whether a readable embedded cover is present.
Also inspect the directory contents:
- Compare the original file inventory with the final directory contents.
- Ensure that no files or folders added by the program remain.
- Verify that no original file was accidentally deleted or renamed.
- Remove only temporary files that can be positively identified as having been created by the program.
- Do not delete files that existed before work began.
If the directory structure no longer matches the original state, investigate the cause and correct it whenever this can be done safely without losing original files.
13. Final Report Directly in Codex
After completion, display a summary directly in the Codex output. Do not create files in the music folder for this report.
Include:
- Total number of music files
- Number of files that already had a valid cover
- Number of newly embedded official covers
- Number of locally generated replacement covers
- Number of files that still have no cover
- Number of files with technical problems
- Results of the checks on all other metadata
- Results of the audio data verification
- Results of the directory comparison
List every file for which a valid cover could not be embedded and explain the specific reason.
If every music file contains an embedded cover, confirm this only if the final verification actually proves it.
14. Begin Work Now
Begin with the following steps:
- Unambiguously identify the working folder.
- Create the initial inventory.
- Examine the first music file.
- Search online for the appropriate cover using free sources.
- Embed the image directly into the existing file.
- Verify the first result.
- Process all remaining files.
- Perform the complete final verification and cleanup.
Actually work in the available Codex environment. Do not merely create a theoretical plan. If permissions are missing or a technical problem occurs, explain the specific cause instead of pretending the task succeeded.
The final contents of the music folder must consist exclusively of the original files and subfolders, with existing music files modified only as necessary to embed the covers.
The Prompt ends here
Final Result
After Codex has finished working and you have followed all the steps, you should have a folder containing your original music files, with the correct tags and an embedded cover for each song wherever the process succeeded.
I hope this guide helped you and that everything went as quickly as expected!
Top comments (1)
Very helpful. It worked very easily 😁 Thanks!