2026年3月10日 星期二

whisper MP4-to-srt 影片1小時以上 [mac os]






The term "Whisper CLI" typically refers to the command-line interface provided by OpenAI's open-source Whisper model for speech recognition and translation.
Installation
The official Whisper CLI is a Python package and requires ffmpeg to be installed on your system. 
  1. Install ffmpeg: Use a package manager appropriate for your operating system (e.g., Homebrew on macOS, apt on Ubuntu/Debian, Chocolatey on Windows).
    bash
    # On macOS
    brew install ffmpeg
    # On Ubuntu/Debian
    sudo apt update && sudo apt install ffmpeg
    
  2. Install the Whisper Python package: Use pip to install the package from the official OpenAI GitHub repository.
    bash
    pip install -U openai-whisper
    
Usage
Once installed, you can use the whisper command to transcribe audio files locally. 
  • Transcribe an audio file:
    bash
    whisper audio.mp3
    
    This will automatically detect the language and transcribe the audio, saving the output as text files in the same directory.
  • Specify a different model:
    bash
    whisper audio.flac --model medium
    
    Models vary in size and accuracy (tiny, base, small, medium, large).
  • Translate a non-English file to English:
    bash
    whisper japanese.wav --model medium --task translate
    
    This translates the source speech into English text.
  • View all options:
    bash
    whisper --help
    
     
Alternative CLIs
Several third-party projects offer enhanced CLIs, often for performance: 
  • faster-whisper-cli: A Python package utilizing CTranslate2 for faster inference, especially on specific hardware.
  • whisper.cpp-cli: A C/C++ port (whisper.cpp) focused on efficient, high-performance, and cross-platform on-device inference, often using CPU/GPU acceleration features like Core ML or cuBLAS. These are standalone executables and do not require Python

----------

260121

whisper apv2.mp4 --language zh --task transcribe --output_format srt

260122

whisper a.mp4 --language zh --task transcribe --output_format srt

whisper cli.mp4 --language zh --task transcribe --output_format srt

260123.   

whisper apv40.mov --language zh --task transcribe --output_format srt

260204 array AG FQDN

whisper ag.mp4 --language zh --task transcribe --output_format srt

260206

whisper m.mp4 --language zh --task transcribe --output_format srt

260211

whisper stm.mp4 --language zh --task transcribe --output_format srt

whisper cc.mp4 --language zh --task transcribe --output_format srt

260226 Array AG FQDN_CIFS

whisper cifs.mp4 --language zh --task transcribe --output_format srt

260305 ty

whisper ty.m4a --language zh --task transcribe --output_format srt

260311 max 30分鐘

whisper max.mov --language zh --task transcribe --output_format srt

輸出的 .srt 會放在 你當前的工作目錄

以上為簡體中文

簡體中文->繁體中文

brew install opencc

opencc -i a2.srt -o a2_traditional.srt -c s2t.json

opencc -i 0122.srt -o a2_traditional.srt -c s2t.json

260123

opencc -i apv40.srt -o apv40_traditional.srt -c s2t.json

260226.   CIFS Array AG

opencc -i cifs.srt -o apv40_traditional.srt -c s2t.json

如何去掉贅詞(後處理方式)

方法 1:用文字處理工具清理

  1. Whisper 生成 a.srt

  2. 使用正則表達式或文字編輯器批次刪除常見贅詞。 例如在 sedgrep 中:

    bash
    sed -E 's/(嗯|啊|就是|那個)//g' a.srt > a_clean.srt
    

    👉 這樣會生成一個去掉贅詞的字幕檔。

方法 2:用 OpenCC + 自訂詞表

OpenCC 本來是繁簡轉換工具,但它也能套用自訂詞表。

  • 你可以建立一個「贅詞刪除詞表」,讓它在轉換時自動去掉。

方法 3:用 NLP 後處理

如果要更智慧化,可以用 Python NLP 套件(spaCy、jieba)來過濾停用詞,保留主要語意。 範例:

python
import re

with open("a.srt", "r", encoding="utf-8") as f:
    text = f.read()

clean_text = re.sub(r"(嗯|啊|就是|那個)", "", text)

with open("a_clean.srt", "w", encoding="utf-8") as f:
    f.write(clean_text)

📌 彙整

  • Whisper CLI → 沒有內建去贅詞功能

  • 解法 → 後處理(正則表達式 / 自訂詞表 / NLP)。

  • 最快方式 → 用 sed 或 Python 腳本批次清理。



video2ppt.git from github

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