简体   繁体   中英

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

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.

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‪")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM