如何在不使用 ffmpeg 的情况下将 python 上的视频转换为 .mp4?
How to convert video on python to .mp4 without ffmpeg?
我需要将视频转换为我以前使用 ffmpeg 的 .mp4 格式,但转换时间太长。 python 有没有办法在没有 ffmpeg 的情况下将视频转换为 .mp4?
UPD moviepy
也取决于 ffmpeg
(
==
pip install MoviePy
import moviepy.editor as moviepy
clip = moviepy.VideoFileClip("myvideo.avi")
clip.write_videofile("myvideo.mp4")
根据 MoviePy
文档,没有 ffmpeg
依赖项:
MoviePy depends on the Python modules Numpy, imageio, Decorator, and tqdm, which will be automatically installed during MoviePy's installation.
ImageMagick is not strictly required, but needed if you want to incorporate texts. It can also be used as a backend for GIFs, though you can also create GIFs with MoviePy without ImageMagick.
PyGame is needed for video and sound previews (not relevant if you intend to work with MoviePy on a server but essential for advanced video editing by hand).
For advanced image processing, you will need one or several of the following packages:
- The Python Imaging Library (PIL) or, even better, its branch Pillow.
- Scipy(用于跟踪、分割等)如果未安装 PIL 和 OpenCV,可用于调整视频剪辑的大小。
- Scikit Image 可能需要一些高级图像处理。
- OpenCV 2.4.6 或更新的版本(提供包
cv2
的版本)可能需要某些高级图像处理。
- Matplotlib
我需要将视频转换为我以前使用 ffmpeg 的 .mp4 格式,但转换时间太长。 python 有没有办法在没有 ffmpeg 的情况下将视频转换为 .mp4?
UPD moviepy
也取决于 ffmpeg
(
==
pip install MoviePy
import moviepy.editor as moviepy
clip = moviepy.VideoFileClip("myvideo.avi")
clip.write_videofile("myvideo.mp4")
根据 MoviePy
文档,没有 ffmpeg
依赖项:
MoviePy depends on the Python modules Numpy, imageio, Decorator, and tqdm, which will be automatically installed during MoviePy's installation.
ImageMagick is not strictly required, but needed if you want to incorporate texts. It can also be used as a backend for GIFs, though you can also create GIFs with MoviePy without ImageMagick.
PyGame is needed for video and sound previews (not relevant if you intend to work with MoviePy on a server but essential for advanced video editing by hand).
For advanced image processing, you will need one or several of the following packages:
- The Python Imaging Library (PIL) or, even better, its branch Pillow.
- Scipy(用于跟踪、分割等)如果未安装 PIL 和 OpenCV,可用于调整视频剪辑的大小。
- Scikit Image 可能需要一些高级图像处理。
- OpenCV 2.4.6 或更新的版本(提供包
cv2
的版本)可能需要某些高级图像处理。 - Matplotlib