4

Last time I've investigated video exporting on android (Adding watermark bitmap over video in android: 4.3's MediaMuxer or ffmpeg) it wasn't an easy task.

Here's a scenario: I have a SurfaceView and a drawn BitMap at x,y coordinates. The user taps on the images and drags it around to step 2 and step 3.

enter image description here

So basically if I record all the x,y through which the touch went, I can replay the animation by drawing the BitMap at a certain framerate.

Now here's the question: is there an easy way to record the "animation" from the SurfaceView into a video file by using android components (no ffmpeg) ?

Alin
  • 14,809
  • 40
  • 129
  • 218

2 Answers2

1

Since you're doing the rendering, you can just render it twice: once to the display, once to a video. This assumes you only want the SurfaceView contents... if you want the other Views as well, then you need to use a screen recording approach.

For a working example, see "Record GL App" in Grafika. For API 21+, you can render onto a MediaRecorder's Surface, which will likely be easier if you just want a .mp4 file.

fadden
  • 51,356
  • 5
  • 116
  • 166
0

As far as I know, to record the events of the SurfaceView, you have to record the screen since the SurfaceView is different and does not draw in the normal view hierarchy.

In fact, there are cases where the display data for the SurfaceView isn't even accessible to the app processor - it may be the output of a hardware video pipeline that is composited with the display output of the app processor through a dedicated video overlay. Google Groups

A Creative way can be to capture the screen simultaneously during the event and create a MOV from the bitmaps. Please See : Create Video From Screen Capture

Lucem
  • 2,912
  • 3
  • 20
  • 33