How to use moviepy in replit?

Recently, I was working on a script that gets captions from videos and downloads stock photos based on those captions. I wanted to get the captions, but pvleopard only takes mp3 files, so I tried converting mp4 to mp3 through moviepy. when I imported moviepy, it spat out this error:

RuntimeError: No ffmpeg exe could be found. Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.

I had thought it was a simple issue, so I used git to clone ffmpeg to my project and then use os.environ to set IMAGEIO_FFMPEG_EXE.

However, I couldn’t find FFMPEG.EXE in the source code. I have been digging, And I am still unable to find it.

Here is the repl:

Here is the full code, for anyone wondering (no I have not import pvleopard yet I couldn’t convert mp4)

import pvleopard as pv, moviepy.editor as mpe, os, tqdm as t

os.environ['IMAGEIO_FFMPEG_EXE'] = os.path.join("path", "to", "ffmpeg.exe")
ogVid = input("What video what you like to download stock images for?\n")

  video = mpe.VideoFileClip(os.path.join("path","to", ogVid))"path","to","exportAudio.mp3"))
  print("[ERROR] invalid input")

Odd that it says EXE, as it is not on windows XD

First of all, there is almost never executables in the source code, you usually have to build them yourself. But I think this is all an over-complication. Just add pkgs.ffmpeg-full to replit.nix.
Anytime you want to install something, look to nix first, as it is the default package manger.


thought the same thing lol

I added ffmpeg to nix, but it still won’t work. Is there something I’m doing wrong?

No EXE is the Windows executable. Other operating systems have other executable files. Android, for example, uses APK files.

1 Like

Do you get an error when you run it normally. Eg ffmpeg --help?

This stopped happening when I used an older Python repl, I guess they changed something… for now, just fork this:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.