如何在WP8中使用AudioVideoCptureDevice录制视频 [英] How to record video using AudioVideoCptureDevice in WP8

查看:156
本文介绍了如何在WP8中使用AudioVideoCptureDevice录制视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此处表示我可以使用AudioVideoCaptureDevice录制视频,但没有提供示例或帮助.

Here its stated that I can record video using AudioVideoCaptureDevice but there is no sample or help provided.

我需要做以下事情:
-将视频录制到流中完成
-显示已录制视频的缩略图(可以是录制视频时捕获的帧)完成
-重播录制的视频完成
-更改摄像机的分辨率和类型(前后)完成

I need to do the following things:
- record the video into a stream DONE
- display a thumbnail of video recorded (can be a frame captured while video recording) DONE
- replay the video recorded DONE
- change resolution and type of camera (front/back) DONE

如何实现这一目标?有样品吗?我找不到他们.请帮助我.

How to achieve this? Are there any samples? I am unable to find them. Please help me.

完成
-将视频录制到流中
-重播录制的视频
-更改分辨率和相机类型(前/后)
-显示已录制视频的缩略图(可以是在录制视频时捕获的一帧)

DONE
- record the video into a stream
- replay the video recorded
- change resolution and type of camera (front/back)
- display a thumbnail of video recorded (can be a frame captured while video recording)

新问题
-前置摄像头视频镜面倒置.我可以在使用转换录制时更改此设置,但实际的视频仍会被镜像.

NEW PROBLEMS
- front camera video is mirror inverted. I am able to change this while recording using transform but the actual video is still mirrored.

更新
-计算录制视频的大小并显示.它不起作用. Stream.Size提供随机值.

UPDATE
- calculate the size of the recording video and display it. Its not working. Stream.Size is giving random values.

对解决这些问题有何想法?

Any thoughts on solving these?

推荐答案

对于显示录像缩略图的问题……在AudioVideoCaptureDevice上有一个名为PreviewFrameAvailable的事件.我想如果您设置此事件处理程序,它将告诉您何时有数据可获取视频的预览(图像/缩略图).

For the problem of Displaying a Thumbnail of the video recording...there is an event called PreviewFrameAvailable on the AudioVideoCaptureDevice. I think if you setup this event handler it will tell you when the data is available to get a preview (image/thumbnail) of the video.

还有3种方法来获取预览图像的字节数组(GetPreviewBufferARGB,GetPreviewBufferY,GetPreviewBufferYCbCr).所有这三种方法都以相应的格式返回图像的像素数据的byte [](例如:GetPreviewBufferARGB应该以ARGB格式返回原始位图的原始字节).获得预览数据的字节数组后,您应该可以将其编码为PNG或JPEG或您喜欢的任何压缩图像格式.祝你好运.

There are also 3 methods for grabbing a byte array of a preview image (GetPreviewBufferARGB, GetPreviewBufferY, GetPreviewBufferYCbCr). All three of these methods return a byte[] of the pixel data for the image in the corresponding format (ex: GetPreviewBufferARGB should return the raw bytes of a raw bitmap in ARGB format). After getting the byte array of the preview data you should be able to encode it as a PNG or JPEG or whatever compressed image format you prefer. Best of luck.

这篇关于如何在WP8中使用AudioVideoCptureDevice录制视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆