mediametadataretriever

Extracting frame from video from storage device using MediaMetadataRetriever - IllegalArgumentException at setDataSource()

杀马特。学长 韩版系。学妹 提交于 2020-03-04 19:35:49
问题 I want to extract one frame from video in my app. The video is chosen from my storage device. After trying to call setDataSource I'm getting an IllegalArgumentException. Here is the part of my code: MediaMetadataRetriever med = new MediaMetadataRetriever(); med.setDataSource(imageUri.toString()); A value of imageUri is: content://com.android.providers.media.documents/document/video%3A59728 Is the path of my video in wrong format? I have also tried to use FFmpegMediaMetadataRetriever. 回答1: use

I want to create thumbnail from video url of server in android

无人久伴 提交于 2019-12-31 05:34:23
问题 My code, public static Bitmap retriveVideoFrameFromVideo(String videoPath) throws Throwable { Bitmap bitmap = null; MediaMetadataRetriever mediaMetadataRetriever = null; try { mediaMetadataRetriever = new MediaMetadataRetriever(); if (Build.VERSION.SDK_INT >= 14) mediaMetadataRetriever.setDataSource(videoPath, new HashMap<String, String>()); else mediaMetadataRetriever.setDataSource(videoPath); // mediaMetadataRetriever.setDataSource(videoPath); bitmap = mediaMetadataRetriever.getFrameAtTime(

how can get album art of song from url

风流意气都作罢 提交于 2019-12-25 04:57:10
问题 want get album art of song from url and this is my try so far : SongPath = "www.asd.com/music.mp3"; android.media.MediaMetadataRetriever mmr = new MediaMetadataRetriever(); try{ mmr.setDataSource(SongPath); }catch(Exception e){} byte [] data = mmr.getEmbeddedPicture(); if(data != null) { Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); imageView.setImageBitmap(bitmap); } else { imageView.setImageResource(R.drawable.jak); } but when run this code get this : call to get

MediaMetadataRetriever.setDataSource(Native Method) causes RuntimeException: status = 0xFFFFFFEA

旧巷老猫 提交于 2019-12-24 18:27:04
问题 I'm building a media player using ReactNative . In order to accomplish such app I had to export a module I built for retrieving music metadata like album, artist, etc as well as file path. The code above was working perfectly using jdk1.8.0_112 , but since I updated to jdk1.8.0_144 It stopped working. In this example, I'm not checking for not null, not empty, length > 0, etc, But I really do in the original one. try { MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr

Android: Bitmap.compress poor quality with PNG format

寵の児 提交于 2019-12-23 01:35:14
问题 My application captures video footage and saves it as .mp4 file. I would like to extract one frame from this video and also save it to file. Since I haven't found nothing better, I've decided to use MediaMetadataRetriever.getFrameAtTime() for that. It happens inside the class that inherits from AsyncTask. Here is how my code looks like my doInBackground() : Bitmap bitmap1 = null; MediaMetadataRetriever retriever = new MediaMetadataRetriever(); try { retriever.setDataSource(src); bitmap1 =

Get multiple thumbnails from video

百般思念 提交于 2019-12-22 04:30:49
问题 I'm using MediaMetadataRetriever to retrieve thumbnails at a specific time in video. This is how I achieve this: MediaMetadataRetriever metadataRetriever = new MediaMetadataRetriever(); try { metadataRetriever.setDataSource(MainActivity.this, Uri.parse("android.resource://packageName/raw/"+"test")); String duration=metadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); long time = Long.valueOf(duration)/3; Bitmap bitmap1 = metadataRetriever.getFrameAtTime(time

Android MediaMetadataRetriever wrong video height and width

╄→尐↘猪︶ㄣ 提交于 2019-12-12 10:54:38
问题 I want to retrieve height and width of video, I am using MediaMetadataRetriever class for this. It is working correct for most of the case, but for few case height and width are interchanged. I think this might be happening because of orientation change. My current code: MediaMetadataRetriever metaRetriever = new MediaMetadataRetriever(); metaRetriever.setDataSource(videoPath); videoHeight = metaRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT); videoWidth =

Android MediaMetadataRetriever fails to load metadata on old Samsung devices

时光毁灭记忆、已成空白 提交于 2019-12-11 07:26:45
问题 I'm facing a strange issue when using the android.media.MediaMetadataRetriever. It fails to extract the video width from video files on Samsung phones with Android version 4.0.4 and 4.1.2. The call metaRetriever.extractMetadata() seems to return either null or an empty string, as users of my app are reporting the VideoSetupException with error code ASVF_3. It works on the Google emulators with said Android versions and all other Android versions and devices. Any idea what might be causing

Use .setDataSource to get mediaMetadata from currently playing music app

主宰稳场 提交于 2019-12-02 13:43:23
问题 I want to get MediaMetadata (song title / artist) from the current playing android audio source for any app (spotify, google play, soundcloud, YouTube, blackplayer, etc) and am trying to use MediaMetadataRetriever.setDatSource Currently I have a function 'getActiveNotifications' in 'MainActivity.java' that gets called whenever a button is pressed, my code looks like this: public void getActiveNotifications(View view) { String temp ="temp"; Log.i("myTag", "Logging active notifications:"); /

Use .setDataSource to get mediaMetadata from currently playing music app

為{幸葍}努か 提交于 2019-12-02 08:28:48
I want to get MediaMetadata (song title / artist) from the current playing android audio source for any app (spotify, google play, soundcloud, YouTube, blackplayer, etc) and am trying to use MediaMetadataRetriever.setDatSource Currently I have a function 'getActiveNotifications' in 'MainActivity.java' that gets called whenever a button is pressed, my code looks like this: public void getActiveNotifications(View view) { String temp ="temp"; Log.i("myTag", "Logging active notifications:"); //get data from MediaMetaData somehow? Always displays correct string in Logcat MediaMetadataRetriever mmr