2

The code below is the import statements I have in the first cell. I am using Python 3 in Jupyter Notebook if that matters

import sys
!python -m pip install --upgrade pip
!pip install --prefix {sys.prefix} pydub
from pydub import AudioSegment
from pydub.utils import db_to_float
AudioSegment.ffmpeg = "Users\Bill\Anaconda3\pkgs\imageio-2.3.0-py36_0\Lib\site-packages\imageio\plugins\ffmeg.py" #this is the edit referred to in the comments

In the next cell, this is the only line of code I have, so it is being called immediately after the imports.

clip = AudioSegment.from_mp3("song1.mp3")

I am getting the following error

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-5-4844ec04b652> in <module>()
----> 1 clip = AudioSegment.from_mp3("song1.mp3")

~\Documents\Fall 2018\Data Vis\Untitled Folder\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)
    717 
    718     @classmethod

~\Documents\Fall 2018\Data Vis\Untitled Folder\pydub\audio_segment.py in from_file(cls, file, format, codec, parameters, **kwargs)
    663             stdin_data = file.read()
    664 
--> 665         info = mediainfo_json(orig_file)
    666         if info:
    667             audio_streams = [x for x in info['streams']

~\Documents\Fall 2018\Data Vis\Untitled Folder\pydub\utils.py in mediainfo_json(filepath)
    261 
    262     command = [prober, '-of', 'json'] + command_args
--> 263     res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
    264     output, stderr = res.communicate(input=stdin_data)
    265     output = output.decode("utf-8", 'ignore')

~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
    707                                 c2pread, c2pwrite,
    708                                 errread, errwrite,
--> 709                                 restore_signals, start_new_session)
    710         except:
    711             # Cleanup if the child failed starting.

~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
    995                                          env,
    996                                          os.fspath(cwd) if cwd is not None else None,
--> 997                                          startupinfo)
    998             finally:
    999                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified

I have double and triple checked and the file name I typed is correct, both the name (song1) and the type (mp3). Thanks in advance!

John Doe
  • 121
  • 1
  • 3
  • 9
  • check path for "song1.mp3". Try giving absolute path. – Anil_M Oct 26 '18 at 15:15
  • I am struggling with the same issue. There are many other posts but none of the solutions, such as adding ffmpeg to the path, or specifying the absolute path, worked for me :( Did you manage to fix it ? – user3451660 Nov 21 '18 at 12:06

1 Answers1

0

Check here for a more in depth explanation, but basically you have changed the absolute path to ffmpeg. The easiest thing to do is delete and reinstall it or change the path pydub uses, as that post suggests.

alvst
  • 95
  • 1
  • 13