预期行为: 打开一个没有错误的 mp3
实际行为: 我使用了下面的脚本,
来自pydub 导入音频段
song = AudioSegment.from_mp3("audio.mp3")
并且有一个 JSONDecodeError
JSONDecodeError:期望值:第 1 行第 1 列(字符 0)
JSONDecodeError Traceback (most recent call last)
<ipython-input-3-9e036f9d7b0b> in <module>
6 dst = "research.wav"
7
----> 8 sound = AudioSegment.from_mp3(src)
9 sound.export(dst, format = "wav")
~/opt/anaconda3/lib/python3.8/site-packages/pydub/audio_segment.py in from_mp3(cls, file, parameters)
736 @classmethod
737 def from_mp3(cls, file, parameters=None):
--> 738 return cls.from_file(file, 'mp3', parameters=parameters)
739
740 @classmethod
~/opt/anaconda3/lib/python3.8/site-packages/pydub/audio_segment.py in from_file(cls, file, format, codec, parameters, **kwargs)
683 info = None
684 else:
--> 685 info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
686 if info:
687 audio_streams = [x for x in info['streams']
~/opt/anaconda3/lib/python3.8/site-packages/pydub/utils.py in mediainfo_json(filepath, read_ahead_limit)
277 stderr = stderr.decode("utf-8", 'ignore')
278
--> 279 info = json.loads(output)
280
281 if not info:
~/opt/anaconda3/lib/python3.8/json/__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
355 parse_int is None and parse_float is None and
356 parse_constant is None and object_pairs_hook is None and not kw):
--> 357 return _default_decoder.decode(s)
358 if cls is None:
359 cls = JSONDecoder
~/opt/anaconda3/lib/python3.8/json/decoder.py in decode(self, s, _w)
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
339 if end != len(s):
~/opt/anaconda3/lib/python3.8/json/decoder.py in raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)```