quodlibet / mutagen

Python module for handling audio metadata
https://mutagen.readthedocs.io
GNU General Public License v2.0
1.54k stars 158 forks source link

mutagen.mp3.HeaderNotFoundError: can't sync to MPEG frame #562

Open ChickenNugget25 opened 2 years ago

ChickenNugget25 commented 2 years ago

I've done a little bit of searching on this error and I found that it's thrown when the .mp3 file passed is corrupted or 'not a real mp3' The .mp3 that's throwing the error is one I made with the package pyttsx3, and it runs fine through windows media player, but still has the error. What should I do?

Ocean-Spud commented 2 years ago

I'm glad someone else had this problem, I did a little debugging and it looks like mutagen only supports a handful of mp3 formats. pyttsx3 writes its mp3 files in pcm_s16le format, but mutagen can't read that. Right now, the best thing to do is use FFMPEG's tools for this or use .wav files. But I'd love to see this problem fixed in the future.

lazka commented 2 years ago

An example file would be helpful to debug this.

QY-Y commented 2 years ago

Hi, I have the same problem processing the meta info this file. I m Coming Home .zip

 from mutagen.mp3 import MP3
 return MP3(path)

0220905155106

Tailslide commented 1 year ago

I ran into this one as well.

Pimool commented 11 months ago

Don't know why it happens, but I solved it out with ffmpeg.

ffmpeg -i a.mp3 b.mp3 

Putting b.mp3 didn't have any problem for my case.

Mohammad9760 commented 7 months ago

hi! I ran into this problem. I have a script downloading mp3 files and since the script is not running on my machine it's preferred that I don't re-encode it (I can do it only with a portable ffmpeg build, but that is ~80mb that I don't want to have where my script is hosted). is there a workaround for this?

Mohammad9760 commented 7 months ago

is there a way to fix this or should I try to fix the problem from the other end (the part of my script that downloads mp3s)