用AI对话工具试试能否Python将MP4视频转成音频,再转成文字docx(不用格式工厂转)
- '''
- 视频MP4转音频wav
- 作者:AI对话大师,
- 时间:2024年3月8日
- '''
-
-
- import moviepy.editor as mp
- import speech_recognition as sr
- from docx import Document
- path=r'C:\Users\jg2yXRZ\OneDrive\桌面\古诗与幼儿姓名'
- # 将视频转换为音频
- video_path = path+r"\1.mp4"
- audio_path = path+r"\1.wav"
-
- video = mp.VideoFileClip(video_path)
- video.audio.write_audiofile(audio_path)