Question

I'm looking for a way to compress wav files to some other format - mp3, wma or ogg. Is there any library I could use? Lame would not work in a WinStore app, or would it?

Était-ce utile?

La solution

There is transcoding support in the Windows.Media.Transcoding namespace. There is a sample for video but audio should be supported too. Looking at MediaEncodingProfile it seems aac, wma and mp3 are supported.

*EDIT (usage sample)

var profile = MediaEncodingProfile.CreateMp3(AudioEncodingQuality.High);
var transcoder = new MediaTranscoder();
var folder = ApplicationData.Current.LocalFolder;
var mp3File = await folder.CreateFileAsync(
    mp3FileName,
    CreationCollisionOption.ReplaceExisting);
var transcode = await transcoder.PrepareFileTranscodeAsync(wavFile, mp3File, profile);
await transcode.TranscodeAsync();
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top