Posts

Showing posts from September, 2021

Getting Transcripts from Video file (mp4)

Image
Images by cottonbro from pexels.com In this blog, we share some Python code to get transcripts from video files with Microsoft Speech Service . We have mp4 files which are video files, and we need to convert them to Waveform audio format  because the speech service takes only audio format. 1. Azure Cognitive Service Get an account for Azure Cognitive Service (if you do not have one). https://azure.microsoft.com/en-us/free/cognitive-services/. Please take note of the subscription key and region of the account. 2. Install Dependencies 2.1 moviepy This library allows us to convert mp4 file to wav file format. pip install moviepy 2.2 azure-cognitiveservices-speech pip install azure-cognitiveservices-speech 3. Configuration export these environment variables. export SPX_SUBSCRIPTION_KEY=<the subscription key to the cognitive service resides> export SPX_REGION=<the region which the cognitive service resides> 4. Python Code Save the following to file named, spx_recognize.py. We h