Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert video on python to .mp4 without ffmpeg?

I need to convert videos to .mp4 format I used to ffmpeg but it converts for too long. Is there are a way to convert video to .mp4 in python without ffmpeg?

like image 372
Max Avatar asked Aug 04 '19 05:08

Max


People also ask

How do you change the format of a video in Python?

Project description. Video Converter is a Python 3 (>= 3.7) module for converting video files from one format and codec to another. It uses the FFmpeg multimedia framework for actual file processing, and adds an easy-to-use API for probing and converting media files on top of it.

Does FFmpeg work with MP4?

FFmpeg can input most container formats natively, including MP4, . ts, MOV, AVI, Y4M, MKV, and many others. This is the output file. No switch necessary; just the file name.


1 Answers

UPD moviepy depends on ffmpeg too (

==

Zulko/moviepy

pip install MoviePy
import moviepy.editor as moviepy
clip = moviepy.VideoFileClip("myvideo.avi")
clip.write_videofile("myvideo.mp4")

As per MoviePy documentation, there is no ffmpeg dependencies:

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 (for tracking, segmenting, etc.) can be used to resize video clips if PIL and OpenCV are not installed.
  • Scikit Image may be needed for some advanced image manipulation.
  • OpenCV 2.4.6 or a more recent version (one that provides the package cv2) may be needed for some advanced image manipulation.
  • Matplotlib
like image 95
Yasen Avatar answered Nov 08 '22 07:11

Yasen