Original article was published by Behic Guven on Artificial Intelligence on Medium
As you can understand from the title, we will need a video recording for this project. It can even be a recording of yourself speaking to the camera. Using a library called MoviePy, we will extract the audio from the video recording. And in the next step, we will convert that audio file into text using Google’s speech recognition library. If you are ready, let’s get started by installing the libraries!
We are going to use two libraries for this project:
- Speech Recognition
Before importing them to our project file, we have to install them. Installing a module library is very easy in python. You can even install a couple of libraries in one line of code. Write the following line in your terminal window:
pip install SpeechRecognition moviepy
Yes, that was it. SpeechRecognition module supports multiple recognition APIs, and Google Speech API is one of them. You can learn more about the module from here.
MoviePy is a library that can read and write all the most common audio and video formats, including GIF. If you are having issues when installing moviepy library, try by installing ffmpeg. Ffmpeg is a leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.
Now, we should get to writing code in our code editor. We will start by importing the libraries.