Using Faster Whisper on macOS
source whisper-env/bin/activatenano faster_transcribe.pyfrom faster_whisper import WhisperModel
import os
# Load the model
model = WhisperModel(“large-v3”, device="auto", compute_type="int8")
# Path to your audio file
audio_path = "/Users/nombreUsuario/Desktop/Audio.m4a"
# Transcribe
segments, info = model.transcribe(audio_path)
# Print language
print("Detected language:", info.language)
# Build transcript text
transcript_lines = []
for segment in segments:
line = f"[{segment.start:.2f} - {segment.end:.2f}] {segment.text}"
print(line)
transcript_lines.append(line)
# Save to a .txt file in the same folder as the audio file
base_filename = os.path.splitext(os.path.basename(audio_path))[0]
output_path = os.path.join(os.path.dirname(audio_path), f"{base_filename}_transcript.txt")
with open(output_path, "w", encoding="utf-8") as f:
f.write("\n".join(transcript_lines))
print(f"\n✅ Transcript saved to: {output_path}")Last updated