尝试读取M4B文件时诱变引发错误

时间:2019-09-21 19:28:21

标签: python mutagen

这是我关于SO的第一篇文章。我正在尝试在Python 3上使用Mutagen读取m4b文件。这是我正在使用的代码。

for file in os.listdir(workingdir):
    if file.endswith('.m4b'):
      workingdirectory = 'my/directory/'
      commandtoexecute = ""
      metadata = MP4(file)
      print('read')
      xa9ART1 = metadata['\xa9ART']
      xa9nam1 = metadata['\xa9nam']
      xa9alb1 = metadata['\xa9alb']

这是我得到的错误,

Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\mutagen\mp4\_as_entry.py", line 183, in _parse_esds
    decSpecificInfo = ES_Descriptor.parse(fileobj)
  File "C:\Python37\lib\site-packages\mutagen\mp4\_as_entry.py", line 240, in parse
    instance = cls(fileobj, length)
  File "C:\Python37\lib\site-packages\mutagen\mp4\_as_entry.py", line 278, in __init__
    self.decConfigDescr = DecoderConfigDescriptor.parse(fileobj)
  File "C:\Python37\lib\site-packages\mutagen\mp4\_as_entry.py", line 240, in parse
    instance = cls(fileobj, length)
  File "C:\Python37\lib\site-packages\mutagen\mp4\_as_entry.py", line 315, in __init__
    self.decSpecificInfo = DecoderSpecificInfo.parse(fileobj)
  File "C:\Python37\lib\site-packages\mutagen\mp4\_as_entry.py", line 243, in parse
    raise DescriptorError("descriptor parsing read too much data")
mutagen.mp4._as_entry.DescriptorError: descriptor parsing read too much data

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\mutagen\mp4\__init__.py", line 1014, in _parse_stsd
    entry = AudioSampleEntry(entry_atom, entry_fileobj)
  File "C:\Python37\lib\site-packages\mutagen\mp4\_as_entry.py", line 79, in __init__
    self._parse_esds(extra, fileobj)
  File "C:\Python37\lib\site-packages\mutagen\mp4\_as_entry.py", line 185, in _parse_esds
    raise ASEntryError(e)
mutagen.mp4._as_entry.ASEntryError: descriptor parsing read too much data

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\aud.py", line 944, in <module>
    my_function()
  File "C:\Users\Administrator\Desktop\aud.py", line 336, in create_rar
    metadata = MP4(file)
  File "C:\Python37\lib\site-packages\mutagen\_file.py", line 49, in __init__
    self.load(*args, **kwargs)
  File "C:\Python37\lib\site-packages\mutagen\_util.py", line 140, in wrapper
    return func(self, h, *args, **kwargs)
  File "C:\Python37\lib\site-packages\mutagen\mp4\__init__.py", line 1061, in load
    self.info.load(atoms, fileobj)
  File "C:\Python37\lib\site-packages\mutagen\_util.py", line 169, in wrapper
    return func(*args, **kwargs)
  File "C:\Python37\lib\site-packages\mutagen\mp4\__init__.py", line 976, in load
    self._parse_stsd(atom, fileobj)
  File "C:\Python37\lib\site-packages\mutagen\mp4\__init__.py", line 1016, in _parse_stsd
    raise MP4StreamInfoError(e)
mutagen.mp4.MP4StreamInfoError: descriptor parsing read too much data

我已经在几种音频上尝试过几次,但是对我来说似乎卡住了。我很高兴从这里获得帮助。

谢谢。

0 个答案:

没有答案