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:
- screen-capture and encoding to video file. However the resulting framerate may not be sufficient.
- record the video to sdcard and reencode later开发者_C百科 with added overlays. Live encoding is not needed, thus it's ok for the encoding process to be slower then realtime.
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.
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
精彩评论