audio.filter

Run the rest of the branch only when the input matches format. Otherwise bytes pass through unchanged.

Config

type AudioFilterConfig = {
  format: 'mp3' | 'm4a' | 'opus' | 'flac' | 'wav'; // default 'mp3'
};

Example

// pipeline
{
  id: 'only-wav',
  type: 'audio.filter',
  config: { format: { value: 'wav' } },
}

// queue
tk.runQueue(files, 'audio')
  .filter({ format: 'wav' })
  .convert({ format: 'mp3', bitrate: 192 });

Place the filter before convert on that branch.