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

@[TOC](基于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







Pika在线

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

  • 10
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

坦笑&&life

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值