基于Whisper语音识别的实时视频字幕生成 (一): 流式播放视频帧和音频帧

基于Whisper语音识别的实时视频字幕生成 (一): 流式播放视频帧和音频帧

    正在检查是否收录...
一言准备中...

Whishow

一款基于python的音视频在线播放器

1. 安装

pip install whishow 

2. 用法

示例 1: 简单上手

cmd: python -m whishow <video_path_or_url> e.g. python -m whishow rtmp://mobliestream.c3tv.com:554/live/goodtv.sdp 

示例 2: 基于python多线程流处理和流播放

 from whishow import STREAM,PLAY import keyboard import threading # init the stream reader, named stm. stm = STREAM() stm.init_state(url=url, cache_size=10*60) # init the whishow player, and connect the audio/video stream of stm. ply = PLAY() ply.init_state(start=0, chunk_size=1, video_frame_shift=20, audio_fps=stm.AUDIO_FPS, video_fps=stm.VIDEO_FPS, Q_audio_play=stm.Q_audio_play, Q_video_play=stm.Q_video_play, asr_results=[]) # thread-0: esc for exit def engine(): while 1: if keyboard.is_pressed('esc'): print("exit ..") break time.sleep(0.1) stm.running = False ply.running = False # thread-1: stream reader def stream(): stm.read(video_dst_frame_size=video_dst_frame_size, is_play=True, is_asr=False) # thread-2: stream palyer def play(): ply.run(show_subtitle=False) p0 = threading.Thread(target=engine,args=()) p1 = threading.Thread(target=stream,args=()) p2 = threading.Thread(target=play,args=()) p0.start() p1.start() p2.start() p0.join() p1.join() p2.join() 

3. 联系我们

605686962@qq.com
coolEphemeroptera@gmail.com

idepythonurlasrgmail音视频
  • 本文作者:WAP站长网
  • 本文链接: https://wapzz.net/post-14890.html
  • 版权声明:本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。
本站部分内容来源于网络转载,仅供学习交流使用。如涉及版权问题,请及时联系我们,我们将第一时间处理。
文章很赞!支持一下吧 还没有人为TA充电
为TA充电
还没有人为TA充电
0
  • 支付宝打赏
    支付宝扫一扫
  • 微信打赏
    微信扫一扫
感谢支持
文章很赞!支持一下吧
关于作者
2.7W+
9
1
2
WAP站长官方

探究Python语言在网络数据爬虫领域的应用与实践

上一篇

自动化小说源码采集的探索与实践

下一篇
  • 复制图片
按住ctrl可打开默认菜单