Python is based on imageio_ffmpeg and directly operates ffmpeg, no need to download it from the official website!

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
Insert image description here

Guess you like

Origin blog.csdn.net/qq_51116518/article/details/134969173