我在Pycharm中运行 ffmpeg库 以下代码时出现错误
import ffmpeg
stream = ffmpeg.input('test.mp4')
stream = ffmpeg.hflip(stream)
stream = ffmpeg.output(stream, 'output.mp4')
ffmpeg.run(stream)
报错内容为
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-9-b00e1570ddae> in <module>()
4 # stream = ffmpeg.hflip(stream)
5 stream = ffmpeg.output(stream, 'output.mp4')
----> 6 ffmpeg.run(stream)
F:\Anaconda3\lib\site-packages\ffmpeg\_run.py in run(stream_spec, cmd, capture_stdout, capture_stderr, input, quiet, overwrite_output)
318 pipe_stderr=capture_stderr,
319 quiet=quiet,
--> 320 overwrite_output=overwrite_output,
321 )
322 out, err = process.communicate(input)
F:\Anaconda3\lib\site-packages\ffmpeg\_run.py in run_async(stream_spec, cmd, pipe_stdin, pipe_stdout, pipe_stderr, quiet, overwrite_output)
283 stderr_stream = subprocess.PIPE if pipe_stderr or quiet else None
284 return subprocess.Popen(
--> 285 args, stdin=stdin_stream, stdout=stdout_stream, stderr=stderr_stream
286 )
287
F:\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
707 c2pread, c2pwrite,
708 errread, errwrite,
--> 709 restore_signals, start_new_session)
710 except:
711 # Cleanup if the child failed starting.
F:\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
995 env,
996 os.fspath(cwd) if cwd is not None else None,
--> 997 startupinfo)
998 finally:
999 # Child is launched. Close the parent's copy of those pipe
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
以上报错主要可以看最后一句:FileNotFoundError: [WinError 2] 系统找不到指定的文件。
在模块安装正确的情况下,应该是电脑本地没有安装 ffmpeg软件 ,可以搜索 Windows下安装ffmpeg的教程,也可以直接参考以下链接:
How to Install FFmpeg on Windows - Adaptive Samples (gregzaal.com)http://blog.gregzaal.com/how-to-install-ffmpeg-on-windows/Windows 10系统下安装FFmpeg教程详解_超级小的大西瓜的博客-CSDN博客_windows安装ffmpeghttps://blog.csdn.net/qq_59636442/article/details/124526107另外ffmpeg函数库的安装可以参考以下文章:文章来源:https://www.toymoban.com/news/detail-412726.html
报错:module ffmpeg has no attribute input 解决方法_KD_LW的博客-CSDN博客https://blog.csdn.net/KD_LW/article/details/112842968希望对大家有所帮助!文章来源地址https://www.toymoban.com/news/detail-412726.html
到了这里,关于在pycharm中使用ffmpeg库报错:FileNotFoundError: [WinError 2] 系统找不到指定的文件 的解决方案的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!