I am very new to Pydub library and having trouble with some functionalities.
I'm trying to provide an audio file in same directory to the AudioSegment.from_file() function and it keeps returning this error,
File "c:/Users/Win 10/Desktop/Final Year Project/wav_error_test.py", line 51, in <module>
timestamps = audioClipping(path)
File "c:/Users/Win 10/Desktop/Final Year Project/wav_error_test.py", line 30, in audioClipping
newAudio = AudioSegment.from_mp3(song)
File "C:\Users\Win 10\AppData\Local\Programs\Python\Python37\lib\site-packages\pydub\audio_segment.py", line 796, in from_mp3
return cls.from_file(file, 'mp3', parameters=parameters)
File "C:\Users\Win 10\AppData\Local\Programs\Python\Python37\lib\site-packages\pydub\audio_segment.py", line 728, in from_file
info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
File "C:\Users\Win 10\AppData\Local\Programs\Python\Python37\lib\site-packages\pydub\utils.py", line 274, in mediainfo_json
res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
File "C:\Users\Win 10\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:\Users\Win 10\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
I'm also receiving a run time warning for ffmpeg even after I add it into my PATH,
RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
And finally I'll provide the code snippet.
def audioClipping(song):
AudioSegment.converter = which('ffmpeg')
newAudio = AudioSegment.from_file(song,"mp3")
path ='Viyona - Ranga Weerasekara Ft. Harsha Priyashan.mp3'
timestamps = audioClipping(path)
It would be grate if some one can simply explain what to do here. Thank you