Android video playback frequency

I need to make a video player that can gradually change the playback speed from 0 to about 200%. It should run very fast, as it will play back HD movies recorded at high frames (60 FPS). Lower resolution can be used if it is not possible to support HD.

The code should only run on relatively tall Android tablets with the h264 hardware decoder, and ICS (without jelly Bean is available for target tablets).

I did not find support for changing the video playback speed on the Android system, and I suspect that I need to dig quite deep into JNI to get there, but I would like to ask here first if anyone has any code, suggestions or that may me to help.

+6
source share
2 answers

I had an android user from vitamin. In this case, the media player has the ability to set the playback speed. those. mMediaPlayer.setPlaybackSpeed ​​(speed); Set the video and audio playback speed. Parameters: speed, for example. 0.8 or 2.0, default 1.0, range in [0.5-2]

Please follow the link: http://www.vitamio.org/en/docs/news/2013/0529/19.html

+2
source

I'm doing something similar, and here are some of my findings that may come in handy:

  • If you downloaded android ndk r7 or later, ndk-> samples-> native-media is a sample project that jni uses to launch its own Android media player.
  • This uses the OpenMAXAL.h library (which is included in ndk): you will notice the XA_IID_PLAYBACKRATE interface. On a decent reference map , but thin on the samples. It seems like he should do what we want.
  • The sample indicates minSdkVersion = 14 , so it should work on your ICS devices.
  • I tested this on the only ICS + device available to me, a 16GB ASUS Nexus7 running 4.2 (Jellybean), and I got the following results in my notes journal (without my own debugging statements)

     01-15 14:19:33.384: W/libOpenSLES(6037): class MediaPlayer interface 1 requested but unavailable MPH=75 01-15 14:19:33.384: W/libOpenSLES(6037): Leaving Object::GetInterface (SL_RESULT_FEATURE_UNSUPPORTED) 01-15 14:19:33.384: A/libc(6037): jni/native-media-jni.c:409: Java_com_example_nativemedia_NativeMedia_createStreamingMediaPlayer: assertion "XA_RESULT_SUCCESS == res" failed 01-15 14:19:33.384: A/libc(6037): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 6037 (ple.nativemedia) 

    in a function that loads a media stream (or file) and creates its own instance of a media player. These errors indicate that this feature is not supported on my device / decoder, my OS, or my file type. I’m not sure which one (or combination), but if it is the first one, this probably means that there are not many devices that will support the desired function. Nexus7 may be an outlier, but unfortunately this is still a significant part of the tablet’s space, and we cannot expect more consistency in other devices.

If someone follows these notes and succeeds in getting everything to work, make a comment - I will continue to crack it and try to get it to work, and it will be updated with any progress.

+1
source

All Articles