Python directly operates ffmpeg, no need to download from the official website!
I. Introduction
When you want to use ffmpeg for processing, you don’t want to go to the official website to download ffmpeg and then add it to the environment variable before using it. After some research, it can be solved by the following method
imageio_ffmpeg + subprocess
2. Specific steps
1. Environment configuration
pip install imageio_ffmpeg #Automatically download the corresponding ffmpeg according to the system
pip install subprocess #Python subprocess execution
2. Specific test procedures
import subprocess
import imageio_ffmpeg
compress = "{} -i video2.mkv -r 24 -vcodec h264 video2_new22.mp4".format(imageio_ffmpeg.get_ffmpeg_exe())
f = subprocess.Popen(compress)
3. Operation effect
Final effect: no system restrictions, no additional installation required, compression requirements realized