Sanchit Sharma
Sanchit Sharma

Reputation: 17

issue in python (moviepy)

I'm using Moviepy to convert Video, Error occurs while doing that

try to change the file location on every drive but still the issue presists

import moviepy.editor as mp

clip = mp.AudioFileClip("C:\Galaxy S10- OfficialIntroduction.mp4‪").subclip(30,100)

clip.write_audiofile("D:/hello.wav")
C:\Users\sanchit\PycharmProjects\mystartup\venv\Scripts\python.exe "C:/Users/sanchit/PycharmProjects/mystartup/Mp3 TO AUDIO.py"
Traceback (most recent call last):
  File "C:/Users/sanchit/PycharmProjects/mystartup/Mp3 TO AUDIO.py", line 4, in <module>
    clip = mp.AudioFileClip("C:\Galaxy S10- Official Introduction.mp4‪").subclip(30,100)
  File "C:\Users\sanchit\PycharmProjects\mystartup\venv\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 72, in __init__
    buffersize=buffersize)
  File "C:\Users\sanchit\PycharmProjects\mystartup\venv\lib\site-packages\moviepy\audio\io\readers.py", line 50, in __init__
    infos = ffmpeg_parse_infos(filename)
  File "C:\Users\sanchit\PycharmProjects\mystartup\venv\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 274, in ffmpeg_parse_infos
    "path.")%filename)
OSError: MoviePy error: the file C:\Galaxy S10- Official Introduction.mp4‪ could not be found!
Please check that you entered the correct path.

Process finished with exit code 1

Upvotes: 0

Views: 615

Answers (3)

Tayyab Ur Rehman
Tayyab Ur Rehman

Reputation: 1

It looks like the path to your video file might be causing the issue. Here are a few things you can try to fix it:

Double-check the file path: Make sure the file path is correct. It looks like you might have a typo or an extra space in the filename.

Use raw strings or double backslashes: In Python, backslashes are escape characters, so you'll want to either use double backslashes \ or a raw string r"" for the file path.

Upvotes: 0

Aayush Garg
Aayush Garg

Reputation: 11

Try running video(mp4 file), if it works okay then try

(r"C:\Galaxy S10- OfficialIntroduction.mp4‪")

or

("C:\\\Galaxy S10- OfficialIntroduction.mp4‪")

or

("C:/Galaxy S10 OfficialIntroduction.mp4‪")

Upvotes: 0

Roland Smith
Roland Smith

Reputation: 43495

I copied the string verbatim from your question, and there is an extra non-visible character at the end of your filename (examined in Python 3):

In [9]: list((c, ord(c)) for c in
        "C:\Galaxy S10- OfficialIntroduction.mp4‪"[-4:])
Out[9]: [('m', 109), ('p', 112), ('4', 52), ('\u202a', 8234)]

It is the left to right embedding character. It is almost certain that this is not actually part of the filename, hence the error.

Upvotes: 2

Related Questions