3

I tried to run This example from bigflake and I think that there is a mismatch.

they write "ExtractMpegFramesTest.java (requires 4.1, API 16) " so the minimum API required is 16, but I look over the code and they use "import android.opengl.EGL14;" which required minimum API 17.

Has anyone encountered this problem and succeeded to solve it?(succeeded to save 10 frames on Android 4.1 device)

Itay
  • 73
  • 6

2 Answers2

3

I've updated the site to have two copies of the source file, one that uses EGL 1.0 and one that uses EGL 1.4. I did a quick test with the SDK, creating an app for API 16, to confirm that it's no longer using post-4.1 APIs. I haven't tried it on an actual device running 4.1 however.

fadden
  • 51,356
  • 5
  • 116
  • 166
  • 1
    First of all thank you very much for the update,There are no errors now. but there is a bug, after this line : boolean doRender = (info.size != 0); ,"doRender" get false all the time on galaxy s3, on galaxy s4 this example work well. – Itay Dec 11 '13 at 06:40
  • Ok, The example is finally work! I just don't use the doRender variable. – Itay Dec 12 '13 at 12:13
  • @Itay: I am trying to make ExtractMpegFramesTest work. Mainly I have a main activity with a button, and a class of ExtractMpegFramesTest. After I click the button, it will create an object of ExtractMpegFramesTest, and run the object.testExtractMpegFrames(). But it does not work. It complained java.lang.RuntimeException: frame wait timed out. Would you give me a clue to solve it? See my post: http://stackoverflow.com/questions/22139205/android-mediacodec-encoding-falis-because-no-sync-frames-for-video-track Thanks! – user1914692 Mar 04 '14 at 20:26
0

You can use MediaMetadataRetriever.getFrameAtTime in order to extract frames from a video file. It's available since API level 10.

jpm
  • 3,300
  • 1
  • 19
  • 29
  • I tried Media meta retriever before, but I need to decode 300 frames of 1920x1080 so it takes too long for me. – Itay Dec 10 '13 at 14:14
  • 1
    That call exists to extract a single thumbnail from a video stream. It's really not meant for extracting all frames from a video. – fadden Dec 10 '13 at 16:13
  • Yeah, it's probably not, I just didn't see a request for extracting 'all' (or 300) frames from a video in OP's question... – jpm Dec 10 '13 at 16:42
  • The other problem with `getFrameAtTime()` is that it's time-based, rather than frame-based. If the video wasn't recorded at a constant frame rate -- maybe it has a couple of frames, then nothing for a few seconds, then there's a few more -- you'll end up "creating" frames unnecessarily. Depending on the intended use of the data this may or may not matter. (See 4.4's `screenrecord` for an example of something that records video this way -- it only outputs a frame when the screen changes.) – fadden Dec 10 '13 at 17:30