Cutting out a portion of video - python
Try this and tell us if it is faster (if it can, it will extract the video directly using ffmpeg, without decoding and reencoding):
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclipffmpeg_extract_subclip("video1.mp4", start_time, end_time, targetname="test.mp4")
If that doesn't help, have a look at the code
If you are new to moviepy you should follow these steps.
Installation :
pip install --trusted-host pypi.python.org moviepypip install imageio-ffmpeg
Installation (in your virtualenv) version for old systems :
pip install --trusted-host pypi.python.org moviepypythonimport imageioimageio.plugins.ffmpeg.download()
After these commands, you have the minimal software requirements.
Usage
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip# ffmpeg_extract_subclip("full.mp4", start_seconds, end_seconds, targetname="cut.mp4")ffmpeg_extract_subclip("full.mp4", 60, 300, targetname="cut.mp4")