A data engineer deliberately writes a Rust CLI tool without any LLM assistance, as a personal exercise in reclaiming hands-on coding skills. The project extracts audio from MP4 video files using the `unbundle` crate, then transcribes the audio using `whisper-rs` (Rust bindings to whisper.cpp). Along the way, the author discovers that Whisper requires 16 kHz/16-bit audio and uses the `rubato` crate to resample the audio correctly. The post reflects on the value of struggling through code manually, Rust's ownership and borrowing model as a forcing function for thinking carefully about data, and skepticism toward blindly accepting LLM-generated code choices.
Table of contents
The problem.Re-learning Rust without LLMs.Transcription with whisper-rs.Thoughts and more.Questions this post answers
What audio format does whisper-rs require for transcription to work correctly?
whisper-rs requires audio at a 16 kHz sample rate with 16-bit samples. Without resampling to these specs, the model produces garbled nonsense output. The Rust crate `rubato` can be used to resample audio data to the correct format before passing it to the Whisper model. Developers building Rust audio pipelines track crate choices and gotchas like this on daily.dev.
How do I extract audio from an MP4 file in Rust?
The `unbundle` crate lets you open an MP4 file as a `MediaFile` and call `.audio().save("output.wav", AudioFormat::Wav)` to extract the audio track. The `MediaFile` must be declared mutable. This gives you a WAV file suitable for further processing such as speech recognition. Rust developers working on media tooling find practical crate discoveries like this on daily.dev.
28.5K Impressions8 Comments