4

I have a video playing, and at some point, i need to pause the video, take a capture, and use then that image, to modify it, in a paint activity. The problem is that if, i try to save the video, the picture will be black (tried with setDrawingCacheEnabled(true); )........ Is it possible to take a screenshot of a video?

djvjvfvdfvhj
  • 147
  • 11
rosu alin
  • 5,674
  • 11
  • 69
  • 150
  • http://stackoverflow.com/questions/9714964/capture-screenshot-of-playing-video-and-mailing-that-screen-shot – Nirav Ranpara Jan 28 '13 at 07:53
  • Like i said, the getDrawingCache, setDrawingCache, does not work, because, the videoView extends an SurfaceView, wich has its content not go through the drawing cache, thus getting the black screen instead of a capture of the video – rosu alin Jan 28 '13 at 07:57

3 Answers3

6

Have you tried ThumbnailUtils.createVideoThumbnail(String, int)?

Aki Suihkonen
  • 19,144
  • 1
  • 36
  • 57
Buda Gavril
  • 21,409
  • 40
  • 127
  • 196
  • I am now trying with extractThumbnail, because i should not use the file path, and also, need to take the screen in the exact moment i am. – rosu alin Jan 28 '13 at 08:06
  • now, extractThumbnail, returns null, and of createVideoThumbnail, i don't understand it, even if i give the filename, and the kind of the bitmap, how can i choose from exactly what second of the video i want to take the screencapture? – rosu alin Jan 28 '13 at 08:24
  • 1
    have you tried http://stackoverflow.com/questions/5337505/android-capture-video-frame ? – Buda Gavril Jan 28 '13 at 08:49
  • the last link, with that getVideoFrame function worked, thanks a lot – rosu alin Jan 31 '13 at 09:51
  • Another thing, for this function, at getFrameAtTime() you can pass the time for what frame to get. My question is, how can i get the time from a videoView (seconds), i tried videoView.getCurrentPosition, but it's not really precise – rosu alin Jan 31 '13 at 09:59
  • @BudaGavril thanks, i was able to do this with a video stored locally on the phone. However, when the video is streamed in the VideoView, I can't seem to capture the video frame. Do you know how? – code Dec 12 '14 at 02:57
1

Try this Link ..

Hope it may help you

Screen capture

Bitmap saveBitmap = Bitmap.createBitmap(imageFrame.getWidth(), 
 imageFrame.getHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(saveBitmap);
imageFrame.draw(c);

For more info try this link

& this link

Community
  • 1
  • 1
Janmejoy
  • 2,721
  • 1
  • 20
  • 38
  • I;ve been looking at thes: http://stackoverflow.com/questions/11505093/how-to-capture-screenshot-of-surfaceview-with-background But i don't get it, overlaying 2 bitmaps, ok, how can this help me? I got an bitmap thats set on the canvas, and you draw on it, (its transparent, so u can see the video) and i have got an VideoView (extends Surface View), that is in the back of the transparent canvas. Now when i take a picture, i have to include the canvas and also the videoview. – rosu alin Jan 28 '13 at 11:41
  • @rosualin so you want to include videoview only or canvas too – Janmejoy Jan 28 '13 at 11:56
  • both. I need to include the video view and the canvas – rosu alin Jan 28 '13 at 13:39
-2

I Think u should use screencaputre application in android that is use full to you... rather than the best way for u can connect your android with PC than start the video and pause it, than in keyboard press print screen, and in paint software press ctrl+V (paste) and save in jpeg format than you get the screen shot/image...

  • I need to make an application that does this, I have to make it so it would be independent of pc's or other applications – rosu alin Jan 28 '13 at 08:04
  • Can You Use This link ? http://www.mightypocket.com/2010/08/android-screenshots-screen-capture-screen-cast/ I Hope this is help ful – Vbiz Solutions Jan 28 '13 at 09:58
  • nope, sorry, but it has to be programatically, no pc, no other applications, no usb connection, just from the app, you click a button and then it does the screenshot – rosu alin Jan 28 '13 at 14:21