You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TianYuan
69138a2c85
|
3 years ago | |
---|---|---|
.. | ||
README.md | 3 years ago | |
recognize.py | 3 years ago | |
run.sh | 3 years ago |
README.md
Automatic Video Subtitiles
Introduction
Automatic video subtitles can generate subtitles from a specific video by using the Automatic Speech Recognition (ASR) system.
This demo is an implementation to automatic video subtitles from a video file. It can be done by a single command or a few lines in python using PaddleSpeech
.
Usage
1. Installation
pip install paddlespeech
2. Prepare Input
Get a video file with the speech of the specific language:
wget -c https://paddlespeech.bj.bcebos.com/demos/asr_demos/subtitle_demo1.mp4
Extract .wav
with one channel and 16000 sample rate from the video:
ffmpeg -i subtitle_demo1.mp4 -ac 1 -ar 16000 -vn input.wav
3. Usage
- Python API
Output:import paddle from paddlespeech.cli import ASRExecutor, TextExecutor asr_executor = ASRExecutor() text_executor = TextExecutor() text = asr_executor( audio_file='input.wav', device=paddle.get_device()) result = text_executor( text=text, task='punc', model='ernie_linear_p3_wudao', device=paddle.get_device()) print('Text Result: \n{}'.format(result))
Text Result: 当我说我可以把三十年的经验变成一个准确的算法,他们说不可能。当我说我们十个人就能实现对十九个城市变电站七乘二十四小时的实时监管,他们说不可能。