google/ExoPlayer · error · AudioProcessor.UnhandledAudioFormatException

Unhandled input format: {inputAudioFormat}

Error message

Unhandled input format: {inputAudioFormat}

What it means

SilenceSkippingAudioProcessor strips long silences from PCM audio (used for features like automatic silence skipping and speed ramping, e.g. in IMA/Sonic-based paths). During configuration it only accepts ENCODING_PCM_16BIT input; any other encoding causes UnhandledAudioFormatException so the audio chain can be rebuilt without this processor rather than corrupt the audio.

Source

Thrown at library/core/src/main/java/com/google/android/exoplayer2/audio/SilenceSkippingAudioProcessor.java:157

    this.enabled = enabled;
  }

  /**
   * Returns the total number of frames of input audio that were skipped due to being classified as
   * silence since the last call to {@link #flush()}.
   */
  public long getSkippedFrames() {
    return skippedFrames;
  }

  // AudioProcessor implementation.

  @Override
  @CanIgnoreReturnValue
  public AudioFormat onConfigure(AudioFormat inputAudioFormat)
      throws UnhandledAudioFormatException {
    if (inputAudioFormat.encoding != C.ENCODING_PCM_16BIT) {
      throw new UnhandledAudioFormatException(inputAudioFormat);
    }
    return enabled ? inputAudioFormat : AudioFormat.NOT_SET;
  }

  @Override
  public boolean isActive() {
    return enabled;
  }

  @Override
  public void queueInput(ByteBuffer inputBuffer) {
    while (inputBuffer.hasRemaining() && !hasPendingOutput()) {
      switch (state) {
        case STATE_NOISY:
          processNoisy(inputBuffer);
          break;
        case STATE_MAYBE_SILENT:
          processMaybeSilence(inputBuffer);

View on GitHub (pinned to dd430f7053)

Solutions

  1. Disable silence skipping for high-res/float content.
  2. Force 16-bit PCM output by disabling float output on the decoder side (do not request ENCODING_PCM_FLOAT; on API 21-22 avoid float output flags).
  3. Catch the exception at configuration and rebuild the sink without silence skipping before retrying playback.
  4. Check the incoming Format encoding before enabling processors and skip processors for non-16-bit media.

Example fix

// before
new DefaultAudioSink.Builder(ctx)
    .setSilenceSkippingEnabled(true) // all content
    .build();

// after — only for 16-bit-capable content
new DefaultAudioSink.Builder(ctx)
    .setSilenceSkippingEnabled(isPcm16Content)
    .build();
Defensive patterns

Strategy: validation

Validate before calling

boolean silenceSkipSafe =
    decodedFormat.sampleMimeType.equals(MimeTypes.AUDIO_RAW)
        && decodedFormat.pcmEncoding == C.ENCODING_PCM_16BIT;
sinkBuilder.setSilenceSkippingEnabled(silenceSkipSafe);

Try / catch

try {
  configureSink(silenceSkipping = true);
} catch (AudioProcessor.UnhandledAudioFormatException e) {
  configureSink(silenceSkipping = false); // rebuild chain without the processor
}

Prevention

When it happens

Trigger: Enabling silence skipping (e.g. via DefaultAudioSink.Builder.setSilenceSkippingEnabled or experimental speed-changing pipelines) while the decoded audio is 24/32-bit PCM or float rather than 16-bit.

Common situations: Devices decoders outputting ENCODING_PCM_FLOAT; apps enabling audio processors while playing high-resolution PCM; version upgrades where float output became the default; combining silence skipping with offload (offload bypasses the PCM chain anyway).

Related errors


AI-assisted analysis of google/ExoPlayer@dd430f7053 (2026-08-14). Data as JSON: /api/errors/889fb34355336b41. Report an issue: GitHub.