Cross-platform PowerShell module for safe, metadata-preserving audio transcoding with ffmpeg.
- FLAC, AIFF, WAV, and MP3 transcoding
- Metadata preserved by default using
-map_metadata 0 - Pipeline-friendly cmdlets with structured object output
- Batch processing with per-file results and aggregate exit code
- CLI wrapper for automation
- PowerShell 7.4+
- ffmpeg in
PATH
- Windows:
winget install Gyan.FFmpegorchoco install ffmpeg - macOS:
brew install ffmpeg - Linux:
apt install ffmpeg,dnf install ffmpeg, orpacman -S ffmpeg
trackstash.transcode/
|-- TrackStash.Transcode.psd1
|-- TrackStash.Transcode.psm1
|-- Public/
|-- Private/
Import the module:
Import-Module ./trackstash.transcode/TrackStash.Transcode.psd1 -ForceCheck ffmpeg availability:
Test-TrackStashFfmpegGet module and ffmpeg info:
Get-TrackStashTranscodeInfoTranscode one file to MP3 (default 320 kbps CBR):
Invoke-TrackStashTranscode -InputPath ./in/track.flac -OutputDirectory ./out -Format Mp3Pipeline transcode:
Get-ChildItem ./in/*.wav | Invoke-TrackStashTranscode -OutputDirectory ./out -Format FlacDry run:
Invoke-TrackStashTranscode -InputPath ./in/track.aiff -OutputDirectory ./out -Format Wav -WhatIfCLI script path: cli/trackstash-transcode.ps1
Example:
pwsh ./cli/trackstash-transcode.ps1 --input ./in/track.flac --output ./out --format Mp3 --verboseRun unit tests:
Invoke-Pester ./testsEnable optional integration tests:
$env:TRACKSTASH_TEST_FFMPEG = '1'
Invoke-Pester ./tests/Integration.Transcode.Tests.ps1- If import fails with an ffmpeg error, ensure ffmpeg is on
PATH. - For existing output files, pass
-Forceto overwrite. - In batch runs, inspect
.Resultsfor per-file errors and.ExitCodefor aggregate status.
This project is licensed under the MIT License. See LICENSE.
