-1

I have one problem:

I'm using code on this site: android-er to make a gif.

Problem: When I make a video and try to convert it to a GIF (Video is 10 sec.) I can get only max. 10 frames from the video. When i change this:

for(int i=0; i<100; i+=10){
  long frameTime = maxDur * i/100;
  bmFrame = mediaMetadataRetriever.getFrameAtTime(frameTime);
  animatedGifEncoder.addFrame(bmFrame);
  publishProgress(i);
}

to make more frames: (for i=0;i<100;i+=2) It doesn't show me 50 frames. It only show 10 and the rest 40 are coppies of that 10 frames. It only takes key frames, I tried with getFrameAtTime(frameTime, OPTION_CLOSEST) and it was same. I hope you understand my problem. Thanks

Alen
  • 949
  • 3
  • 17
  • 37

1 Answers1

0

bmFrame = mmRetriever.getFrameAtTime(time*1000, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);

first param -> μs; second param -> use OPTION_CLOSEST_SYNC

  • Hello, Time is already in μs and I already used every option: OPTION_CLOSEST (_SYNC), OPTION_PREVIOUS(_SYNC), OPTION_NEXT. And it didn't work. It only showed key frames – Alen Sep 08 '15 at 15:00
  • If there are many null pointer exception,this is my code,I hope it is useful: http://www.oschina.net/code/snippet_266004_50774 But I also have a few questions unsolved: 1. The GIF files I need to compress it, 2. Sometimes OOM – Joyce Zhang Sep 09 '15 at 04:11