0

i am using SurfaceView for play video and i want to get image from running video, i have tried with getDrawingCache() but i am getting blank image or Black screen but when i draw image of any other layout which dont have video then this is working fine, so please anybody can solve this issue that How to get bitmap images from video or surfaceView. Thanks in advance please answer my question if you know. I have used this code but not getting result.

mVideo.setDrawingCacheEnabled(true);

  mVideo.buildDrawingCache();

  Bitmap b = mVideo.getDrawingCache();
Himanshu
  • 107
  • 2
  • 5

1 Answers1

0

This won't work because the video content is not "exposed" to the normal view layers.

If you are using API Level >= 10 you can use MediaMetadataRetriever getFrameAtTime. It's described here.

Even this may not return the exact frame as it is fairly hardware dependent.

The most sure way to do this is to use something like FFMPEG to access the stream yourself.

Ken Wolf
  • 22,320
  • 6
  • 55
  • 81
  • hi Ken Wolf can you give me some Example for understanding of FFMPFG ,i dont know how to take picture from video via FFMPEG . I have already searched over Net but i didnt get any helpful site. – Himanshu Jun 18 '13 at 12:01
  • I'm not an expert on FFMPG I'm afraid. I definitely know it's possible, but it will be quite a detailed solution. Maybe some other questions can help like this one (http://stackoverflow.com/questions/4725773/ffmpeg-on-android) – Ken Wolf Jun 18 '13 at 12:38