Daily: How to transcribe Videos

Inhaltsverzeichnis
Using Commandline and Python
Option 1: Transcribe with Whisper (official)
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)
Create a shell script to transcribe multiple files
#!/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
Option 2: Transcribe with faster-whisper (much faster on CPU or GPU)
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")
Optional: Convert to audio (if needed)
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.
Problems with numpy
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.
Reason:
The error you’re seeing comes from an incompatibility between NumPy 2.x and some Whisper dependencies that were compiled against NumPy 1.x.
Solution: Downgrade NumPy
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
Hide warning UserWarning: FP16 is not supported on CPU; using FP32 instead
Option 1: Suppress all Python warnings (quick + global)
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")
Option 2: Suppress only that specific warning
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" )
Option 3: Patch the library (if you’re comfortable)
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.