Reputation: 31
I want to convert a .avi
video file to a .mp3
audio file and used the following code:
var folder = ApplicationData.Current.LocalFolder;
var video = await folder.GetFileAsync("video.avi");
var targetFile = await folder.CreateFileAsync("audio.mp3");
var profile = MediaEncodingProfile.CreateMp3(AudioEncodingQuality.Auto);
var transcoder = new MediaTranscoder();
var prepareTask = transcoder.PrepareFileTranscodeAsync(video, targetFile, profile);
However transcoder.PrepareFileTranscodeAsync(video, targetFile, profile);
throws a NullReferenceException
despite neither transcoder
, video
, targetFile
or profile
is null
.
Upvotes: 1
Views: 102
Reputation: 31
Nevermind found the issue AudioEncodingQuality.Auto
is not working when the target file is empty. Using AudioEncodingQuality.High
or something else works fine.
Upvotes: 1