Python:FileNotFoundError:[WinError 2]系统找不到指定的文件

2024-10-02 02:39:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我对python有一点经验,我目前正尝试通过这个guide通过pix2pix生成一些机器学习视频

我目前正处于需要从视频中提取帧的位置。我使用的是同一个视频,但为了方便起见,我将它移到了与extract_frames.py相同的目录中

我一直收到WinError 2:系统找不到指定的文件:

C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD>python extract_frames.py -video fire.mp4 -name fire_dataset -p2pdir . -width 1280 -height 736
creating the dataset structure
ffmpeg -v 16 -i C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD\fire.mp4 -q:v 2 -vf "scale=iw*736/ih:736, crop=1280:736" C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD/datasets/fire_dataset/train_frames/frame-%06d.jpg -hide_banner
extracting the frames
Traceback (most recent call last):
  File "C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD\extract_frames.py", line 32, in <module>
    video_utils.extract_frames_from_video(
  File "C:\Users\cadou\OneDrive\Desktop\ml\pix2pixHD\video_utils.py", line 82, in extract_frames_from_video
    p = subprocess.Popen(shlex.split(command), shell=False)
  File "C:\Users\cadou\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\cadou\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

我查找了这个错误并尝试了一些方法,但似乎没有一种方法能解决我的问题。我怀疑这与路径有关,但我也尝试过改变这一点。我还安装了教程中要求的所有库(dominate、ffmpeg和pyTorch)


Tags: inpyframes视频videolineextractonedrive
2条回答

您可以尝试以下命令,将“fire.mp4”替换为“/fire.mp4”

python extract_frames.py -video ./fire.mp4 -name fire_dataset -p2pdir . -width 1280 -height 736

Erorr不显示找不到的文件

也许它找不到fire.mp4,但我想它需要ffmpeg来提取视频


我在video_utils.py中检查了subprocess的源代码,它运行ffmpeg,所以您需要从https://ffmpeg.org/安装它

它可能还需要更改video_utils.py并使用C:\full\path\to\ffmpeg.exe

还有Ubuntu字体的硬编码路径(在两个地方:请参见code),这表明此代码是为Linux Ubuntu创建的。此路径还需要更改Windows上的其他字体

相关问题 更多 >

    热门问题