I have to get the frame of a video file (it can be on sdcard, cache dir or app dir) I have my own Package in the application Android There is a media and inside I have a class media maturation rattler. To get the first frame in bitmap, I use the code:
public static bitmap getVideoFrame (reference reference, URI videoURI) {MediaMetadataRetriever retriever = new MediaMetadataRetriever (); Try {Tryriever.setMode (MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY); Retriever.setDataSource (Reference, VideoURI); Return Retriever CaptureFrame (); } Hold (illegal prosecution conclusion) {new runtime exception (); } Hold (Runtime Expectations) {new runtime exposure (throw); } Finally {retriever.release (); }} But this is not working on it. When I set up a data source, it throws exceptions (java.lang.RuntimeException: setDataSource failed: status = 0x80000000). Do you know how to code this code? Or do you have any similar (simple) solution without using ffmpeg or other external libraries? Video Yuri is a valid Yuri (media player can play video from that URI)
The following work for me Does:
public static bitmap getVideoFrame {file descriptor FD} {MediaMetadataRetriever retriever = new MediaMetadataRetriever (); Try {Tryriever.setDataSource (FD); Retired retriever.getframitetime (); } Hold (invalid archive exception exemption) {ex.printStackTrace (); } Hold (Runtime Express Ex) {ex.printStackTrace (); } Finally {try} retriever.release (); } Hold (pre-runtime expense) {}} return tap; } This also works if you use the path instead of the claimant.
Comments
Post a Comment