2026年1月22日 星期四

whisper CLI for 【 windows 】

 To run the Whisper CLI on Windows, you have two main options: using the official Python package with pip or using the standalone executables provided by the C++ port, whisper.cpp. The Python method offers direct installation, while whisper.cpp provides better performance on CPU hardware. 

Option 1: Using the Official Python Package (Recommended for most users) 
This method involves using Python's package manager (pip) to install the official OpenAI Whisper library, which includes a command-line interface. 
Prerequisites:
  1. Python: Install Python 3.8 or later from the official website. Ensure you check the box that says "Add Python to PATH" during installation.
  2. FFmpeg: This tool is required for handling various audio formats.
    • The easiest way to install it on Windows is using the package manager Chocolatey.
    • Open PowerShell as an administrator and run: choco install ffmpeg.
    • Alternatively, you can manually download FFmpeg and add it to your system's environment variables (PATH).
  3. PyTorch (Optional for GPU acceleration): If you have an NVIDIA GPU, install CUDA-compatible PyTorch for much faster transcription. Follow instructions on the PyTorch website. For CPU-only, the pip install command will install the necessary CPU version automatically. 
Installation Steps:
  1. Open your Command Prompt or PowerShell.
  2. Install the Whisper package using pip:
    bash
    pip install -U openai-whisper
    
    To ensure you have the latest version directly from the source, you can use this command instead:
    bash
    pip install --upgrade --no-deps --force-reinstall git+https://github.com/openai/whisper.git
    
  3. Verify the installation by running:
    bash
    whisper --help
    
     
Usage Example:
Transcribe an audio file named audio.mp3 using the small model: 
bash
whisper audio.mp3 --model small
Option 2: Using whisper.cpp (For CPU performance and standalone use) 
whisper.cpp is a C++ port that runs very efficiently on a CPU, often faster than the Python version. Standalone CLI executables are available, eliminating the need to install Python or manage dependencies manually. 
  1. Download: Go to the whisper.cpp releases page on GitHub and download a pre-built Windows binary (e.g., whisper-bin-x64.zip).
  2. Extract: Extract the contents of the ZIP file to a folder (e.g., C:\ai\whisper.cpp).
  3. Install C++ Redistributable: Ensure you have the latest Microsoft Visual C++ Redistributable installed, as it is a necessary dependency.
  4. Download a Model: Download a pre-trained model file in the ggml format from the Hugging Face repository (e.g., ggml-base.en.bin) and place it in your whisper.cpp folder.
  5. Run: Open a Command Prompt in the extracted folder and run the executable with your model and audio file.
    bash
    whisper-cli.exe -m ggml-base.en.bin -f samples/jfk.wav
    
    (Note: You might need to place your audio file in the same directory or specify its full path.) 

沒有留言:

張貼留言

video2ppt.git from github

  Video2PPT 專案執行指南 本文件旨在解決 macOS 環境下 Python 套件安裝受限(PEP 668)的問題,並提供完整的環境架設流程。 1. 快速開始 (指令彙整) 請在您的終端機 ( Terminal ) 中,於專案根目錄下依序複製並執行以下指令: Bash ...