justsoft / video_thumbnail

This plugin generates thumbnail from video file or URL. It returns image in memory or writes into a file. It offers rich options to control the image format, resolution and quality. Supports iOS and Android.
MIT License
183 stars 238 forks source link

D/FileUtils( 6644): Failed to convert to modern format file descriptor #84

Closed pavel-k-codexoptimus closed 2 years ago

pavel-k-codexoptimus commented 3 years ago

I got strange error in this:

final thumbnail = await VideoThumbnail.thumbnailData(
          video: file.path,
          imageFormat: ImageFormat.JPEG,
          quality: 50,
        );
D/FileUtils( 7102): Failed to convert to modern format file descriptor
D/FileUtils( 7102): java.io.IOException: java.lang.IllegalStateException: java.io.IOException: stat failed: ENOENT (No such file or directory)
D/FileUtils( 7102):     at android.provider.MediaStore.getOriginalMediaFormatFileDescriptor(MediaStore.java:939)
D/FileUtils( 7102):     at android.os.FileUtils.convertToModernFd(FileUtils.java:1470)
D/FileUtils( 7102):     at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:304)
D/FileUtils( 7102):     at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:250)
D/FileUtils( 7102):     at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin.createVideoThumbnail(VideoThumbnailPlugin.java:199)
D/FileUtils( 7102):     at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin.buildThumbnailData(VideoThumbnailPlugin.java:114)
D/FileUtils( 7102):     at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin.access$100(VideoThumbnailPlugin.java:27)
D/FileUtils( 7102):     at xyz.justsoft.video_thumbnail.VideoThumbnailPlugin$1.run(VideoThumbnailPlugin.java:75)
D/FileUtils( 7102):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
D/FileUtils( 7102):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
D/FileUtils( 7102):     at java.lang.Thread.run(Thread.java:920)
D/FileUtils( 7102): Caused by: java.lang.IllegalStateException: java.io.IOException: stat failed: ENOENT (No such file or directory)
D/FileUtils( 7102):     at android.os.Parcel.createExceptionOrNull(Parcel.java:2433)
D/FileUtils( 7102):     at android.os.Parcel.createException(Parcel.java:2409)
D/FileUtils( 7102):     at android.os.Parcel.readException(Parcel.java:2392)
D/FileUtils( 7102):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
D/FileUtils( 7102):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
D/FileUtils( 7102):     at android.content.ContentProviderProxy.call(ContentProviderNative.java:732)
D/FileUtils( 7102):     at android.content.ContentResolver.call(ContentResolver.java:2450)
D/FileUtils( 7102):     at android.provider.MediaStore.getOriginalMediaFormatFileDescriptor(MediaStore.java:935)
D/FileUtils( 7102):     ... 10 more

Thumbnail worked good after that.

pavel-k-codexoptimus commented 2 years ago

Update: this arises only on Android 12.

justsoft commented 2 years ago

Make sure the file is existing and readable before calling the thumbnail functions.