android-MediaCodec在每个视频帧上记录带有时间戳的视频 [英] android - MediaCodec record video with timestamp on each video frame

查看:133
本文介绍了android-MediaCodec在每个视频帧上记录带有时间戳的视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在每个视频帧上记录带有时间戳的视频.我在 cts 中看到了一个示例,该示例使用InputSurace.java和OutputSurface.java连接Decoder和Encoder对视频文件进行转码.可以重用这两个android java类来实现时间戳录像机吗?

I need to record video with timestamp on each video frame. I see a example in cts which use InputSurace.java and OutputSurface.java to connect Decoder and Encoder to transcode video files. Is it possible to reuse these two android java class to implement a timestamp video recorder?

我尝试将OutputSurface用作Camera预览输出,并将InputSurface用作MediaCodec Encoder输入,但听起来只记录2或3帧,然后就永远挂在那里!

I try to use OutputSurface as Camera preview output and use InputSurface as MediaCodec Encoder input but sounds like only record 2 or 3 frames then it hang there forever!

推荐答案

花点时间探索这个

Take your time and explore this link to get an idea how to feed the Camera preview into a video file. Once you are confident about the mechanism, you should be able to feed the MediaCodec input surface with some kind of OpenGL magic to put extra graphics on the top of the Camera's preview. I would recommend to tweak the example code's drawExtra() as a start.

这篇关于android-MediaCodec在每个视频帧上记录带有时间戳的视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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