Skip to content

Feature Request: Expose libswresample options in AudioResampler #2262

Closed

Description

@lminer

It would be great to have an API for passing FFmpeg libswresample options through av.audio.resampler.AudioResampler.

Currently, AudioResampler exposes the target audio format, layout, and sample rate:

resampler = av.AudioResampler(
    format="fltp",
    layout="mono",
    rate=16000,
)

This works well for basic resampling, but it does not appear to expose the underlying SwrContext options that control resampling quality/speed tradeoffs. In FFmpeg these include options such as:

filter_size
phase_shift
linear_interp
cutoff
dither_method
resampler=swr|soxr
precision        # for soxr
cheby            # for soxr

This matters for audio/ML and archival/media-processing use cases where resampling quality, determinism, and backend choice are important. In particular, FFmpeg’s libswresample can use the SoX resampler via resampler=soxr when FFmpeg is built with SoXr support, but there does not seem to be a direct way to request that through AudioResampler.

A possible API might be:

resampler = av.AudioResampler(
    format="fltp",
    layout="mono",
    rate=16000,
    options={
        "resampler": "soxr",
        "precision": "28",
        "cutoff": "0.95",
    },
)

Activity

  1. added a commit that references this issue on Jun 9, 2026
    fc463fa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions