I saw a lot of old questions about this, maybe now there are some solutions. I want to take a screenshot of the current frame of my video. Videoview shows live video using rtsp stream.
I'm trying to take a bitmap, but it's always black
public static Bitmap loadBitmapFromView(View v) {
Bitmap b = Bitmap.createBitmap(v.getLayoutParams().width , v.getLayoutParams().height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
v.layout(0, 0, v.getLayoutParams().width, v.getLayoutParams().height);
v.draw(c);
return b;
}
EDIT:
MediaMetadataRetriever does not work with the channel URL, it may work with the video file. Using lib in this link (this is a shell MediaMetadataRetrieverthat allows rtsp input ), I can save the video frame, but there is a delay of 10 seconds to watch the video in real time, since it should create a new connection to the streaming server.
I have not tested ThumbnailUtils, but in Api I read that the input is just the file path
source
share