Jay Bell
Jay Bell

Reputation: 457

Python - eyeD3 Lame tag CRC check failed

I am trying to write a script to clean up mp3 file names using Python and eyeD3 but I am getting "WARNING:eyed3.mp3.headers:Lame tag CRC check failed" when I try to load an mp3 file using the following script

import string
import os
import eyed3

count = 0

for root, dirs, filenames in os.walk('path'):
    for song in filenames:
        audiofile = eyed3.load(song)

Because of this I am not able to rename most of the files in my library. Any experience on this subject or a different library to use?

Upvotes: 8

Views: 7337

Answers (8)

Arianit
Arianit

Reputation: 31

found this did the trick for me

eyed3.log.setLevel("ERROR")

Python Eyed3 Warning

Upvotes: 3

Larry Myerscough
Larry Myerscough

Reputation: 1

In my case, the error seemed to be a side effect of 'unwise settings' as suggested above. I had 'recorded' the mp3s from a vinyl record using Audacity and noticed high volume levels on the data. I redid the recording with lower gain. The problem went away!

Upvotes: -1

Rupesh Kapoor
Rupesh Kapoor

Reputation: 1

I was able to suppress this error by doing this:

from logging import getLogger


  # (in main)
  # Suppress WARNINGS generated by eyed3
  getLogger().setLevel('ERROR')

Upvotes: 0

Billy
Billy

Reputation: 607

Saw a couple SO questions without clear answers; this one seems to have the most action. I was experiencing this issue too, but it's clear the error has nothing to do with anyone's particular Python scripting. You can tell by running the command line eyeD3 tool as follow (output abbreviated):

% eyeD3 -v '03 - The Presidents Of The United States Of America - Lump.mp3'
eyed3.mp3.headers:WARNING: Lame tag CRC check failed
.../03 - The Presidents Of The United States Of America - Lump.mp3 [ 5.28 MB ]

ID3 v2.4:
title: Lump
artist: The Presidents Of The United States Of America

You can see more info about the LAME tag this way:

% eyeD3 -P lameinfo '03 - The Presidents Of The United States Of America - Lump.mp3'
eyed3.mp3.headers:WARNING: Lame tag CRC check failed

Encoder Version     : LAME3.82U
LAME Tag Revision   : 10

Music CRC-16        : 5555
LAME Tag CRC-16     : 5555

I haven't really looked into it, but my guess on how it works is that the CRC calculated doesn't match the one in the tag?

Unfortunately I'm not sure how to actually fix the LAME tag with eyeD3 or any other tool. However, what I was able to do fix the warning was re-encode and overwrite the file (on Mac I used the program "Switch Sound File Converter"). The LAME tag seems to be lost in the process (which would make sense since LAME is related to encoding):

% eyeD3 -P lameinfo '03 - The Presidents Of The United States Of America - Lump.mp3'

03 - The Presidents Of The United States Of America - Lump.mp3  [ 5.71 MB ]
-------------------------------------------------------------------------------
No LAME Tag

and

% eyeD3  '03 - The Presidents Of The United States Of America - Lump.mp3'
.../03 - The Presidents Of The United States Of America - Lump.mp3 [ 5.71 MB ]

ID3 v2.3:
title: Lump

And thus the warning goes away (note the change in ID3 tag versions to an older version too...I then used a program called Tagr to update the tags and it wrote back the newest version). I'm currently not sure how else to do it, but I'd love to know if anyone else has ideas on different tools to use or a deeper understanding on how this all works.

Upvotes: 2

Edward Lai
Edward Lai

Reputation: 7

You are accessing/modify files too fast. Faster than it actually loads or close properly. I add a small time sleep during each interval and solves the problem.

import string
import os
import eyed3
import time

count = 0

for root, dirs, filenames in os.walk('path'):
    for song in filenames:
        audiofile = eyed3.load(song)
        time.sleep(0.01)

Upvotes: -1

herve-guerin
herve-guerin

Reputation: 3101

I found a first turnaround to detect those eye3d "errors" sadly sent to stdout : In fact, eyed3 is not as fully dirty as it seems because its errors and in fact log.warnings, so I got those errors by looking at the log in this way : - before eye3d call, I redirect the log to a stringIO - after the eye3d call, I check if this stringIO is still empty (or not)

sample code :

import logging
import io
import eyed3

log_stream = io.StringIO()
logging.basicConfig(stream=log_stream, level=logging.INFO)
audiofile = eyed3.load('myfullfilename')
llog = log_stream.getvalue()
if llog:
    # deal here with the error message which in llog
    # and then purge the log_stream to reuse it for next eye3d call
    log_stream.truncate(0)
# all this code can be improved : enclose it in a try..catch, etc.

Upvotes: 2

Endlisnis
Endlisnis

Reputation: 519

I also get this error on some files, but it's not an actual Python error, it just gets printed to stdout. You can ignore the warning and rename the files in any way you see fit.

Upvotes: 0

David Airapetyan
David Airapetyan

Reputation: 5600

I ran into the same issue, my mp3 file was generated by ffmpeg and had this problem. Also, it didn't have any info set.

I manually (in Windows, using file properties) edited just the title and set it to "X", after which I was able to use the eyed3 without running into the CRC error.

Upvotes: 0

Related Questions