spotify-downloader: BUG: Mutagen ID3 No header error
When running the program i get an error from mutagen. I have looked around but could not find any related issues:
> $ spotdl https://open.spotify.com/track/398P1VKJo9gJQFZpY3vt8T?si=e_T_AWLySpGDWMMfV-zSBQ
Fetching Song... 95%|███████████████████████████████████████████████▍ |ETA: 00:00, 0.09min/songTraceback (most recent call last): File "/home/sjoerdhilhorst/.local/bin/spotdl", line 8, in <module> sys.exit(console_entry_point()) File "/home/sjoerdhilhorst/.local/lib/python3.6/site-packages/spotdl/__main__.py", line 100, in console_entry_point downloader.download_single_song(song) File "/home/sjoerdhilhorst/.local/lib/python3.6/site-packages/spotdl/download/downloader.py", line 274, in download_single_song download_song(songObj, self.displayManager, self.downloadTracker) File "/home/sjoerdhilhorst/.local/lib/python3.6/site-packages/spotdl/download/downloader.py", line 170, in download_song audioFile = EasyID3(convertedFilePath) File "/home/sjoerdhilhorst/.local/lib/python3.6/site-packages/mutagen/easyid3.py", line 169, in __init__ self.load(filename) File "/home/sjoerdhilhorst/.local/lib/python3.6/site-packages/mutagen/_util.py", line 185, in wrapper return func(*args, **kwargs) File "/home/sjoerdhilhorst/.local/lib/python3.6/site-packages/mutagen/_util.py", line 156, in wrapper return func(self, h, *args, **kwargs) File "/home/sjoerdhilhorst/.local/lib/python3.6/site-packages/mutagen/id3/_file.py", line 152, in load self._header = ID3Header(fileobj) File "/home/sjoerdhilhorst/.local/lib/python3.6/site-packages/mutagen/_util.py", line 185, in wrapper return func(*args, **kwargs) File "/home/sjoerdhilhorst/.local/lib/python3.6/site-packages/mutagen/id3/_tags.py", line 59, in __init__ raise ID3NoHeaderError("%s: too small" % fn) mutagen.id3._util.ID3NoHeaderError: ./Yotto - Marisa.mp3: too small
Any ideas? i can’t find much documentation on what the cause of this exception is
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 70 (17 by maintainers)
Hello, just so you know, you’re not alone. Just installed the latest release and I’m experiencing exactly the same issue (with an album) on Debian 10 Buster stable on a fresh new VPS.
Issue-Label Bot is automatically applying the label
bugto this issue, with a confidence of 0.98. Please mark this comment with 👍 or 👎 to give our bot feedback!Links: app homepage, dashboard and code for this bot.
Reviewing the code in
download.pyalso reveals a failure to check returns codes from the spawnedffmpegprocess, and that’s the root cause of the problem I’ve encountered. Ifffmpegfails for any reason, the spotDL code will keep on working. If the output file isn’t written, it ends up hanging with 100% CPU usage due the loop I quoted above.For me, the issue is that I’ve got ffmpeg version 7:4.1.6-1 installed. This is the newest official version for the Raspberry Pi:
However, that version doesn’t support the
pad_duroption for theapadfilter. spotDL passes this filter in the chian (asapad=pad_dur=2). ffmpeg fails, that failure isn’t detected; ffmpeg writes a zero-byte output file, spotDL doesn’t care to check, and crashes.Getting a newer version of ffmpeg from
snapexchanges this problem for another issue:because that version doesn’t support the
-abroption. I’ll hve to find a way to get a version compatible with spotDL.Until then, a raw Python stack dump is pretty harrowing for most users. Maybe the spotDL developers will consider any of these suggestions to improve matters for their users:
pad_dursupport was added)pad_durparameter; perhaps with a warning messageprocess.returncodeindownload.pyto see if the spawned process failed or worked; if it fails, do something sensible instead of trying to process a broken output fileffmpegshows the user an actionable error message--debugoption to the script to share more outputReinstalling Python, as recommended above, won’t fix this issue.
Point taken.
Can we close this off? I don’t believe it is an issue with SpotDL to begin with.
@mikeblas There’s no need to be rude and speak down upon the developers who have put hundreds of hours of time into spotDL.
We have had multiple developers look at this issue, as evident by the replies. I implore you to show respect for the work we put in.
I have the same issue and is caused by the same ffmpeg version on Debian 10.
Thanks @mikeblas for the great input. I think that we can apply your suggestions, but that can take some time.
The
await process.communicate()waits for the process to finish, it doesn’t matter that the streams are not piped, this code doesn’t care about them as the output is assigned to_. The only purpose of this code is to hold the execution until the process finish. Thecommunicate()method is better thanwait()as the later deadlocks when streams are piped. I prefer to always usecommunicate()to avoid weird problems in the future if someone will pipe any stream.The while loop, however, is weird. I’ve also got bitten by it - when
ffmpegdidn’t create a file for any reason, the application got stuck. I’m pretty sure we shouldn’t enter this part ifffmpegexits with non-zero code.I don’t know anything about
ffmpeg, but your suggestion to adjust thepad_durparameter makes sense - I’ll let other folks, who knowffmpegbetter decide here.I like the idea of adding
--debugswitch, as it may be very useful in the future.No developer has been able to reproduce this error in recent versions of spotDL.
--no-cache-dirflagCould you open an issue at quodlibet/mutagen? They’re more well versed with the library. It’d be much more simpler that me relaying info b/w you and them