我正在尝试在Windows Phone 8上以特定分辨率(具体为480x480)捕获MP4视频。我知道我不能使用除预设大小之外的其他大小,而480x480不是预设大小。那么,如何转换已捕获的视频(例如640x480),并裁剪顶部和底部以使其成为480x480?欢迎使用任何免费或开源库(运行在Windows Phone上)。请不要回答“使用外部服务器”这样的答案,我需要一个设备内解决方案。
StorageFolder isoStore = await ApplicationData.Current.LocalFolder.GetFolderAsync("Shared");
var file = await isoStore.CreateFileAsync("foos1.wmv", CreationCollisionOption.ReplaceExisting);
using (var s = await file.OpenAsync(FileAccessMode.ReadWrite))
{
Windows.Foundation.Size resolution = new Windows.Foundation.Size(640, 480);
avDevice = await AudioVideoCaptureDevice.OpenAsync(CameraSensorLocation.Back,
AudioVideoCaptureDevice.GetAvailableCaptureResolutions(CameraSensorLocation.Back).Last());
VideoBrush videoRecorderBrush = new VideoBrush();
videoRecorderBrush.SetSource(avDevice);
viewfinderRectangle.Fill = videoRecorderBrush;
await avDevice.StartRecordingToStreamAsync(s);
Thread.Sleep(30000);
await avDevice.StopRecordingAsync();
}
new MediaPlayerLauncher()
{
Media = new Uri(file.Path, UriKind.Relative),
}.Show();
AudioVideoCaptureDevice.GetAvailableCaptureResolutions(sensor)
不包含所需的分辨率(例如,我需要192x144)。 - CAMOBAPGetAvailableCaptureResolutions(CameraSensorLocation.Back).Last()
,它返回了 640x480,但我需要的是 192x144。 - CAMOBAP