Git Product home page Git Product logo

audio_to_srt's Introduction

This tool generates .srt format subtitle from audios.

Usage

STEP 1 Clone this script to your local folder

apt-get -y update
apt-get -y install git
git clone https://github.com/doem97/audio_to_SRT.git
cd ./audio_to_SRT

STEP 2 Get XUNFEI cloud certification

This script calls XUNFEI api. You should first get a XUNFEI cloud account at https://console.xfyun.cn/services/lfasr. Go to 语音识别 - 语音转写 to get your APPID and SecretKey.

STEP 3 Get sound track from video

You can get .wav audio from video file using ffmpeg.

E.g. below shows how to get the sound track from sample.mp4 using sampling rate 16K.

ffmpeg -i sample.mp4 -ar 16000 audio.wav

*if you want to use other format rather than .wav such as .mp3 or .prm, you should change code block in get_srt.py

STEP 4 Put sound track

Put audio.wav file to ./work_dir/

STEP 5 Run and get subtitle

Run auto-environment build script config_env.sh and then run main script get_srt.py to get the srt. As follow:

chmod +x config_env.sh
./config_env.sh
source ./xunfei_venv/bin/activate
python get_srt.py APPID SECRET-KEY

in which the APPID and SECRET-KEY are gotten in STEP 2. E.g. python get_srt.py 1j3i3g fjiwgo23jio23t8932tj

and it will generate subtitle at ./work_dir/audio.srt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.