AbedElazizShe / LightCompressor

A powerful and easy-to-use video compression library for android uses MediaCodec API.
Apache License 2.0
537 stars 116 forks source link

Videos don't have thumbnails #151

Closed akrulec closed 1 year ago

akrulec commented 1 year ago

After compressing the video, and trying to create thumbnail with ThumbnailUtils.createVideoThumbnail, the call fails with the following error

getEmbeddedPicture: Call to getEmbeddedPicture failed.
getFrameAtTime: videoFrame is a NULL pointer
Cannot store thumbnail: /storage/emulated/0/Android/data/com.mycopilot.copilotapp/files/Pictures/JPEG_20230316_113555_5574561444671949760.jpg 

I have also noticed that when opening a media picker right after the video was compressed and stored, the videos listed are black (eg. don't have any thumbnail generated). What is the recommended solution for this?

Thanks

akrulec commented 1 year ago

Same thing happens if I just do:

val mMMR = MediaMetadataRetriever()
mMMR.setDataSource(requireContext(), file.toUri())
mMMR.frameAtTime

Thanks

dicksonNG commented 1 year ago

I have the same issue with this. How could add back the videoFrame?