是否可以通过缓冲区将摄像机中的视频录制到文件中?

发布于 2024-12-04 10:23:43 字数 315 浏览 6 评论 0 原文

特别是,这是我想要的设置:Android 设备上的内置摄像头正在录制实时视频。该视频正在保存到缓冲区,其中保存了几秒钟的视频。当缓冲区已满时,缓冲区中最旧的帧将添加到磁盘上的视频文件中,以便为来自摄像机的新帧腾出空间。然后,缓冲区中的数据可用于在视频中短暂向后跳跃。

我想我们应该使用 mediaRecorder (和 mediaPlayer?) 与 Surface 来获取视频,分别使用 addCallbackBuffer 创建缓冲区,然后使用 setPreviewCallbackWithBuffer 从缓冲区显示视频。我不完全确定从那里该去哪里,或者这是否完全是错误的道路;我在这方面有点新手。

In particular, this is the setup I want: The built-in camera on an Android device is recording live video. This video is being saved to a buffer, which holds a few seconds of video. When the buffer is full, the oldest frames from the buffer are added to a video file on disk to make room for the new frames coming from the camera. The data in the buffer could then be used to skip backwards briefly in the video.

I was thinking we'd use mediaRecorder (and mediaPlayer?) with a Surface to obtain the video, respectively, use addCallbackBuffer to create the buffer, and then use setPreviewCallbackWithBuffer to display the video from the buffer. I'm not entirely sure where to go from there or if that is the wrong track altogether; I am somewhat of a novice at this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

懒猫 2024-12-11 10:23:43

MediaRecord 已经为您进行缓冲和文件写入。

如果您确实需要控制细节,请关注:http://code.google.com/p/android-video-conference/source/browse/trunk/trunk/Android/upStream/src/my/video/stream/Stream.java

MediaRecord is already doing buffering and file writing for you.

If you do need control the details, have an eye on : http://code.google.com/p/android-video-conference/source/browse/trunk/trunk/Android/upStream/src/my/video/stream/Stream.java

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文