Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert video to text python

import urllib2
import speech_recognition as sr
import subprocess
import os

url = 'https://cdn.fbsbx.com/v/t59.3654-21/15720510_10211855778255994_5430581267814940672_n.mp4/audioclip-1484407992000-3392.mp4?oh=a78286aa96c9dea29e5d07854194801c&oe=587C3833'
mp4file = urllib2.urlopen(url)

with open("test.mp4", "wb") as handle:
    handle.write(mp4file.read())

cmdline = ['avconv',
           '-i',
           'test.mp4',
           '-vn',
           '-f',
           'wav',
           'test.wav']
subprocess.call(cmdline)

r = sr.Recognizer()
with sr.AudioFile('test.wav') as source:
    audio = r.record(source)

command = r.recognize_google(audio)
print command

os.remove("test.mp4")
os.remove("test.wav")
Comment

Video to text convertor in python

# Python code to convert video to audio
import moviepy.editor as mp
  
# Insert Local Video File Path 
clip = mp.VideoFileClip(r"Video File")
  
# Insert Local Audio File Path
clip.audio.write_audiofile(r"Audio File")
Comment

PREVIOUS NEXT
Code Example
Python :: insert row in any position pandas dataframe 
Python :: sending email with django 
Python :: make poetry env 
Python :: convert pandas dataframe to dict with a column as key 
Python :: play sound python 
Python :: python convert image to base64 
Python :: add two column values of a datframe into one 
Python :: get definition of word python 
Python :: python hash() seed 
Python :: python declare variable type array 
Python :: pandas concat 
Python :: driver code in python 
Python :: copy content from one file to another in python 
Python :: sum of a numpy array 
Python :: tkinter pack grid and place 
Python :: create dict from two lists 
Python :: How do I merge two dictionaries in a single expression (taking union of dictionaries)? 
Python :: get absolute url 
Python :: concatenating datfra,esin pandas 
Python :: dataframe to pandas 
Python :: lcm in python 
Python :: AttributeError: ‘numpy.ndarray’ object has no attribute ‘append’ 
Python :: fibonacci sequence in python using whileloop 
Python :: beautiful soap python get the link online 
Python :: pandas count empty string values 
Python :: how to make a nice login django form 
Python :: python delete all occurrences from list 
Python :: split string into groups of 3 chars python 
Python :: how to swap two variables without using third variable and default python functionality 
Python :: python image crop 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =