I have seen a few questions about this here, but none of them solved the issue for me, so maybe my case is different in some way.
I am trying to achieve a simple result: read a file and write it. Here is the code:
import os
os.environ['FFMPEG_BINARY'] = '/usr/bin/ffmpeg'
from moviepy.editor import VideoFileClip
name = 'test.mp4'
clip = VideoFileClip('./vids/'+name)
clip.write_videofile('./vids/'+name, codec='libx264', fps=30)
This code comes up with an error:
---> 88 '-r', '%.02f' % fps,
89 '-an', '-i', '-'
90 ]
91 if audiofile is not None:
92 cmd.extend([
93 '-i', audiofile,
94 '-acodec', 'copy'
95 ])
TypeError: must be real number, not NoneType
You may notice that I have set the environment variable for ffmpeg
(I have also changed that in configure_defaults.py
). This is because it was suggested in other questions. Also based on them I have run the following commands before running the code:
sudo apt -y update
sudo apt -y install ffmpeg
pip install decorator
pip install moviepy --upgrade
pip install ffmpeg --upgrade
I am using a Debian GNU/Linux 10 (buster)
machine, and the versions of moviepy
and ffmpeg
are 1.0.3
and 4.1.10-0+deb10u1
respectively.
Nothing seems to be helping to solve this. What am I missing here?