0
我正在使用Windows 10通用应用程序中的音频录制,我发现代码here当我运行该代码时,它显示“找不到合适的变换来编码或解码内容“错误,在手机中任何一个请帮我解决这个问题。没有找到合适的变换来编码或解码内容错误
我正在使用Windows 10通用应用程序中的音频录制,我发现代码here当我运行该代码时,它显示“找不到合适的变换来编码或解码内容“错误,在手机中任何一个请帮我解决这个问题。没有找到合适的变换来编码或解码内容错误
当我运行该代码它显示“没有合适的变换,发现编码或解码的内容”错误
如果你指的MediaEncodingProfile.CreateMp3,你会看到下面的段落。
注意虽然在技术上是可以调用CreateMp3,您不能使用此配置文件进行转码或音频编码成的Windows Phone Store应用程序的MP3格式。这是因为MP3编码器不随Windows Phone一起提供。此API包含了完整性,并允许您将其与您的应用中包含的第三方MP3编码器一起使用。
所以,如果你想这个应用程序与Windows Phone一起工作,你不能使用MediaEncodingProfile.CreateMp3
。您可以使用MediaEncodingProfile.CreateM4a代替(请修改代码在演示像下面):
MainPage.xaml.cs中:
public sealed partial class MainPage : Page
{
MediaCapture capture;
InMemoryRandomAccessStream buffer;
bool record;
string filename;
string audioFile = "audio.mp4";//originally was audioFIle=".mp3"
...
private async void recordBtn_Click(object sender, RoutedEventArgs e)
{
if (record)
{
//already recored process
}
else
{
await RecordProcess();
//await capture.StartRecordToStreamAsync(MediaEncodingProfile.CreateMp3(AudioEncodingQuality.Auto), buffer);//comment this line out
await capture.StartRecordToStreamAsync(MediaEncodingProfile.CreateM4a(AudioEncodingQuality.Auto), buffer);//added this line
if (record)
{
throw new InvalidOperationException();
}
record = true;
}
}
下面是完整的修改样本:AudioRecorderSample。