Tipps und Tricks für Entwickler und IT-Interessierte
Our latest news
Create a launch.json file in .vscode
{ "version": "0.2.0", "configurations": [ { "name": "Streamlit", "type": "debugpy", "request": "launch", "module": "streamlit", "args": [ "run", "${file}", "--server.port", "28100" ] } ] }
Inhaltsverzeichnis
pip install git+https://github.com/openai/whisper.git
Then run:
whisper demo.mp4 --model medium --language auto --output_format txt
Optional flags:
--output_format srt
(for subtitles)--language en
(to skip language detection)#!/usr/bin/env bash # Loop through all arguments (filenames) for VIDEO in "$@"; do echo "Transcribing: $VIDEO" whisper "$VIDEO" --model medium --language en --output_format txt done
pip install faster-whisper
Run via Python:
import sys from faster_whisper import WhisperModel VIDEO=sys.arg[1] model = WhisperModel("medium", device="cpu") # or "cuda" for GPU segments, info = model.transcribe(VIDEO) with open("transcript.txt", "w") as f: for s in segments: f.write(f"{s.start:.2f} --> {s.end:.2f}: {s.text.strip()}\n")
If transcription fails or is slow, extract audio first:
ffmpeg -i your_video.mp4 -ar 16000 -ac 1 -c:a pcm_s16le audio.wav
Then transcribe audio.wav
instead.
Error when running whisper: A module that was compiled using NumPy 1.x cannot be run in NumPy 2.2.6 as it may crash.
The error you’re seeing comes from an incompatibility between NumPy 2.x and some Whisper dependencies that were compiled against NumPy 1.x.
You can fix this by downgrading NumPy to version 1.x:
pip install "numpy<2"
Then run Whisper again:
whisper demo.mp4 --model medium --language auto --output_format txt
In your terminal or script, set the environment variable:
PYTHONWARNINGS="ignore" whisper dmeo.mp4 --model medium<br></code>
Or, in Python code:
import warnings warnings.filterwarnings("ignore")
If you’re using faster-whisper
in Python and want to filter only that one:
import warnings warnings.filterwarnings( "ignore", message="FP16 is not supported on CPU; using FP32 instead" )
You can find the line in the faster_whisper
source code (usually in transcribe.py
) that issues the warning and comment it out or remove it:
# warnings.warn("FP16 is not supported on CPU; using FP32 instead")
Not recommended unless you maintain the code.