当前位置:网站首页>[moviepy] unable to find a solution for exe

[moviepy] unable to find a solution for exe

2022-07-05 06:21:00 It's time to wake up

Preface

Sometimes use moviepy There are always some strange problems , As in another system :
 Insert picture description here
 Insert picture description here
Cross system operation problems , bring moviepy Called imageio Called imageio_ffmpeg It is considered that there is no installation ffmpeg. Then how to solve it ?

solve

Reading newspapers is wrong :set the _MAGEIO_FFMPEG_EXE environment variable, combination imageio_ffmpeg._util, It was used 4 There are two ways to find ffmpeg:

  1. environment variable
  2. imageio_ffmpeg/binary/ffmpeg.exe
  3. Current directory
  4. System commands ( perform :ffmpeg -version)

that , The solution is simple .

Method 1

import os
path_to_ffmpeg = r""
os.environ["IMAGEIO_FFMPEG_EXE"] = path_to_ffmpeg #  All three systems are like this 
from moviepy import editor # OK!

Method 2( nothing )

Skip find 2, Because packing exe Then it's not suitable

Method 3

Put in the current directory ffmpeg.exe

--program
 |-code.py/exe
 |-ffmpeg.exe

Method 4

install ffmpeg Apply to the system or specify environment variables

::windows Under the batch file  .bat/.cmd
@echo off
echo  Please drag in ffmpeg Where   Folder  :
set /P ffmpeg= Please enter :
echo  About to join ffmpeg:%ffmpeg% Agree, please click any key .
pause
set path=%ffmpeg%;%path%

You can use this bat Set system environment variables in batch file

result

 Insert picture description here

ffmpeg download

Official website :http://ffmpeg.org/
Pconline: x64x86 This is a 3.1
among pconline Of ffmpeg as long as /bin/ffmpeg.exe A file ( about 36mb) That's it

summary

Learn to read newspaper errors and source code

This article is from CSDN On 20222/13 14:23

原网站

版权声明
本文为[It's time to wake up]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140614346204.html