How to Record the Video through Camera, And Record the SystemTimeStamp over the Video

我的梦境 提交于 2021-02-03 06:12:12

问题


I need to design a app.That when Record the Video through Camera,Show and Record the SystemTimeStamp above the Video. Can it work with current Android Frameworks? If can, How can i do this? Thanks for anybody to read this!


回答1:


Follow the procedure below.
1. Capture video byte array (of each frame).
2. Now create bitmap from byte array.
3. Use link below to overlay text over bitmap.
4. Save those bitmaps to create video.

Text Overlay bitmap.




回答2:


You could follow a two-stage approach. First, record the video using the MediaRecorder API (which IMO is easier to use than MediaCodec - the Camera2 example is quite useful). Second, post-process the video with Taner Şener's wonderful mobile-ffmpeg, where you can simply add millisecond timestamps in the lower right corner with a command like:

FFmpeg.execute("-i \"" + pathToVideo + "\" -vf drawtext=\"fontsize=60:fontcolor=yellow@0.8:box=1:boxcolor=black@0.8:boxborderw=10:text='%
{e\\:" + startMillis + "+t*1000}':x=(w-text_w+6.8*max_glyph_w):y=(h-text_h)\" \"" + pathToVideo.replace(".mp4", "_overlaid.mp4" + "\""));


来源:https://stackoverflow.com/questions/18955655/how-to-record-the-video-through-camera-and-record-the-systemtimestamp-over-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!