Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in
start(fakepyfile,mainpyfile)
File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
exec(open(mainpyfile).read(), main.dict)
File "", line 2, in
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/moviepy/editor.py", line 36, in
from .video.io.VideoFileClip import VideoFileClip
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/moviepy/video/io/VideoFileClip.py", line 3, in
from moviepy.audio.io.AudioFileClip import AudioFileClip
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/moviepy/audio/io/AudioFileClip.py", line 3, in
from moviepy.audio.AudioClip import AudioClip
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/moviepy/audio/AudioClip.py", line 7, in
from moviepy.audio.io.ffmpeg_audiowriter import ffmpeg_audiowrite
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/moviepy/audio/io/ffmpeg_audiowriter.py", line 7, in
from moviepy.config import get_setting
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/moviepy/config.py", line 36, in
FFMPEG_BINARY = get_exe()
^^^^^^^^^
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/imageio/plugins/ffmpeg.py", line 173, in get_exe
return imageio_ffmpeg.get_ffmpeg_exe()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/imageio_ffmpeg/_utils.py", line 33, in get_ffmpeg_exe
raise RuntimeError(
RuntimeError: No ffmpeg exe could be found. Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
[Program finished]
Assistant
The error you're encountering indicates that the moviepy library requires the ffmpeg executable to process video and audio files, but it cannot locate it on your system. Since you're using Pydroid3 on an Android device, you'll need to manually install ffmpeg and configure it so that moviepy can access it. Here's a step-by-step guide to resolving this issue:
1. Download a Prebuilt FFmpeg Binary for Android
First, you need to obtain a version of ffmpeg that's compatible with your Android device.
Download the static build suitable for your device's architecture (most modern devices use ARM64). For example, download a file named similar to ffmpeg-release-full.7z.
2. Extract the FFmpeg Executable
Android doesn't natively support .7z files, so you'll need an app to extract it.
Recommended App: ZArchiver (available on the Google Play Store)
Steps to Extract:
Install ZArchiver from the Google Play Store.
Open ZArchiver and navigate to the downloaded .7z file.
Extract the contents to a directory accessible by Pydroid3, such as /sdcard/Download/ffmpeg/.
After extraction, ensure you have the ffmpeg executable file.
3. Move FFmpeg to a Accessible Location
For better accessibility, move the ffmpeg executable to a directory within Pydroid3's workspace.
Steps:
Open Pydroid3.
Use the built-in File Manager or a third-party file manager to navigate to the extracted ffmpeg executable.
Move ffmpeg to a directory like:
code
/data/user/0/ru.iiec.pydroid3/files/
Note: Accessing this directory might require allowing storage permissions.
4. Grant Execute Permissions to FFmpeg
Android requires executables to have execute permissions.
Using Pydroid3's Terminal:
Open Pydroid3.
Open the Terminal (accessible via the menu).
Navigate to the directory where you placed ffmpeg. For example:
sh
cd /data/user/0/ru.iiec.pydroid3/files/
Change the permissions to make it executable:
sh
chmod +x ffmpeg
If you encounter permission issues, ensure that Pydroid3 has the necessary permissions or consider placing ffmpeg in a more accessible directory like /sdcard/Download/ffmpeg/.
5. Configure the Environment Variable in Your Python Script
To let imageio (used by moviepy) know where to find the ffmpeg executable, set the IMAGEIO_FFMPEG_EXE environment variable in your script before importing moviepy.
python
import os
# Replace with the actual path to your ffmpeg executable
os.environ["IMAGEIO_FFMPEG_EXE"] = "/data/user/0/ru.iiec.pydroid3/files/ffmpeg"
from moviepy.editor import VideoFileClip
# ... rest of your code ...
Ensure that the path you provide points directly to the ffmpeg executable.
6. Verify the Installation
To confirm that ffmpeg is correctly installed and accessible:
Open Pydroid3's terminal.
Run:
sh
ffmpeg -version
If correctly set up, this should display the installed ffmpeg version information.
7. Alternative: Use imageio_ffmpeg's Built-in Download (If Supported)
Some versions of imageio_ffmpeg can automatically download the appropriate ffmpeg binary.
Steps:
Ensure that imageio_ffmpeg is up-to-date:
sh
pip install --upgrade imageio_ffmpeg
In your Python script, you can attempt to retrieve the ffmpeg path automatically:
python
import imageio_ffmpeg as ffmpeg
ffmpeg_path = ffmpeg.get_ffmpeg_exe()
os.environ["IMAGEIO_FFMPEG_EXE"] = ffmpeg_path
from moviepy.editor import VideoFileClip
# ... rest of your code ...
Run your script. If imageio_ffmpeg successfully downloads the binary, this method will work without manual installation.
Note: Given the error you encountered, manual installation as described in steps 1-5 is the more reliable method.
Summary
Download a compatible ffmpeg binary for Android.
Extract and place the executable in an accessible directory.
Grant execute permissions to the ffmpeg file.
Set the IMAGEIO_FFMPEG_EXE environment variable in your Python script to point to the ffmpeg executable.
Verify the installation to ensure everything works correctly.
By following these steps, moviepy should be able to locate and utilize ffmpeg, resolving the RuntimeError you encountered.
If you continue to face issues, consider checking the following:
Permissions: Ensure Pydroid3 has the necessary permissions to access the directory where ffmpeg is located.
Path Accuracy: Double-check the path provided to IMAGEIO_FFMPEG_EXE is correct and points directly to the ffmpeg executable.
Architecture Compatibility: Ensure that the ffmpeg binary matches your device's architecture (most likely ARM64).
Feel free to reach out if you need further assistance!