{
  "schemaVersion": 1,
  "contentVersion": "ca42e61ede0a24f789d7287a0001244ad22f4abf",
  "id": "docs/codecs/audio/speex",
  "collection": "docs",
  "title": "Speex",
  "description": "Speex is an obsolete speech codec from Xiph; use Opus for new work and keep Speex only for legacy files and endpoints.",
  "canonicalUrl": "https://encode.wiki/codecs/audio/speex/",
  "apiUrl": "https://encode.wiki/api/v1/documents/docs/codecs/audio/speex.json",
  "markdownUrl": "https://encode.wiki/api/v1/markdown/docs/codecs/audio/speex.md",
  "status": "current",
  "tags": [
    "migrated"
  ],
  "license": "CC BY-SA 4.0",
  "dates": {
    "lastVerified": "2026-10-08T00:00:00.000Z"
  },
  "authors": [],
  "sources": [
    {
      "title": "Speex project",
      "url": "https://www.speex.org/",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    },
    {
      "title": "Speex codec manual",
      "url": "https://www.speex.org/docs/manual/speex-manual/",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    },
    {
      "title": "FFmpeg codecs documentation — libspeex",
      "url": "https://ffmpeg.org/ffmpeg-codecs.html#libspeex",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    },
    {
      "title": "FFmpeg 9.0.2 libspeex encoder source",
      "url": "https://github.com/FFmpeg/FFmpeg/blob/n9.0.2/libavcodec/libspeexenc.c",
      "accessedAt": "2026-10-08T00:00:00.000Z"
    }
  ],
  "provenance": {
    "originUrl": "https://github.com/av1-community-contributors/codec-wiki/blob/37c3317fd058b23c71a87679bed5619a98f77752/docs/audio/Speex.mdx",
    "originCommit": "37c3317fd058b23c71a87679bed5619a98f77752",
    "migratedAt": "2026-08-21T00:00:00.000Z",
    "modified": true,
    "originPath": "docs/audio/Speex.mdx"
  },
  "headings": [
    {
      "depth": 2,
      "text": "Encoding and decoding",
      "anchor": "encoding-and-decoding"
    },
    {
      "depth": 2,
      "text": "Migrating to Opus",
      "anchor": "migrating-to-opus"
    }
  ],
  "sections": [
    {
      "id": "_preamble",
      "title": "Page introduction",
      "depth": 0,
      "canonicalUrl": "https://encode.wiki/codecs/audio/speex/",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/speex/_preamble.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/speex/_preamble.md",
      "checksum": "6f724a363cfd943459ac55118a527127847e870c622567d1b32877d41e62515b",
      "bytes": 674
    },
    {
      "id": "encoding-and-decoding",
      "title": "Encoding and decoding",
      "depth": 2,
      "anchor": "encoding-and-decoding",
      "canonicalUrl": "https://encode.wiki/codecs/audio/speex/#encoding-and-decoding",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/speex/encoding-and-decoding.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/speex/encoding-and-decoding.md",
      "checksum": "11098fbe99206290f7d7853f7f844916859d7c98f501c467c1aed1203d863a7a",
      "bytes": 694
    },
    {
      "id": "migrating-to-opus",
      "title": "Migrating to Opus",
      "depth": 2,
      "anchor": "migrating-to-opus",
      "canonicalUrl": "https://encode.wiki/codecs/audio/speex/#migrating-to-opus",
      "apiUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/speex/migrating-to-opus.json",
      "markdownUrl": "https://encode.wiki/api/v1/sections/docs/codecs/audio/speex/migrating-to-opus.md",
      "checksum": "7f1e94bbed426ab15948558f96465f8785ad60294e4260a2b33ff878d393dff5",
      "bytes": 257
    }
  ],
  "outboundReferences": [
    "/codecs/audio/opus/"
  ],
  "checksum": "b6bc199bad22994e1de430a91b40b7e4a8fe128bd80be4c1ef2408d3b3152bb2",
  "contentFormat": "markdown",
  "markdown": "Speex is a lossy speech codec from Xiph, designed for VoIP and other low-bitrate voice. Xiph's own site says it has been obsoleted by [Opus](/codecs/audio/opus/), which is better in every respect, and the last release (1.2.1) dates from 2022. Don't use Speex for new work. The only reasons to touch it are playing or converting old `.spx` files and talking to legacy VoIP equipment.\n\nSpeex works at three sampling rates: narrowband (8 kHz), wideband (16 kHz) and ultra-wideband (32 kHz). It handles speech, not music, and its quality is poor outside that. SpeexDSP, the companion library with resampling, echo cancellation and noise suppression, is separate and still used.\n\n## Encoding and decoding\n\nWith the reference tools:\n\n```sh\nspeexenc --wideband --quality 8 input.wav output.spx\nspeexdec output.spx output.wav\n```\n\n`--narrowband`, `--wideband` and `--ultra-wideband` say which rate the input is (8, 16 or 32 kHz); resample first, since speexenc warns about other rates. `--quality` goes 0–10.\n\nWith FFmpeg (needs `libspeex`):\n\n```sh\nffmpeg -i speech.wav -ar 16000 -c:a libspeex -b:a 24k speech.spx\n```\n\nFFmpeg's wrapper also exposes `-vad` and `-dtx` (voice activity detection and discontinuous transmission), `-abr 1` (average bitrate), `-frames_per_packet` (1–8) and `-compression_level` (0–10, default 3). It accepts mono or stereo at 8, 16 or 32 kHz.\n\n## Migrating to Opus\n\nRe-encoding Speex to Opus decodes and recompresses lossy audio, so keep the originals and expect some extra loss. Opus handles speech well at 24–32 kbit/s mono. `.spx` files use the Ogg container. Browsers do not play them natively.\n"
}
