1

我在这里使用微软提供的视频录制示例。我想更改在我的应用程序中录制的视频的分辨率。目前默认以最高分辨率录制。怎么做?

videoCaptureDevice.DesiredFormat = new VideoFormat(PixelFormatType.Unknown, 480, 640, 30);

上面的语句抛出了参数异常。

另外,如果可能的话,让我知道如何从前置摄像头捕捉?

如何做到这一点?请帮忙。

4

4 回答 4

0

第二个参数AudioVideoCaptureDevice.OpenAsync是分辨率。您可以使用AudioVideoCaptureDevice.GetAvailableCaptureResolutions(sensor).

于 2013-07-18T10:13:49.650 回答
0

你可以试试这个。

private AudioVideoCaptureDevice VideoRecordingDevice;
private Windows.Foundation.Size resolution = new Windows.Foundation.Size(320, 240);
VideoRecordingDevice = await AudioVideoCaptureDevice.OpenAsync(CameraSensorLocation.Back, resolution);

注意:请记住,它可能仅用于 wp8 或更高版本。

于 2015-01-12T11:31:05.067 回答
-1

使用 AudioVideoCaptureDevice 重新录制视频

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();
于 2013-08-07T10:58:35.407 回答
-1

解决方案是(据我所知)

     VideoCaptureDevice webcam = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice();

 int videoformatcount = webcam.SupportedFormats.Count(); //We will get the avilable video format

  if (videoformatcount > 0)
             {
                var Temp = webcam.SupportedFormats;

                VideoFormat objVideoFormat = Temp[videoformatcount - 1];

                webcam.DesiredFormat = new VideoFormat(PixelFormatType.Format8bppGrayscale, objVideoFormat.PixelWidth, objVideoFormat.PixelHeight, 1);
            }

captureSource.VideoCaptureDevice = webcam;

这将产生最低分辨率的视频

于 2013-07-19T06:28:23.343 回答