Installation configuration and Python call of ffmpeg under win10 system
foreword
ffmpeg is an open source program for converting digital audio/video. It supports many types of files, and can be operated independently through the GUI interface, or invoked through the command line.
In deep learning, ffmpeg is often used to open/read audio files as samples.
At present, the information on the Internet is generally the installation and configuration of multimedia practitioners on the premise of operating ffmpeg alone, but how to call it in python is relatively vague.
So, record my construction process. For reference.
System : Win10_64 bit
Python version: 3.7
1. Download
Download URL: http://ffmpeg.org/download.html
After entering the page, select the operating system and the files to be downloaded successively, as shown in the figure:
Find the specific downloaded compressed package in the redirected page, as shown in the figure:
Click download, there is no requirement to save the path.
2. Local path configuration
After downloading and decompressing, there are the following contents:
Add the 'bin' path in the copy to the environment variable of the win10 system (note: it must be an absolute path)
Open "Edit System Environment Variables" –> "Advanced" –> "Environment Variables"
If only the current user uses ffmpeg, 用户变量
add it in , if all users use it, 系统变量
add it in , the operation method is the same.
Find " " in the variable name on the left side of Fission path
, click on it and click "Edit", and add the 'bin' path just copied in the pop-up window
At this point, the path configuration is over
3. Verify that the configuration is successful
win+R
Open cmd
a command line window, and enter ffmpeg -version
to verify whether the configuration is successful.
If successful, the system returns the corresponding version information, as follows:
4. Install the Python API of ffmpeg
After completing the first three steps, if you run " import ffmpeg
", an error will still be reported, and the displayed information will probably be "The ffmpeg module cannot be found". This is because we have not installed the corresponding Python interface. At this time, in the compilation environment, you can't jump to the method of ffmpeg through "Shift + left mouse button".
pip install ffmpeg-python
Enter the installation API interface on the command line
Then it's 'OK'.