8

I want to make app with frame by frame playback feature. I guess it's not possible with standard android tools. I tried VideoView and seekTo(current + 1000/framerate) method, but it doesn't work (i guess it won't seek on paused video). My question is: What do i need to learn and use to make it possible, what tools and/or libs? I'm android beginner and i didn't work on video rendering earlier so my knowledge about this is really low.

kborkows
  • 158
  • 3
  • 11
  • 1
    Check out [MediaMetadataRetriever.getFrameAtTime()](http://developer.android.com/reference/android/media/MediaMetadataRetriever.html#getFrameAtTime(long)). It allows you to get specific frames – Inon Stelman Aug 08 '13 at 11:50
  • 1
    @inistelm I tried it but it seems like it's not fast enough, it takes about 2-3 sec to change frame and that's definitely too long. – kborkows Aug 08 '13 at 12:48
  • You might try to buffer some frames in advance so that it would look seamless to the user – Inon Stelman Aug 08 '13 at 12:54
  • @inistel, it might work but anyway I need another solution, cause i want to play video normally also. Just like Media Player Classic on pc, you play video normally but u can pause it and watch it frame by frame. – kborkows Aug 08 '13 at 18:51
  • Hi, did you find any solution to this? I'm struggling with the same problem right now. :-/ – Jerry Jul 05 '17 at 13:00

1 Answers1

3

A few years passed ,but the issue is still there

A short review about the topic:
Assuming you have a compressed video, like mp4 file. What you asking for, is to play frame by frame, but because of the compression, the frames are not actually there (look about i,p and b frames at this Wiki). So Android need to generate this frames for you. This generation may be far from optimal (it skipped about 3% frames in my case), and may not be supported on some devices , because there are different codecs used.

In case you are planning to run some Algo over it, I suggest extracting the frames first, as a jpg images, and then read them one by one.

I used the ffmpeg wrapper from here by hiteshsondhi88 to archive the extraction. It's very easy to use, and works smoothly.

In case your still want to go with pure Java, there is a great job done by Fadden. There is a few examples how to use media codec and get frames.

Moreover, I've written a small example on this, that can be found at my Git repository

There is also a discussion about it that in another StackOverflow question, but I have not tried it yet, to approve.

Arkady
  • 624
  • 1
  • 8
  • 17