---
title: "TIL: ffprobe for audio file inspection"
description: ffprobe shows sample rate, channels, duration, and codec of any audio file. Check audio format before sending it to a speech-to-text API.
canonical: https://lukeocodes.dev/til-ffprobe-audio-inspection
type: article
locale: en_GB
published: 2026-04-28T00:00:00.000Z
modified: 2026-04-28T00:00:00.000Z
authors:
  - Luke Oliff
section: TIL
tags:
  - TIL
  - Engineering
feed: https://lukeocodes.dev/rss.xml
search: https://lukeocodes.dev/search.json?q={query}
schema:
  - "@context": https://schema.org
    "@graph":
      - "@type": Organization
        "@id": https://ably.com/#organization
        name: Ably
        url: https://ably.com
      - "@type": WebSite
        "@id": https://lukeocodes.dev/#website
        url: https://lukeocodes.dev
        name: Luke Oliff
        alternateName: lukeocodes
        inLanguage: en
        publisher:
          "@id": https://lukeocodes.dev/authors/luke#person
        description: Personal blog and writing by Luke Oliff — developer relations, voice AI, developer experience.
        potentialAction:
          - "@type": SearchAction
            target:
              "@type": EntryPoint
              urlTemplate: https://lukeocodes.dev/blog/search?q={search_term_string}
            query-input: required name=search_term_string
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Staff engineer and Staff Tech Lead for Developer Experience at Ably. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Staff Tech Lead, Developer Experience
        worksFor:
          "@id": https://ably.com/#organization
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
  - "@context": https://schema.org
    "@graph":
      - "@type": Organization
        "@id": https://ably.com/#organization
        name: Ably
        url: https://ably.com
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Staff engineer and Staff Tech Lead for Developer Experience at Ably. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Staff Tech Lead, Developer Experience
        worksFor:
          "@id": https://ably.com/#organization
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
      - "@type": BlogPosting
        "@id": https://lukeocodes.dev/til-ffprobe-audio-inspection#article
        headline: "TIL: ffprobe for audio file inspection"
        alternativeHeadline: "TIL: ffprobe for audio file inspection"
        description: ffprobe shows sample rate, channels, duration, and codec of any audio file. Check audio format before sending it to a speech-to-text API.
        datePublished: 2026-04-28T00:00:00.000Z
        dateModified: 2026-04-28T00:00:00.000Z
        url: https://lukeocodes.dev/til-ffprobe-audio-inspection
        mainEntityOfPage: https://lukeocodes.dev/til-ffprobe-audio-inspection
        inLanguage: en
        author:
          - "@id": https://lukeocodes.dev/authors/luke#person
        isPartOf:
          "@id": https://lukeocodes.dev/#website
        keywords: TIL, Engineering
        articleSection: TIL
        abstract: "TIL Tuesday: I wasted an afternoon once debugging why a speech-to-text API kept returning garbled transcripts. Turned out the audio file was 48 kHz when the API expected 16 kHz. A quick ffprobe would have told me in one second."
        speakable:
          "@type": SpeakableSpecification
          cssSelector:
            - .post-tldr
            - h1
        image: https://lukeocodes.dev/blog/til-ffprobe-audio-inspection/hero.png
        wordCount: 335
        timeRequired: PT2M
        publisher:
          "@id": https://ably.com/#organization
      - "@type": BreadcrumbList
        itemListElement:
          - "@type": ListItem
            position: 1
            name: Home
            item: https://lukeocodes.dev
          - "@type": ListItem
            position: 2
            name: Writing
            item: https://lukeocodes.dev/blog
          - "@type": ListItem
            position: 3
            name: "TIL: ffprobe for audio file inspection"
            item: https://lukeocodes.dev/til-ffprobe-audio-inspection
---

[Luke Oliff.](/)

- [Blog](/blog)
- [CV](/cv)
- [Uses](/uses)
- [User manual](/user-manual)
- [Living with ADHD](/living-and-working-with-adhd)
- [RSS](/rss.xml)

[Luke Oliff · Writing](/blog)

# TIL: ffprobe for audio file inspection

Apr 2026 · [TIL](/blog/category/til) · 2 min read · [Luke Oliff](/authors/luke)

TIL Tuesday: I wasted an afternoon once debugging why a speech-to-text API kept returning garbled transcripts. Turned out the audio file was 48 kHz when the API expected 16 kHz. A quick ffprobe would have told me in one second.

ffprobe is part of ffmpeg and prints metadata about media files. For audio processing pipelines, it is the fastest way to check what you are actually working with.

```bash
ffprobe -hide_banner recording.wav
```

Output looks like this:

```
Input #0, wav, from 'recording.wav':
  Duration: 00:02:34.12, bitrate: 768 kb/s
  Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 768 kb/s
```

That 48000 Hz and 2 channels line is what I needed. The API expected 16000 Hz mono. So I resampled with sox instead of guessing.

Use `-show_streams` for structured output you can pipe into other tools:

```bash
ffprobe -v quiet -show_streams -select_streams a:0 recording.wav
```

This returns key-value pairs for the first audio stream. Sample rate, codec name, channel layout, duration. Machine readable. Useful when you are validating files in a batch script.

```bash
for file in *.wav; do
  rate=$(ffprobe -v quiet -show_streams -select_streams a:0 "$file" | grep "^sample_rate=" | cut -d= -f2)
  if [ "$rate" != "16000" ]; then
    echo "$file: wrong sample rate ($rate)"
  fi
done
```

`ffprobe -v quiet` suppresses log output. Combine it with `-of json` for JSON output that is easier to parse in scripts.

### Do I need ffmpeg installed for ffprobe?

Yes. ffprobe ships with ffmpeg. On macOS `brew install ffmpeg` includes it. On Debian `apt install ffmpeg`. It is a separate binary but always bundled.

### What audio formats does ffprobe support?

Everything ffmpeg can read, which is most of them. WAV, FLAC, MP3, Opus, M4A, WebM. If ffmpeg can decode it, ffprobe can inspect it.

### Can ffprobe validate audio before sending to an API?

That is exactly what I used it for. Check sample rate, channel count, codec, and duration against the API's documented limits before you send anything. Saves a lot of debugging time.

[← Newer: How streaming speech recognition works](/how-streaming-speech-recognition-works)

[All posts](/blog) →

## Search this site

`GET https://lukeocodes.dev/search.json?q=<words>` returns matching posts as JSON, each with its page URL and its markdown URL. Add `&limit=<1-50>` for more than 10. How it works: [/blog/search](https://lukeocodes.dev/blog/search.md).

```sh
curl "https://lukeocodes.dev/search.json?q=developer+relations"
```

---

© 2026 Luke Oliff. Posts live at the root of this site.

- [GitHub](https://github.com/lukeocodes)
- [LinkedIn](https://www.linkedin.com/in/lukeocodes)
- [X](https://x.com/lukeocodes)
- [Bluesky](https://bsky.app/profile/lukeocodes.dev)
- [Email](mailto:luke@lukeoliff.com)
- [RSS](/rss.xml)

## Cookies

This site sets one analytics cookie, from Google Analytics, and only in a browser that accepts the cookie banner. A client that does not run scripts sets no cookies, so there is nothing to accept or decline here.

[Cookie policy](/cookies)
