iknow4x / Android-Video-Trimmer

The Android-Video-Trimmer project implements the selection of clips for long and short videos. It uses MediaMetadataRetriever to obtain video frames, and uses ffmpeg for video cropping and video compression.
Apache License 2.0
1.11k stars 264 forks source link

MediaMetadataRetrieverJNI: getFrameAtTime: videoFrame is a NULL pointer #33

Closed mohanrajsambath closed 5 years ago

mohanrajsambath commented 5 years ago

E/MediaMetadataRetrieverJNI: getFrameAtTime: videoFrame is a NULL pointer

I recorded a video in SamsungS7 edge back camera, I have integrated Camera-2-API in my project, I try to trim video at this moment this crash will happen, I maintain resolution for recording is 1920x1080 resolution. Here is my log.

I/System.out: SCREEN_WIDTH_FULL:1440
I/System.out: RECYCLER_VIEW_PADDING:140
I/System.out: VIDEO_FRAMES_WIDTH:1160
I/System.out: THUMB_WIDTH:116
I/System.out: THUMB_HEIGHT:200
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
W/System.err:     at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:733)
W/System.err:     at com.ibot.cyranoapp.utils.VideoTrim.TrimVideoUtil$2.execute(Unknown Source:173)
W/System.err:     at com.ibot.cyranoapp.activity.videotrimmer.BackgroundExecutor$Task.run(Unknown Source:19)
W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/System.err:     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W/System.err:     at java.lang.Thread.run(Thread.java:764)

Please help to resolve this issue. Thanks in advance.

iknow4x commented 5 years ago

Thank you for feedback! Sometimes you may not get the bitmap of the key frame of the video. So you need to make a legal judgment on the acquired bitmap.