render overlay graphics into camera video

你。 提交于 2019-12-06 05:14:52

问题


I want to make an app which takes a video from the camera, adds additional visual info (overlays) and creates a video file from it which can later be uploaded to a server. How to do that?

Without prior experience with such tasks, I assume there are 2 options:

  1. screen-capture and encoding to video file. However the resulting framerate may not be sufficient.
  2. record the video to sdcard and reencode later with added overlays. Live encoding is not needed, thus it's ok for the encoding process to be slower then realtime.

回答1:


You will have to resort to using for instance ffmpeg and the NDK to encode your own video. There's plenty of examples out there, but it's still somewhat cumbersome.




回答2:


Hope this helps:

Use RelativeLayout. Put the camera preview as the first child of the RelativeLayout and the VideoView as the second child. The VideoView will appear to be "on top of" the SurfaceView for the camera preview.

BTW, VideoView really is a SurfaceView. Note that you may decide someday to use a SurfaceView and MediaPlayer, rather than a VideoView, so you can get more control on video playback

Source: http://osdir.com/ml/Android-Developers/2010-03/msg00077.html



来源:https://stackoverflow.com/questions/5780968/render-overlay-graphics-into-camera-video

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