wseemann / FFmpegMediaMetadataRetriever

FFmpegMediaMetadataRetriever provides a unified interface for retrieving frame and meta data from an input media file.
1.73k stars 387 forks source link

App crashes when extracting meta data information. #218

Open RowlandOti opened 4 years ago

RowlandOti commented 4 years ago

In an attempt to extract some metadata information regarding MediaProvider, I noticed that it crashes the app at some point in time when doing the folowing:

//val mmr = FFmpegMediaMetadataRetriever()
            val mmr = MediaMetadataRetriever()
            while (cursor.moveToNext()) {

                val currentId = cursor.getLong(id)
                val currentArtist = cursor.getString(artist)
                val currentTitle = cursor.getString(title)
                val currentDisplayName = cursor.getString(displayName)
                val currentSize = cursor.getLong(size)
                val currentDateAdded = cursor.getString(dateAdded)
                val currentDateModified = cursor.getString(dateModified)
                val currentDuration  = cursor.getLong(duration)

                val currentUri = ContentUris.withAppendedId(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, currentId)

                var currentSynopsis  = "-"
                var currentAlbum = "-"

                try {
                    mmr.setDataSource(KOKONetApp.INSTANCE.applicationContext,currentUri)
                    currentSynopsis  = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_COMMENT)
                    currentAlbum = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ALBUM)

                    Timber.d("%s%s", currentAlbum, currentSynopsis)
                } catch (e: Exception){
                   Timber.e(e)
                    Timber.e("%s%s", currentArtist, currentTitle)
                }

                list.add(
                    Video(
                        currentId,
                        currentArtist,
                        currentTitle,
                        currentDisplayName,
                        currentDuration,
                        currentSize,
                        currentDateAdded,
                        currentDateModified,
                        currentUri,
                        currentSynopsis,
                        currentAlbum
                    )
                )

It just exists this app with the following one liner:

A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 13467 (pool-5-thread-7)

What could be the issue?