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

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

问题描述

这里 它说我可以使用 AudioVideoCaptureDevice 录制视频,但没有提供示例或帮助.

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

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

如何实现?有样品吗?我无法找到它们.请帮帮我.

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).所有这三种方法都以相应格式返回图像像素数据的字节 [](例如: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天全站免登陆