Package: ur-audio-sub
I. INTRODUCTIONur_audio_submade generating captions easy for any audio files & youtube video using OpenAI Whisper. Multiple languages support.II. REFERENCESYou can skip all of these introductions by viewing theVideo demo here. Let's start generating audio transcription effortlessly.2.1. First thing firstYou can find the demo Jupiter notebookhere, make a copy and play with this package on Google Colab to generate your first transcription with only 3 steps and 5 lines of code literally.DemonstrationInstall whisper packageYou will need to install OpenAI whisper package from source using pip:
Let's runt this command in the terminal fist:!pip install git+https://github.com/openai/whisper.git -qInstall ffmpeg (optional)Install ffmpegIn case ffmpeg-python doesn't work, you will need ffmpeg be installed separately to start generating captions:on Ubuntu or Debian, or Google Colab:sudo apt update && sudo apt install ffmpegon MacOS usingHomebrew:brew install ffmpegon Windows usingChocolatey:choco install ffmpegon Windows usingScoop:scoop install ffmpegGoogle Colab is highly recommendedGo to the Google Colab menu: SelectRuntime>Change runtime typeand make sure thatGPUhas been chosen. You can run this AI model way faster with GPU on Google Colab than the normal CPU or your personal computer.2.2. How to install this package?Using pip to installed pre-builded package on Pypippip install ur_audio_subIf you want to use the latest pydata_master version instead of the stable one, you can install it from source with the following command:pip install git+https://github.com/thinh-vu/ur_audio_sub.git@main(*) You might need to insert a!before your command when running terminal commands on Google Colab.2.3. Where can I find the generated caption?Please find it in the same folder where you store the audio file. On Google Colab, you can find it in the root folder when generating subtitles for Youtube videos.Function referencesRun this command first to import the package to your working environment before using any functions belowfrom ur_audio_sub import *ytSub(link='YOUR_YOUTUBE_URL', model='medium', language='', translate=False, lmt=LMT, basepath=ROOT_DIR)orytSub('YOUR_YOUTUBE_URL')in shortsubGen_path(file_path, model='medium', language='', translate=False)orsubGen_path('YOUR_FILE_PATH')in shortIn case of any issue that happens, you can't generate the Youtube Video caption withytSubfunction; try thesubGen_pathfunction with the audio file downloaded path to solving that issue. You can also try this terminal command instead!whisper 'PATH_TO_YOUR_AUDIO_FILE' --model medium.III. APENDICESThis package has been built on top of pytube and OpenAI Whisper:pytubeis a genuine, lightweight, dependency-free Python library (and command-line utility) for downloading YouTube videos.whisper: Whisper is a general-purpose speech recognition model. It is trained on a large dataset of diverse audio and is also a multi-task model that can perform multilingual speech recognition as well as speech translation and language identification.IV. 🙋‍♂️ CONTACT INFORMATIONYou can contact me at one of my social network profiles:If you want to support my open-source projects, you can "buy me a coffee" viaPatreonor Momo e-wallet (VN). Your support will help to maintain my blog hosting fee & to develop high-quality content.