C# 如何在windows phone 8和windows 8 metro中将动画和音频转换为视频
我正在开发一个应用程序,其中有一个动画,当动画播放时,用户可以唱他喜欢的歌曲,然后他可以用他唱的音频听动画,甚至可以在facebook或其他网站上分享。我所取得的成就是,a可以通过播放动画和音频在设备上播放,但我无法将其共享到facebook,因为它不是视频。有没有办法,我可以把它转换成视频和分享。我已经搜索了很多关于它的信息,但没有找到任何东西。您可以使用此代码编码和执行类似的操作C# 如何在windows phone 8和windows 8 metro中将动画和音频转换为视频,c#,windows-phone-7,windows-8,windows-phone-8,windows-store-apps,C#,Windows Phone 7,Windows 8,Windows Phone 8,Windows Store Apps,我正在开发一个应用程序,其中有一个动画,当动画播放时,用户可以唱他喜欢的歌曲,然后他可以用他唱的音频听动画,甚至可以在facebook或其他网站上分享。我所取得的成就是,a可以通过播放动画和音频在设备上播放,但我无法将其共享到facebook,因为它不是视频。有没有办法,我可以把它转换成视频和分享。我已经搜索了很多关于它的信息,但没有找到任何东西。您可以使用此代码编码和执行类似的操作 MediaItem src = new MediaItem(sourceAudioFile);
MediaItem src = new MediaItem(sourceAudioFile);
switch (outputAudioType)
{
case OutputAudioType.MP4:
src.OutputFormat = new MP4OutputFormat();
src.OutputFormat.AudioProfile = new AacAudioProfile();
src.OutputFormat.AudioProfile.Codec = AudioCodec.AAC;
src.OutputFormat.AudioProfile.BitsPerSample = 24;
break;
case OutputAudioType.WMA:
src.OutputFormat = new WindowsMediaOutputFormat();
src.OutputFormat.AudioProfile = new WmaAudioProfile();
src.OutputFormat.AudioProfile.Bitrate = new VariableConstrainedBitrate(128, 192);
src.OutputFormat.AudioProfile.Codec = AudioCodec.WmaProfessional;
src.OutputFormat.AudioProfile.BitsPerSample = 24;
break;
}
TimeSpan spanStart = TimeSpan.FromMilliseconds(startpoint);
src.Sources[0].Clips[0].StartTime = spanStart;
TimeSpan spanEnd = TimeSpan.FromMilliseconds(endpoint);
src.Sources[0].Clips[0].EndTime = spanEnd;
job.MediaItems.Add(src);
job.OutputDirectory = outputDirectory;
job.Encode();
return job.MediaItems[0].ActualOutputFileFullPath;
}
}