I am trying to use python to convert files from mp4 to mp3. After some research most places recommend moviepy. I used the command pip install moviepy
and it seemed to go off without a hitch. I go to VS Code and enter what a youtube video told me to enter (I know its not recommended to do that, I just wanted to see if it would work). This is what I have
#This code should convert a .mp4 file into a .mp3 file
#This imports the moviepy package
from moviepy.editor import *
#here are the names of my files (I have subbed out actual files names)
mp4_file = "file_name.mp4"
mp3_file = "file_name.mp3
#Here is the the audio being stripped from the .mp4 file
video_clip = VideoFileClip(mp4_file)
audio_clip = video_clip.audio
#this is writing the audio to a .mp3 file at the path that is specified.
audio_clip.write_audiofile(mp3_file)
#this closes the conversion code
audio_clip.close()
VideoClip.close()
After running the code I get this error:
RuntimeError: No ffmpeg exe could be found. Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
There is a bunch of gibberish above it but that is the final line that gets spit out.
After looking up what the issue is I tried to input:
from moviepy.config import change_settings
change_settings({"FFMPEG_BINARY": "/usr/bin/ffmpeg"})
And it also did not work. I have tried searching for where ffmpeg is and it is not in /usr/bin/ffmepg
or /usr/local/bin/ffmpeg
like most sources I have looked at tell me it should be.
I have tried installing ffmpeg on its own by doing pip install ffmpeg
and 'brew install ffmpeg'. Both of those go off without a hitch as well but the error still pops.
I am using a macbook air m1 and I have I think everything I need installed already so I am so lost on what is causing this error to pop.
Can someone please help?
I have tried installing ffmpeg on its own as well as searching for the file directly.
I should expect to get the .py file to run fine.
I instead get the error seen above:
RuntimeError: No ffmpeg exe could be found. Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.