---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
<ipython-input-10-87da299a1c3c> in <module>
1 from pydub import AudioSegment
----> 3 song = AudioSegment.from_mp3(r"test2.mp3")
C:\ProgramData\Anaconda3\lib\site-packages\pydub\audio_segment.py in from_mp3(cls, file, parameters)
714 @classmethod
715 def from_mp3(cls, file, parameters=None):
--> 716 return cls.from_file(file, 'mp3', parameters=parameters)
718 @classmethod
C:\ProgramData\Anaconda3\lib\site-packages\pydub\audio_segment.py in from_file(cls, file, format, codec, parameters, **kwargs)
663 stdin_data = file.read()
--> 665 info = mediainfo_json(orig_file)
666 if info:
667 audio_streams = [x for x in info['streams']
C:\ProgramData\Anaconda3\lib\site-packages\pydub\utils.py in mediainfo_json(filepath)
266 stderr = stderr.decode("utf-8", 'ignore')
--> 268 info = json.loads(output)
270 if not info:
C:\ProgramData\Anaconda3\lib\json\__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
346 parse_int is None and parse_float is None and
347 parse_constant is None and object_pairs_hook is None and not kw):
--> 348 return _default_decoder.decode(s)
349 if cls is None:
350 cls = JSONDecoder
C:\ProgramData\Anaconda3\lib\json\decoder.py in decode(self, s, _w)
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
339 if end != len(s):
C:\ProgramData\Anaconda3\lib\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
Your System configuration
Python version: 3.7.4
Pydub version: 0.23.1
ffmpeg or avlib?: ffmpeg
ffmpeg/avlib version: 1.4
try to run ffmpeg
in terminal
mine issue was
dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi.6.dylib
Running brew doctor
I saw that fontconfig
wasn't linked, after linking it everything was working
I also am having a lot of problems with this. I'm not able to run FFmpeg in the terminal on a mac because I can't find it. I have downloaded it with brew, but after that I don't know where it goes. When I look for it with the spotlight all I get is some ffmpeg in python folders. I have also tried brew doctor
and then linking some things but that did not work.
I got it working. In short, it is an ffmpeg problem not a pydub problem. I had to reinstall ffmpeg not once but twice and it took a lot of work to get it to work and I've forgotten how I did it. In any case, if you can get this line in Terminal to work ffmpeg -i input.mp3 output.avi
then pydub should work.
Solved for MacOS using Anaconda3 by downloading ffmpeg and and ffprobe binaries from https://ffbinaries.com/downloads and putting them in my "usr/anaconda3/bin" folder (this directory primarily has executable files). I think the issue occurred because even though I had uninstalled and reinstalled pydub and ffmpeg several times, it was still running an old version of the executables that I had installed from a year ago!