ANNAS TRI WIDAGDO/PORTFOLIO · 2026
VOL. 01 // TECHNICAL ARCHIVE
■annastriwidagdo.me
SOFTWARE ENGINEER·FULL-STACK WEB DEVELOPER·MACHINE LEARNING ENGINEER
ENTRY 001OPENING TECHNICAL ARCHIVE00% · 01 / 01
Skip to content
■annastriwidagdo.me
  • 01Home
  • 02About
  • 03Projects
  • 04Blog●
  • 05Contact
LANGEN/ID
■annastriwidagdo.me
  • Software Engineer
  • Full-Stack Web Developer
  • Machine Learning Engineer

JAKARTA, INDONESIA · UTC+7

EMAILannastriw6@gmail.com↗ (opens in a new tab)LINKEDIN/in/annastriw↗ (opens in a new tab)GITHUB@annastriw↗ (opens in a new tab)CONTACTOpen Contact→

© 2026 Annas Tri Widagdo. Drafted in grids, shipped in code.

←Back to indexBLOG / 04
[ESSAY // 04]/Audio and AI·3 min read

Building a Practical Speech-to-Text Pipeline with Wav2Vec2 and FFmpeg

A Google Colab workflow that normalizes audio and video, processes long input in chunks, and turns pretrained Wav2Vec2 output into transcripts and burned-in subtitles.

Written byAnnas Tri Widagdo
  • #Python
  • #Wav2Vec2
  • #FFmpeg
  • #SRT
  • #Google Colab
[01]

Building an Audio Pipeline in Google Colab

  1. 01Audio or Video Upload
  2. 02FFmpeg Audio Extraction
  3. 0316 kHz Mono Conversion
  4. 04Sequential Audio Chunking
  5. 05Wav2Vec2 Inference
  6. 06TXT, CSV, JSON Exports
  7. 07SRT Subtitle Generation
  8. 08Burned-in Subtitle Video

Automatic speech recognition works best when the entire media workflow is planned end-to-end. Built as a Python workflow in Google Colab, the Speech-to-Text System accepts both audio and video files, generating structured transcripts and final videos with burned-in subtitles.

The project focuses on the practical pipeline: extracting audio from video with FFmpeg, standardizing the signal, handling long audio through chunking, and routing the resulting text into multiple useful formats.

[02]

Audio Preprocessing and Sequential Chunking

  1. 01Identify whether the uploaded source file is audio or video.
  2. 02Extract the uncompressed audio track from video files using FFmpeg.
  3. 03Resample and convert the audio to a single mono channel at 16 kHz using Librosa.
  4. 04Split long audio recordings into smaller sequential chunks to manage memory smoothly.

Acoustic neural networks require consistent audio input. Using Librosa and FFmpeg, audio streams are downmixed to single-channel mono and resampled to 16 kHz, matching the exact format expected by the Wav2Vec2 feature extractor.

For long recordings, dividing the audio into sequential chunks prevents memory errors in Google Colab and allows each segment to be processed in order while preserving accurate timing.

[03]

Speech Recognition with Pretrained Wav2Vec2

Transcription is handled by the pretrained facebook/wav2vec2-base-960h model loaded through Hugging Face Transformers. The model processes the audio chunks and decodes the spoken words into text.

The pipeline compiles the transcriptions into three practical file formats: plain TXT for quick reading, tabular CSV structured with Pandas for chunk-level inspection, and structured JSON for easy integration with other software tools.

Factual boundary

The project record documents an ASR pipeline using the pretrained facebook/wav2vec2-base-960h model and does not include model fine-tuning. It does not include a benchmark, Word Error Rate, Character Error Rate, or unverified transcription accuracy claims.

[04]

Automating Subtitles and Video Generation

Documented video output with subtitles generated by the speech-to-text workflow
Final media stage combining generated SRT subtitle timecodes with original video via FFmpeg.

In addition to plain text, the pipeline converts chunk timestamps into standard SubRip (SRT) subtitle files with accurate start and end times.

In the final step, FFmpeg burns the subtitle text directly onto the video frames. This creates a finished video with permanent open captions that can be played on any device or browser without needing external subtitle files.

  • Plain text transcript document (TXT).
  • Tabular chunk dataset with timing metadata (CSV).
  • Structured data payload (JSON).
  • Standard time-coded subtitle track (SRT).
  • Final video with burned-in subtitles.

Related project experience

Speech-to-Text System↗
← PREVIOUS ARTICLEFrom Android Print Framework to ESC/POS
All Articles
End of index