thebigmunch / audio-metadata

A library for reading and, in the future, writing audio metadata. https://audio-metadata.readthedocs.io/
https://forum.thebigmunch.me
MIT License
53 stars 11 forks source link

"Missing XING header and insufficient MPEG frames" #6

Closed ghost closed 4 years ago

ghost commented 4 years ago

Using 'gms down -v --debug --log-to-file '%albumartist%/%album%/%track2% - %title%'' to create local backup of files, but am currently receiving the following error (note that ~1000 files were successfully downloaded already in a fresh backup):

[2019-07-14 03:36:04] Downloading 18376 songs from Google Music
Traceback (most recent call last):
  File "/usr/local/bin/gms", line 10, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.6/dist-packages/google_music_scripts/cli.py", line 920, in run
    DISPATCH[command](args)
  File "/usr/local/lib/python3.6/dist-packages/google_music_scripts/commands.py", line 221, in do_download
    download_songs(mm, to_download, template=args.output)
  File "/usr/local/lib/python3.6/dist-packages/google_music_scripts/core.py", line 36, in download_songs
    tags = audio_metadata.loads(audio).tags
  File "/usr/local/lib/python3.6/dist-packages/audio_metadata/api.py", line 103, in loads
    return parser_cls.load(b)
  File "/usr/local/lib/python3.6/dist-packages/audio_metadata/formats/mp3.py", line 519, in load
    self.streaminfo = MP3StreamInfo.load(self._obj)
  File "/usr/local/lib/python3.6/dist-packages/audio_metadata/formats/mp3.py", line 406, in load
    raise InvalidFormat("Missing XING header and insufficient MPEG frames.")
audio_metadata.exceptions.InvalidFormat: Missing XING header and insufficient MPEG frames.

I have the latest audio-metadata (Requirement already up-to-date: audio-metadata in /usr/local/lib/python3.6/dist-packages (0.4.0)) and latest google-music-scripts (Requirement already up-to-date: google-music-scripts in /usr/local/lib/python3.6/dist-packages (4.0.1))

Thanks!

thebigmunch commented 4 years ago

This is likely solved in git master. Test out with pip install -U git+https://github.com/thebigmunch/audio-metadata.

ghost commented 4 years ago

Unfortunately this is still happening after doing sudo -H python3 -m pip install -U git+https://github.com/thebigmunch/audio-metadata to get in sync with git master. I did a pip uninstall of audio-metadata too, couple reboots, and a dash of reinstall google-music-scripts for fun too. I do receive 'ERROR: google-music 3.0.1 has requirement audio-metadata<0.4,>=0.3, but you'll have audio-metadata 0.4.0 which is incompatible.' upon running sudo -H python3 -m pip install -U git+https://github.com/thebigmunch/audio-metadata, but have also done sudo -H python3 -m pip install -U git+https://github.com/thebigmunch/google-music-scripts and receive the same error upon reinstall of audio-metadata.

Same error. Same amount of files. No change in the log except the times.

thebigmunch commented 4 years ago

Alright, just got a bunch of new releases out. Try it out with pip install -U google-music-scripts and let me know what happens.

ghost commented 4 years ago

Still occurring on 4.1.1. Same amount of files. Slightly different errors:

[2019-07-28 19:14:21] Found 18376 songs to download [2019-07-28 19:14:21] Downloading songs from Google Music Traceback (most recent call last): File "/usr/local/bin/gms", line 10, in sys.exit(run()) File "/usr/local/lib/python3.6/dist-packages/google_music_scripts/cli.py", line 968, in run args.func(args) File "/usr/local/lib/python3.6/dist-packages/google_music_scripts/commands.py", line 240, in do_download download_songs(mm, to_download, template=args.output) File "/usr/local/lib/python3.6/dist-packages/google_music_scripts/core.py", line 44, in download_songs tags = audio_metadata.loads(audio).tags File "/usr/local/lib/python3.6/dist-packages/audio_metadata/api.py", line 145, in loads return parser_cls.load(b) File "/usr/local/lib/python3.6/dist-packages/audio_metadata/formats/mp3.py", line 536, in load self.streaminfo = MP3StreamInfo.load(self._obj) File "/usr/local/lib/python3.6/dist-packages/audio_metadata/formats/mp3.py", line 427, in load frames = cls.find_mp3_frames(data) File "/usr/local/lib/python3.6/dist-packages/audio_metadata/formats/mp3.py", line 416, in find_mp3_frames raise InvalidFormat("Missing XING header and insufficient MPEG frames.") audio_metadata.exceptions.InvalidFormat: Missing XING header and insufficient MPEG frames.

thebigmunch commented 4 years ago

Yeah. The new MPEG frame detection should only fail if no MPEG frames are found or only 1 MPEG frame is found but it's not a XING/LAME frame. Potentially, it could be a VBRI frame, but unlikely. If it is, I'd love to get it to test with.

You'd be looking for a very small file. You can also try running this in the directory to get a listing of files that audio-metadata can't load.

ghost commented 4 years ago

I ran that script within the download directory that contains the ~1000 files already grabbed, but there was no output.

Is there a way to see what songs are being downloaded first for me to grab that file?

thebigmunch commented 4 years ago

Sorry, I forgot that this was happening on download. So, you wouldn't have the failing song locally. There isn't currently a way to see what songs are being downloaded. You could add a print call in the download_songs function. Or, as I said, it should be a song that is less than a second long to get that error.

thebigmunch commented 4 years ago

Alright, so I re-added progress messages to downloading/uploading in google-music-scripts at the trace log level. You can pip install -U git+https://github.com/thebigmunch/google-music-scripts and run the command with -vvvv to see which song is being downloaded.

ghost commented 4 years ago

Awesome! That worked to find the offending song. It appears the song must be corrupt. It does not play on Google Music and even after downloading the file through Google Music and trying to play with VLC there is nothing. Google Music shows it at 00:38 in length but actual song length should be 05:33. At least now I know what is the problem thanks to you. I tracked down the original file through an old backup and that one does not play either.

You seriously provide the best support though! Thank you for all the help. Let me know if there is anything you might need from me to provide to you. Thanks again.