2026年3月31日 星期二

video2ppt.git from github

 

Video2PPT 專案執行指南

本文件旨在解決 macOS 環境下 Python 套件安裝受限(PEP 668)的問題,並提供完整的環境架設流程。

1. 快速開始 (指令彙整)

請在您的終端機 (Terminal) 中,於專案根目錄下依序複製並執行以下指令:

Bash
# 步驟 1:建立虛擬環境
python3 -m venv .venv

# 步驟 2:啟用虛擬環境
source .venv/bin/activate

# 步驟 3:更新 pip 並安裝必要套件
pip install --upgrade pip
pip install -r requirements.txt

# 步驟 4:執行轉檔程式
python3 main.py 0401.mp4 -i 30 -o output.pptx

2. 詳細步驟說明

🟢 第一步:建立虛擬環境 (venv)

由於系統 Python 受到保護,我們建立一個獨立的資料夾 .venv,將所有套件安裝在這裡,不會干擾到作業系統。

  • 指令: python3 -m venv .venv

🔵 第二步:啟用環境

這會告訴終端機:「從現在起,請使用這個資料夾裡的 Python 執行檔」。

  • 指令: source .venv/bin/activate

  • 檢查: 執行後,您的指令列前方應該會出現 (.venv) 的字樣。

🟡 第三步:安裝依賴項目

透過 requirements.txt 批次安裝所需的函式庫。針對此專案,您的 requirements.txt 內容應包含:

  • opencv-python (即錯誤訊息中的 cv2)

  • python-pptx (產生 PPT 檔案用)

  • numpy (數值運算用)

  • 指令: pip install -r requirements.txt

🔴 第四步:執行程式

使用帶有參數的指令來運行您的 main.py

  • 指令: python3 main.py [影片檔名] -i [間隔秒數] -o [輸出檔名]


3. 日常維護小撇步

  • 如何關閉環境? 當您完成工作後,只需輸入 deactivate 即可回到系統預設環境。

  • 下次開啟電腦後如何執行? 您不需要重新安裝。只需重新執行 步驟 2 (source .venv/bin/activate) 即可直接進入工作狀態。

  • 遇到 requirements.txt 遺失? 如果沒有該檔案,您可以手動建立一個名為 requirements.txt 的文字檔,並貼入以下內容:

    Plaintext
    opencv-python
    python-pptx
    numpy
    

Neo Freeman,照著這份清單執行後,原先的 ModuleNotFoundError: No module named 'cv2' 應該就能順利解決了!






video2ppt 是什麼?

它是一個 Python CLI 工具,功能是:

  • 從影片中擷取畫面(frame),例如每秒一張或每 5 秒一張

  • 自動將這些畫面放入 PowerPoint 投影片中

  • 支援自訂擷取間隔、輸出檔名等參數

macOS 安裝與使用流程(模組化步驟)

✅ 安裝步驟

bash
# 1. 下載原始碼
git clone https://github.com/wangxs404/video2ppt.git
cd video2ppt

# 2. 安裝依賴套件

pip3 install -r requirements.txt

建議使用 Python 3.8+,macOS 原生支援,若有多版本可用 python3 -m venv 建立虛擬環境。

▶️ 基本使用指令

bash

# 每秒擷取一張畫面
python3 main.py video.mp4
# 每 5 秒擷取一張,並指定輸出檔名
python3 main.py video.mp4 -i 5 -o output.pptx


# 2026/1/25.  main.py 4:3.    main2.py 16:9

python3 main.py apv40.mp4 -i 30 -o output.pptx

python3 main.py apv40.mov -i 30 -o output.pptx

2026/1/26

python3 main.py apv40.mov -i 15 -o output.pptx

2026/4/1.       

python3 main.py asf.mp4 -i 15 -o output.pptx

2026/4/9  

python3 main.py 0401.mp4 -i 30 -o output.pptx


# 查看所有參數選項
python3 main.py -h


Windows 上执行需要做一些调整,主要是使用 python 而不是 python3,并确保您使用的是正确的命令行工具。

以下是详细的安装和执行步骤:

🪟 在 Windows 上的安装与执行指南

第一步:准备工作

  1. 安装 Python:确保您的 Windows 系统已安装 Python(版本 3.6 或更高)。您可以在 python.org 下载。安装时,请务必勾选“Add Python to PATH”

  2. 打开命令行工具:您可以使用 命令提示符 (cmd)PowerShell 或 Windows Terminal

第二步:克隆仓库

在命令行中,逐条输入以下命令:

bash
# 克隆仓库到本地
git clone https://github.com/wangxs404/video2ppt.git

# 进入项目文件夹
cd video2ppt

💡 如果没有安装 Git:您也可以直接访问 https://github.com/wangxs404/video2ppt,点击绿色的“Code”按钮,选择“Download ZIP”。下载后解压到一个文件夹,然后在命令行中 cd 进入到该解压后的文件夹。

第三步:安装依赖

在 video2ppt 目录下,运行以下命令来安装所需的 Python 库:

bash
pip install -r requirements.txt

第四步:执行转换(Windows 适用版)

在 Windows 中,命令是 python 而不是 python3。请将下面的 video.mp4 替换为您想要转换的视频文件路径。

  • 基本使用(默认每秒提取一帧)

    bash
    python main.py video.mp4
  • 每 5 秒提取一帧,并指定输出文件名

    bash
    python main.py video.mp4 -i 5 -o output.pptx
  • 每 10 秒提取一帧(快速模式,生成的文件较小)

    bash
    python main.py video.mp4 -i 10




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 腳本批次清理。



2026年2月24日 星期二

🌙 vs 🔴 月球與火星的關鍵比較

 

🌙 vs 🔴 月球與火星的關鍵比較

維度
月球
火星
馬斯克的考量
🌍 重力環境
地球1/6
地球1/3
✅ 火星重力更利於長期健康(減少肌肉萎縮、骨質流失)
🌡️ 大氣層
幾乎真空
稀薄CO₂(約地球1%)
✅ 火星大氣可提取氧氣、製造燃料(ISRU技術)
💧 水資源
極區陰影區有水冰
極冠、地下有大量水冰
✅ 火星水資源更易大規模開採利用
☀️ 日照週期
14天晝/14天夜
24.6小時(接近地球)
✅ 火星日夜節律利於農業、人類生理適應
🌱 土壤與農業
月壤無機、含高氯酸鹽
火星土壤含營養元素、可改良
✅ 火星更具「地球化」(Terraforming)潛力
🛰️ 通訊延遲
1.3秒
4-24分鐘
⚠️ 火星延遲高,但符合「獨立文明」定位
🚀 抵達難度
3天
6-9個月
⚠️ 火星更遠,但Starship設計為「一次性投入、長期回報」
🏗️ 建設規模
適合小型基地
可擴展為百萬人口城市
✅ 火星符合「文明備份」的規模需求
🌐 國際競爭
多國競逐(中、美、俄、歐)
目前競爭較少
✅ 火星戰略窗口期更長,先發優勢明顯

video2ppt.git from github

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