Open DeVictorVH opened 1 year ago
In your test application use the following code: Bitmap b = fmmr.getFrameAtTime(); if (b != null) { Bitmap b2 = fmmr.getFrameAtTime(4000000, FFmpegMediaMetadataRetriever.OPTION_CLOSEST_SYNC); if (b2 != null) { b = b2; } } This fixes the problem but calls getFrameAtTime() 2 times. Is this a hack and how does it work?
same problem ,hope to solved it
Are all of your videos greater or equal to 10000000L in length? If not, then the library is probably returning the last available frame in the video, which may be black, since your timestamp exceeds the content duration.
The duration of the videos is greater than 10000000L.
Some months ago I tried to fix the error, so I downloaded the project, started modifying the native code and if I remember correctly the problem was that FFmpeg couldn't do seek in some situations.
That makes sense. Thanks for the reply @DeVictorVH. Sorry this library didn't quite meet your needs.
That makes sense. Thanks for the reply @DeVictorVH. Sorry this library didn't quite meet your needs.
Bitmap b = fmmr.getFrameAtTime(); if (b != null) { Bitmap b2 = fmmr.getFrameAtTime(4000000, FFmpegMediaMetadataRetriever.OPTION_CLOSEST_SYNC); if (b2 != null) { b = b2; } }
This is in the test app but I don't understand why it fixes the problem.
Can you let the lib avoid crash?
final FFmpegMediaMetadataRetriever retriever = new FFmpegMediaMetadataRetriever(); retriever.setDataSource(source.getPath()); final Bitmap bitmap = retriever.getScaledFrameAtTime(10000000L, width, height);
It returns black bitmap on some videos, but using a different option (FFmpegMediaMetadataRetriever.OPTION_CLOSEST, OPTION_CLOSEST_SYNC, etc) fixes it but others get the same problem;
Tested on a Redmi 9 (android 11) and Bluestacks emulator (android 7)