AudioSlim is a Tauri v2 desktop app for converting/compressing audio files using ffmpeg. The current state is a minimal scaffold: a single convert_to_mp3 Rust command with a hardcoded file path in the React frontend. The goal is to build a complete, usable app that supports multiple files, multiple output formats, and ffmpeg compression options.
Approach: System ffmpeg (not bundled). Output files saved alongside input files. Sequential file processing (ffmpeg is already multi-threaded internally). Show before/after file sizes after conversion.
productName→"AudioSlim",identifier→"com.audioslim.app"- Window: title →
"AudioSlim", size 900x700, addminWidth: 600,minHeight: 500
name→"audioslim",description→"Audio file converter and compressor"[lib] name→"audioslim_lib"- Add dep:
tauri-plugin-dialog = "2"
- Change
tauri_app_lib::run()→audioslim_lib::run()
name→"audioslim"- Add dep:
@tauri-apps/plugin-dialog: "~2"
- Add
"dialog:default"to permissions array
Rewrite the file completely. Remove commented-out template code, remove duplicate windows_subsystem attr.
OutputFormatenum: mp3, wav, aac, ogg, flac, m4a, mp4 (withextension()method)ConversionOptionsstruct: format, bitrate (Option), sample_rate (Option), channels (Option), quality (Option)ConversionProgressstruct: file_path, status, output_path, error, index, total, input_size (Option), output_size (Option)
- Run
ffmpeg -version, return first line or error if not found
- Build ffmpeg CLI args from ConversionOptions
- Handle format-specific codecs: aac/m4a/mp4 →
-c:a aac, ogg →-c:a libvorbis, mp4 → also-vn - Handle quality: mp3/ogg →
-q:a, flac →-compression_level - Always include
-y(overwrite) flag
- Takes
input_paths: Vec<String>,options: ConversionOptions,output_dir: Option<String> - Process files sequentially using
tokio::spawn_blockingfor the ffmpeg call - Emit
conversion-progressevents viaapp.emit()after each file - Include input/output file sizes in progress events (using
std::fs::metadata) - Handle same-format collision: append
_convertedto output filename - Validate input file exists before converting
- Continue processing on per-file errors (don't abort batch)
- Register plugins:
tauri_plugin_fs,tauri_plugin_dialog,tauri_plugin_shell - Register commands:
check_ffmpeg,convert_audio
- Types:
OutputFormat,ConversionOptions,FileStatus,AudioFile(includes inputSize/outputSize),ConversionProgress FORMAT_CONFIGSmap: per-format config for which options are available, default values, ranges- mp3: bitrate (64k-320k, default 192k), VBR quality (0-9)
- wav: no bitrate, no quality
- aac/m4a/mp4: bitrate only
- ogg: bitrate, quality (-1 to 10)
- flac: compression level (0-8)
- All formats: sample rate, channels
- Tauri native drag-and-drop via
getCurrentWebview().onDragDropEvent() - "Choose Files" button using
open()from@tauri-apps/plugin-dialog - Filter by audio extensions: wav, mp3, ogg, flac, aac, m4a, mp4, wma, aiff
- Returns full filesystem paths (not browser File objects)
- Row of buttons for: MP3, WAV, AAC, OGG, FLAC, M4A, MP4
- Highlighted active selection
- Dynamically shows relevant options based on selected format (uses FORMAT_CONFIGS)
- Bitrate: dropdown (64k, 128k, 192k, 256k, 320k) — only for lossy formats
- Sample rate: dropdown (22050, 44100, 48000, 96000) + "Default" option
- Channels: dropdown (Mono, Stereo) + "Default" option
- Quality: range slider — only when format supports it, with format-specific label
- Shows selected files with per-file status (Ready, Converting..., Done, Error)
- When done: show original size → output size (e.g. "4.2 MB → 1.1 MB") with human-readable formatting
- Remove button per file (when pending)
- "Clear All" button
- Color-coded status indicators
- Disabled when no files or converting in progress
- Shows file count in label
- State: files[], format, options, isConverting, ffmpegStatus/Error
useEffecton mount: invokecheck_ffmpeg, show error banner if missinguseEffect: listen toconversion-progressevents, update file statuseshandleFormatChange: reset options to format defaultshandleFilesSelected: deduplicate by path, append to listhandleConvert: invokeconvert_audiowith all file paths + options- Compose all components in order: DropZone → FileList → FormatSelector → OptionsPanel → ConvertButton
Rewrite completely. Clean, minimal design:
- CSS custom properties for theming (colors, spacing, border-radius)
- Dark mode via
prefers-color-scheme: dark .dropzone: dashed border, centered content, active state (blue) when dragging.format-buttons: horizontal row, pill-shaped buttons, active state filled.options-panel: 2-column grid for option groups.file-list: scrollable list, status color-coding (gray/blue/green/red).convert-btn: large prominent button.error-banner: red-tinted box for ffmpeg-missing state
| File | Action |
|---|---|
src-tauri/tauri.conf.json |
Modify |
src-tauri/Cargo.toml |
Modify |
src-tauri/src/main.rs |
Modify |
src-tauri/src/lib.rs |
Rewrite |
src-tauri/capabilities/default.json |
Modify |
package.json |
Modify |
index.html |
Modify |
src/types.ts |
Create |
src/App.tsx |
Rewrite |
src/App.css |
Rewrite |
src/components/DropZone.tsx |
Create |
src/components/FormatSelector.tsx |
Create |
src/components/OptionsPanel.tsx |
Create |
src/components/FileList.tsx |
Create |
src/components/ConvertButton.tsx |
Create |
pnpm tauri dev— app launches without errors- ffmpeg version shown on startup (or error banner if not installed)
- Drag audio files onto window — they appear in file list
- Click "Choose Files" — native dialog opens, filtered to audio files
- Select different formats — options panel updates dynamically
- Click Convert — files process sequentially with real-time status updates
- Output files appear in same directory as inputs
- Test error case: select a non-existent file path, verify graceful error per-file