简体   繁体   English

python (moviepy) 中的问题

[英]issue in python (moviepy)

I'm using Moviepy to convert Video, Error occurs while doing that我正在使用 Moviepy 转换视频,执行此操作时发生错误

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):我从您的问题中逐字复制了字符串,文件名末尾有一个额外的不可见字符(在 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尝试运行视频(mp4 文件),如果它工作正常然后尝试

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

or或者

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

or或者

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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