Giter Site home page Giter Site logo

wseemann / ffmpegmediametadataretriever Goto Github PK

View Code? Open in Web Editor NEW
1.7K 1.7K 381.0 1.72 GB

FFmpegMediaMetadataRetriever provides a unified interface for retrieving frame and meta data from an input media file.

Java 0.61% Makefile 0.03% C 98.15% C++ 0.41% Shell 0.39% CMake 0.01% Perl 0.26% Kotlin 0.11% Dockerfile 0.02%

ffmpegmediametadataretriever's Introduction

Hi there 👋

@wseemann's Holopin board

ffmpegmediametadataretriever's People

Contributors

wseemann avatar wseemannroku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ffmpegmediametadataretriever's Issues

not getting some metadata

Hi, I wanted to fetch metadata which gives the current song title.

FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
            mmr.setDataSource("http://stream.radiozu.ro:8020/");
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ALBUM);
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ALBUM_ARTIST);
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION);
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ICY_METADATA);
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_TITLE);
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ARTIST);
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_AUDIO_CODEC);
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DISC);
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_FILENAME);
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_FRAMERATE);
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_GENRE);
            mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_TRACK);

unfortunately, I'm not getting current song tite, listener peak, stream status. Here is my output:

02-02 07:21:39.389  22950-23009/com.codec.radio I/RADIO﹕ icy-genre :: CHR
02-02 07:21:39.389  22950-23009/com.codec.radio I/RADIO﹕ icy-name :: Radio ZU Live
02-02 07:21:39.389  22950-23009/com.codec.radio I/RADIO﹕ icy-notice2 :: SHOUTcast Distributed Network Audio Server/win32 v1.9.8<BR>
02-02 07:21:39.389  22950-23009/com.codec.radio I/RADIO﹕ filesize :: -38
02-02 07:21:39.389  22950-23009/com.codec.radio I/RADIO﹕ audio_codec :: aac
02-02 07:21:39.389  22950-23009/com.codec.radio I/RADIO﹕ icy-notice1 :: <BR>This stream requires <a href="http://www.winamp.com/">Winamp</a><BR>
02-02 07:21:39.389  22950-23009/com.codec.radio I/RADIO﹕ duration :: 0
02-02 07:21:39.389  22950-23009/com.codec.radio I/RADIO﹕ icy-br :: 32
02-02 07:21:39.389  22950-23009/com.codec.radio I/RADIO﹕ icy-pub :: 1
02-02 07:21:39.389  22950-23009/com.codec.radio I/RADIO﹕ icy-url :: http://www.radiozu.ro

Can you please help me out here. I want all the info as its shown here: http://stream.radiozu.ro:8020/

Thanks

Include in cordova project

Hi,

I tried to include the library to cordova project, but it's failing on this error :

E/FFmpegMediaMetadataRetriever(20120): FFmpegMediaMetadataRetriever libraries not found. Did you forget to add them to your libs folder?
W/dalvikvm(20120): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lwseemann/media/FFmpegMediaMetadataRetriever;
W/System.err(20120): java.lang.UnsatisfiedLinkError

I tried to compile by myself and printed out the list of browsed directories

D/SEARCHLIB(20120): /data/data/dalvik
D/SEARCHLIB(20120): /data/data/dalvik.system
D/SEARCHLIB(20120): /data/data/dalvik.system.VMStack
D/SEARCHLIB(20120): /data/data/java
D/SEARCHLIB(20120): /data/data/java.lang
D/SEARCHLIB(20120): /data/data/java.lang.Thread
D/SEARCHLIB(20120): /data/data/wseemann
D/SEARCHLIB(20120): /data/data/wseemann.media
D/SEARCHLIB(20120): /data/data/wseemann.media.FFmpegMediaMetadataRetriever
D/SEARCHLIB(20120): /data/data/de
D/SEARCHLIB(20120): /data/data/de.michael_bln
D/SEARCHLIB(20120): /data/data/de.michael_bln.capture_thumb
D/SEARCHLIB(20120): /data/data/de.michael_bln.capture_thumb.CaptureThumb
D/SEARCHLIB(20120): /data/data/org
D/SEARCHLIB(20120): /data/data/org.apache
D/SEARCHLIB(20120): /data/data/org.apache.cordova
D/SEARCHLIB(20120): /data/data/org.apache.cordova.CordovaPlugin
D/SEARCHLIB(20120): /data/data/org
D/SEARCHLIB(20120): /data/data/org.apache
D/CordovaLog(20120): file:///android_asset/www/js/gifMaker.js: Line 71 : 0
D/SEARCHLIB(20120): /data/data/org.apache.cordova
D/SEARCHLIB(20120): /data/data/org.apache.cordova.PluginManager
D/SEARCHLIB(20120): /data/data/org
D/SEARCHLIB(20120): /data/data/org.apache
D/SEARCHLIB(20120): /data/data/org.apache.cordova
D/SEARCHLIB(20120): /data/data/org.apache.cordova.PluginManager
D/SEARCHLIB(20120): /data/data/org
D/SEARCHLIB(20120): /data/data/org.apache
D/SEARCHLIB(20120): /data/data/org.apache.cordova
D/SEARCHLIB(20120): /data/data/org.apache.cordova.ExposedJsApi
D/SEARCHLIB(20120): /data/data/com
D/SEARCHLIB(20120): /data/data/com.android
D/SEARCHLIB(20120): /data/data/com.android.org
D/SEARCHLIB(20120): /data/data/com.android.org.chromium
D/SEARCHLIB(20120): /data/data/com.android.org.chromium.base
D/SEARCHLIB(20120): /data/data/com.android.org.chromium.base.SystemMessageHandler
D/SEARCHLIB(20120): /data/data/com
D/SEARCHLIB(20120): /data/data/com.android
D/SEARCHLIB(20120): /data/data/com.android.org
D/SEARCHLIB(20120): /data/data/com.android.org.chromium
D/SEARCHLIB(20120): /data/data/com.android.org.chromium.base
D/SEARCHLIB(20120): /data/data/com.android.org.chromium.base.SystemMessageHandler
D/SEARCHLIB(20120): /data/data/android
D/SEARCHLIB(20120): /data/data/android.os
D/SEARCHLIB(20120): /data/data/android.os.Handler
D/SEARCHLIB(20120): /data/data/android
D/SEARCHLIB(20120): /data/data/android.os
D/SEARCHLIB(20120): /data/data/android.os.Looper
D/SEARCHLIB(20120): /data/data/android
D/SEARCHLIB(20120): /data/data/android.os
D/SEARCHLIB(20120): /data/data/android.os.HandlerThread

When I open .apk file the libs directory is present.

I will be very grateful for any help

No JNI_OnLoad found

Trying to use prebuilt libriaries and I see the following debug info:
Trying to load lib /data/data/com.example.VideoTest/lib/libavutil.so 0x42582c50
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ Added shared lib /data/data/com.example.VideoTest/lib/libavutil.so 0x42582c50
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ No JNI_OnLoad found in /data/data/com.example.VideoTest/lib/libavutil.so 0x42582c50, skipping init
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ Trying to load lib /data/data/com.example.VideoTest/lib/libswscale.so 0x42582c50
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ Added shared lib /data/data/com.example.VideoTest/lib/libswscale.so 0x42582c50
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ No JNI_OnLoad found in /data/data/com.example.VideoTest/lib/libswscale.so 0x42582c50, skipping init
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ Trying to load lib /data/data/com.example.VideoTest/lib/libavcodec.so 0x42582c50
02-05 16:04:51.269 2504-2504/com.example.VideoTest W/linker﹕ libavcodec.so has text relocations. This is wasting memory and is a security risk. Please fix.
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ Added shared lib /data/data/com.example.VideoTest/lib/libavcodec.so 0x42582c50
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ No JNI_OnLoad found in /data/data/com.example.VideoTest/lib/libavcodec.so 0x42582c50, skipping init
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ Trying to load lib /data/data/com.example.VideoTest/lib/libavformat.so 0x42582c50
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ Added shared lib /data/data/com.example.VideoTest/lib/libavformat.so 0x42582c50
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ No JNI_OnLoad found in /data/data/com.example.VideoTest/lib/libavformat.so 0x42582c50, skipping init
02-05 16:04:51.269 2504-2504/com.example.VideoTest D/dalvikvm﹕ Trying to load lib /data/data/com.example.VideoTest/lib/libffmpeg_mediametadataretriever_jni.so 0x42582c50
02-05 16:04:51.279 2504-2504/com.example.VideoTest D/dalvikvm﹕ Added shared lib /data/data/com.example.VideoTest/lib/libffmpeg_mediametadataretriever_jni.so 0x42582c50
02-05 16:04:51.279 2504-2504/com.example.VideoTest D/dalvikvm﹕ No JNI_OnLoad found in /data/data/com.example.VideoTest/lib/libffmpeg_mediametadataretriever_jni.so 0x42582c50, skipping init
02-05 16:04:51.279 2504-2504/com.example.VideoTest I/MediaMetadataRetrieverJNI﹕ native_init
02-05 16:04:51.289 2504-2504/com.example.VideoTest I/MediaMetadataRetrieverJNI﹕ native_setup
02-05 16:04:51.289 2504-2504/com.example.VideoTest I/MediaMetadataRetrieverJNI﹕ native_setup
02-05 16:04:51.289 2504-2504/com.example.VideoTest I/MediaMetadataRetrieverJNI﹕ native_setup
02-05 16:04:51.289 2504-2504/com.example.VideoTest I/MediaMetadataRetrieverJNI﹕ native_setup
02-05 16:04:51.289 2504-2504/com.example.VideoTest I/MediaMetadataRetrieverJNI﹕ native_setup
02-05 16:04:51.289 2504-2504/com.example.VideoTest I/MediaMetadataRetrieverJNI﹕ native_setup
02-05 16:04:51.289 2504-2504/com.example.VideoTest I/MediaMetadataRetrieverJNI﹕ native_setup
02-05 16:04:51.289 2504-2504/com.example.VideoTest I/MediaMetadataRetrieverJNI﹕ native_setup

And after that there is a NullPointer because of unparsed meta information about duration of the media file. File is ok, tried to use default MediaMetadataRetriever and it gets duration successfully. Could you please advice what the problem can be? Thanks.

Getting null value for METADATA_KEY_VIDEO_ROTATION

I am trying to get metadata of Video file.

METADATA_KEY_CREATION_TIME and other information is working fine.

METADATA_KEY_VIDEO_ROTATION is returning null .

I am testing on Samsung Galaxy S4 [Android 4.4.2].

Thanks,

not getting correct rotation attribute

When I run

ffmpeg -i "myvideofile.mp4"

I'm able to see the rotate value of the video (in this case, 90). However, when I use FFmpegMediaMetadataRetriever and attempt to get the rotation of the video using the following:

FFmpegMediaMetadataRetriever fmmr = new FFmpegMediaMetadataRetriever();
fmmr.setDataSource(http_mediaURL);
String rotation = fmmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);

I get "null" Any insights on why I'm not getting the right rotation value?

You can run the test with the following file:
https://dl.dropboxusercontent.com/u/1000620/portrait.mp4

Why not loading library with .loadLibrary?

From the first the first commit on you do something like this when loading the native libraries:

  • you get the stacktrace of the application
  • try to find the .so files in the /data/data/packagename/lib folder of every package in stacktrace
  • if the .so files were not found, a UnsatisfiedLinkExeption is thrown
    Wouldn't it be easier and more efficent to just use the System.loadLibrary-method?

the static-method would look like this:

static {
    for (int i = 0; i < JNI_LIBRARIES.length; i++) {
        System.loadLibrary(JNI_LIBRARIES[i]);
    }
}

in the JNI_LIBRARIES array the "lib" and ".so" has to be removed

private static final String [] JNI_LIBRARIES = {
    "avutil",
    "swscale",
    "avcodec",
    "avformat",
    "ffmpeg_mediametadataretriever_jni"     
};

I wouldn't have recognized it, if there weren't these problems with a libraryproject using your library and getting an UnsatisfiedLinkExeption all the time because your method for loading the .so files seems not to be able to find the right lib folder.

IllegalArgumentException: setDataSource failed: status = 0xFFFFFFFF

Getting FFmpegMediaMetadataRetriever Error while running android application

I have included all the so files and fmmr.jar in libs folder but still getting following error while running application ,

"FFmpegMediaMetadataRetriever libraries not found. Did you forget to add them to your libs folder?"

Code sample :
public static void takeSnapshot(long frameAtTime, String videoPath,
String filename, String videoKey,boolean... forDashboard) {
String uriString = videoPath;
File tempFile = new File(CONST_VIDEO_STOREAGE_PATH + videoKey + "/Miles");
if(!tempFile.exists())
{
tempFile.mkdirs();
}

    FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
    try {
        mmr.setDataSource(URLDecoder.decode(uriString, "UTF-8"));
    } catch (IllegalArgumentException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (UnsupportedEncodingException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    // * 1000)-10,
    mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_VIDEO_CODEC);
    Bitmap bmp;

    File dirScreenshots;
    String filePath;
    if(forDashboard.length>0)
    {
        String tempPath = CONST_VIDEO_STOREAGE_PATH + videoKey + "/Miles/";
        dirScreenshots=new File(tempPath); 
        filePath=tempPath + filename + ".jpg";
        bmp = mmr.getFrameAtTime(frameAtTime*1000000,
                FFmpegMediaMetadataRetriever.OPTION_CLOSEST_SYNC);
    }
    else
    {
        dirScreenshots=new File(CONST_VIDEO_SNAPSHOT_PATH);
        filePath=CONST_VIDEO_SNAPSHOT_PATH + filename + ".jpg";
        bmp = mmr.getFrameAtTime(frameAtTime*1000,
                FFmpegMediaMetadataRetriever.OPTION_CLOSEST_SYNC);
    }

    if(!dirScreenshots.exists())
    {
        dirScreenshots.mkdir();
    }

    FileOutputStream out = null;
    try {
        out = new FileOutputStream(filePath);
        if (bmp != null)
            bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        try {
            if (out != null) {
                out.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    mmr.release();
}

}

Below is the screenshot of error :
ffmpeg

Crash on `FFmpegMediaMetadataRetriever retriever = new FFmpegMediaMetadataRetriever();`

03-20 14:02:59.387  23585-23585/com.vtube.protube D/dalvikvm﹕ Trying to load lib /data/app-lib/com.vtube.protube-2/libavutil.so 0x41b386f8
03-20 14:02:59.387  23585-23585/com.vtube.protube D/dalvikvm﹕ Added shared lib /data/app-lib/com.vtube.protube-2/libavutil.so 0x41b386f8
03-20 14:02:59.387  23585-23585/com.vtube.protube D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/com.vtube.protube-2/libavutil.so 0x41b386f8, skipping init
03-20 14:02:59.387  23585-23585/com.vtube.protube D/dalvikvm﹕ Trying to load lib /data/app-lib/com.vtube.protube-2/libswscale.so 0x41b386f8
03-20 14:02:59.387  23585-23585/com.vtube.protube D/dalvikvm﹕ Added shared lib /data/app-lib/com.vtube.protube-2/libswscale.so 0x41b386f8
03-20 14:02:59.387  23585-23585/com.vtube.protube D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/com.vtube.protube-2/libswscale.so 0x41b386f8, skipping init
03-20 14:02:59.387  23585-23585/com.vtube.protube D/dalvikvm﹕ Trying to load lib /data/app-lib/com.vtube.protube-2/libavcodec.so 0x41b386f8
03-20 14:02:59.387  23585-23585/com.vtube.protube W/linker﹕ libavcodec.so has text relocations. This is wasting memory and is a security risk. Please fix.
03-20 14:02:59.397  23585-23585/com.vtube.protube D/dalvikvm﹕ Added shared lib /data/app-lib/com.vtube.protube-2/libavcodec.so 0x41b386f8
03-20 14:02:59.397  23585-23585/com.vtube.protube D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/com.vtube.protube-2/libavcodec.so 0x41b386f8, skipping init
03-20 14:02:59.397  23585-23585/com.vtube.protube D/dalvikvm﹕ Trying to load lib /data/app-lib/com.vtube.protube-2/libavformat.so 0x41b386f8
03-20 14:02:59.397  23585-23585/com.vtube.protube D/dalvikvm﹕ Added shared lib /data/app-lib/com.vtube.protube-2/libavformat.so 0x41b386f8
03-20 14:02:59.397  23585-23585/com.vtube.protube D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/com.vtube.protube-2/libavformat.so 0x41b386f8, skipping init
03-20 14:02:59.397  23585-23585/com.vtube.protube D/dalvikvm﹕ Trying to load lib /data/app-lib/com.vtube.protube-2/libffmpeg_mediametadataretriever_jni.so 0x41b386f8
03-20 14:02:59.397  23585-23585/com.vtube.protube D/dalvikvm﹕ Added shared lib /data/app-lib/com.vtube.protube-2/libffmpeg_mediametadataretriever_jni.so 0x41b386f8
03-20 14:02:59.397  23585-23585/com.vtube.protube E/dalvikvm﹕ ERROR: couldn't find native method
03-20 14:02:59.397  23585-23585/com.vtube.protube E/dalvikvm﹕ Requested: Lwseemann/media/FFmpegMediaMetadataRetriever;._setDataSource:(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)V
03-20 14:02:59.397  23585-23585/com.vtube.protube E/MediaMetadataRetrieverJNI﹕ ERROR: FFmpegMediaMetadataRetriever native registration failed
03-20 14:02:59.397  23585-23585/com.vtube.protube W/dalvikvm﹕ Exception Ljava/lang/NoSuchMethodError; thrown while initializing Lwseemann/media/FFmpegMediaMetadataRetriever;
03-20 14:02:59.397  23585-23585/com.vtube.protube D/AndroidRuntime﹕ Shutting down VM
03-20 14:02:59.397  23585-23585/com.vtube.protube W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x416d3d58)
03-20 14:02:59.547  23585-23585/com.vtube.protube W/System.err﹕ java.lang.NoSuchMethodError: no static or non-static method "Lwseemann/media/FFmpegMediaMetadataRetriever;._setDataSource(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)V"
03-20 14:02:59.547  23585-23585/com.vtube.protube W/System.err﹕ at java.lang.Runtime.nativeLoad(Native Method)
03-20 14:02:59.547  23585-23585/com.vtube.protube W/System.err﹕ at java.lang.Runtime.doLoad(Runtime.java:421)
03-20 14:02:59.547  23585-23585/com.vtube.protube W/System.err﹕ at java.lang.Runtime.loadLibrary(Runtime.java:362)
03-20 14:02:59.547  23585-23585/com.vtube.protube W/System.err﹕ at java.lang.System.loadLibrary(System.java:526)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at wseemann.media.FFmpegMediaMetadataRetriever.<clinit>(FFmpegMediaMetadataRetriever.java:120)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at com.vtube.app.videoplay.async.ScreenShotTask.<init>(ScreenShotTask.java:39)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at com.vtube.component.YouTubeMediaControllerView$3.onClick(YouTubeMediaControllerView.java:305)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at android.view.View.performClick(View.java:4768)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at android.view.View$PerformClick.run(View.java:19073)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at android.os.Handler.handleCallback(Handler.java:755)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:95)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at android.os.Looper.loop(Looper.java:145)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5266)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
03-20 14:02:59.557  23585-23585/com.vtube.protube W/FlurryAgent﹕ Error logged: uncaught
03-20 14:02:59.557  23585-23585/com.vtube.protube W/FlurryAgent﹕ Ending session
03-20 14:02:59.557     909-1466/? W/com.android.server.location.LocationManagerMetrics﹕ recordProviderRunTime:providerName is null
    --------- beginning of /dev/log/system
03-20 14:02:59.567  23585-23585/com.vtube.protube E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.vtube.protube, PID: 23585
    java.lang.NoSuchMethodError: no static or non-static method "Lwseemann/media/FFmpegMediaMetadataRetriever;._setDataSource(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)V"
            at java.lang.Runtime.nativeLoad(Native Method)
            at java.lang.Runtime.doLoad(Runtime.java:421)
            at java.lang.Runtime.loadLibrary(Runtime.java:362)
            at java.lang.System.loadLibrary(System.java:526)
            at wseemann.media.FFmpegMediaMetadataRetriever.<clinit>(FFmpegMediaMetadataRetriever.java:120)
            at com.vtube.app.videoplay.async.ScreenShotTask.<init>(ScreenShotTask.java:39)
            at com.vtube.component.YouTubeMediaControllerView$3.onClick(YouTubeMediaControllerView.java:305)
            at android.view.View.performClick(View.java:4768)
            at android.view.View$PerformClick.run(View.java:19073)
            at android.os.Handler.handleCallback(Handler.java:755)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:145)
            at android.app.ActivityThread.main(ActivityThread.java:5266)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642)
            at dalvik.system.NativeStart.main(Native Method)

I put all the files in pre-build libs folder into my projects libs folder.

Android Studio 1.2 Preview 3 (AI - 141.1793788)

load video from res/raw

Hi,

it seems that loading a video from the raw folder (like Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video) is not working (I can't extract any data, I always get null). But if I move the video into /sdcard/Download, then it's working. Is it a known issue?

thanks

Crashing after repeated use

I am having trouble with getFrameAt crashing after several uses. I have managed to reduce the issue to the minimal code that causes this, which I will copy below.

This program logs finished 3 times and then crashes, and this behaviour is repeatable. This causes me problems because I need to use the extractor several times. There is no error log in eclipse logcat the app simple exits midway through. It always reaches "extracting frame" log, but then fails to reach the "extracting frame done" log. So the error must be in the getFrameAtTime line.

I am using a Samsung Nexus S. The function is running in a background AsyncTask.

Your support is greatly appreciated. Please let me know if you need more details.

private void testExtractor() {
    for(int j=0;j<8;j++){
        FFmpegMediaMetadataRetriever mediaMetadataRetriever = new FFmpegMediaMetadataRetriever();

        File directory  = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),"Videos");
        if (!directory.exists()) {
          Log.d("test", "Can't open video.");
        }
        String videoFile = "video0080.mp4";
        String filename = directory.getPath() + File.separator + videoFile;

        mediaMetadataRetriever.setDataSource(filename);

        Bitmap b;
        long frameTime;
        float timeStep=(float)5000/36.0f;
        for(int index=0;index<36;index++) {

            frameTime=(long)(timeStep*index*1000.0f);
            Log.d("test", "extracting frame" + frameTime);
            b=mediaMetadataRetriever.getFrameAtTime(frameTime,FFmpegMediaMetadataRetriever.OPTION_CLOSEST);
            Log.d("test", "extracting frame" + frameTime + "done");
        }
        Log.d("test", "finished");
        mediaMetadataRetriever.release();
    }
}

cannot get meta data from a sample movie

Hi, I am new to android and I am extracting frames from a sample movie in the asset folder that is of format mp4. I installed the ffmpeg where fmmr.jar in the libs folder and the .so files in the /main/src/jniLibs folder. I am testing it on samsung galaxy note 4 phone.

my code is as the following
metaRetriver = new FFmpegMediaMetadataRetriever();
AssetFileDescriptor afd = getResources().getAssets().openFd("sampleMovie.mp4");

       // afd = getResources().getAssets().openFd("sampleMovie.mp4");

         String[] ma= getResources().getAssets().list("");
         for( int i =0; i < ma.length; ++i)
         {
         Log.i(TAG,ma[i]);
         }

        metaRetriver.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
        Log.i(TAG, "movie starts at " + afd.getStartOffset() + " with length "+ afd.getLength());
        millis =(int) Long.parseLong(metaRetriver.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION));
        now = 0;
        Log.i(TAG, "movie is " + millis + " millisecond longs");
        Log.i(TAG, "movie is " + metaRetriver.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION) + " millisecond longs");
        Log.i(TAG, "movie file size is " + metaRetriver.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_FILESIZE));
        Log.i(TAG, "movie video codec is" + metaRetriver.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_VIDEO_CODEC));
        Log.i(TAG, "movie frame rate is " + metaRetriver.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_FRAMERATE));
        Log.i(TAG, "movie chapter start time is" + metaRetriver.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_CHAPTER_START_TIME));

the result I got from the log
03-23 13:52:56.008 10559-10559/com.example.haozwang.cardboardtheater I/MainActivity﹕ images
03-23 13:52:56.008 10559-10559/com.example.haozwang.cardboardtheater I/MainActivity﹕ sampleMovie.mp4
03-23 13:52:56.008 10559-10559/com.example.haozwang.ct I/MainActivity﹕ sounds
03-23 13:52:56.008 10559-10559/com.example.haozwang.ct I/MainActivity﹕ webkit
03-23 13:52:56.008 10559-10559/com.example.haozwang.ct I/MainActivity﹕ webkitsec
03-23 13:52:56.383 10559-10559/com.example.haozwang.ct I/MainActivity﹕ movie starts at 1168 with length 9287731
03-23 13:52:56.383 10559-10559/com.example.haozwang.ct I/MainActivity﹕ movie is 0 millisecond longs
03-23 13:52:56.383 10559-10559/com.example.haozwang.ct I/MainActivity﹕ movie is 0 millisecond longs
03-23 13:52:56.383 10559-10559/com.example.haozwang.ct I/MainActivity﹕ movie file size is -38
03-23 13:52:56.383 10559-10559/com.example.haozwang.ct I/MainActivity﹕ movie video codec isnull
03-23 13:52:56.383 10559-10559/com.example.haozwang.ct I/MainActivity﹕ movie frame rate is null
03-23 13:52:56.383 10559-10559/com.example.haozwang.ct I/MainActivity﹕ movie chapter start time isnull

the program obviously found the movie file. but the metadataretriever is not getting the data. did I load the .so file wrong?

Is HLS stream (.m3u8) supported?

Hello, I'm trying to play HLS stream. I'm using demo example and I have problems with getFrames from almost all streams. Please notice, that some streams are in HD res. For example the only working stream is:

http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8

When I trying to get frame from:

"http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8
I get error:

03-04 11:59:06.320: A/libc(1516): Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1), thread 1562 (ModernAsyncTask)

Then I create simple function from library usage sample code I get following errors:

03-04 12:46:24.139: E/AndroidRuntime(22177): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.firstframetest/com.example.firstframetest.MainActivity}: java.lang.IllegalArgumentException: setDataSource failed: status = 0xFFFFFFFF
03-04 12:46:24.139: E/AndroidRuntime(22177): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
03-04 12:46:24.139: E/AndroidRuntime(22177): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
03-04 12:46:24.139: E/AndroidRuntime(22177): at android.app.ActivityThread.access$600(ActivityThread.java:140)
03-04 12:46:24.139: E/AndroidRuntime(22177): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
03-04 12:46:24.139: E/AndroidRuntime(22177): at android.os.Handler.dispatchMessage(Handler.java:99)
03-04 12:46:24.139: E/AndroidRuntime(22177): at android.os.Looper.loop(Looper.java:137)
03-04 12:46:24.139: E/AndroidRuntime(22177): at android.app.ActivityThread.main(ActivityThread.java:4895)
03-04 12:46:24.139: E/AndroidRuntime(22177): at java.lang.reflect.Method.invokeNative(Native Method)
03-04 12:46:24.139: E/AndroidRuntime(22177): at java.lang.reflect.Method.invoke(Method.java:511)
03-04 12:46:24.139: E/AndroidRuntime(22177): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
03-04 12:46:24.139: E/AndroidRuntime(22177): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
03-04 12:46:24.139: E/AndroidRuntime(22177): at dalvik.system.NativeStart.main(Native Method)
03-04 12:46:24.139: E/AndroidRuntime(22177): Caused by: java.lang.IllegalArgumentException: setDataSource failed: status = 0xFFFFFFFF
03-04 12:46:24.139: E/AndroidRuntime(22177): at wseemann.media.FFmpegMediaMetadataRetriever.setDataSource(Native Method)
03-04 12:46:24.139: E/AndroidRuntime(22177): at com.example.firstframetest.MainActivity.onCreate(MainActivity.java:21)
03-04 12:46:24.139: E/AndroidRuntime(22177): at android.app.Activity.performCreate(Activity.java:5163)
03-04 12:46:24.139: E/AndroidRuntime(22177): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
03-04 12:46:24.139: E/AndroidRuntime(22177): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
03-04 12:46:24.139: E/AndroidRuntime(22177): ... 11 more

Adding Maven Readme

Hi,

i am using Android-Studio, how is the easiest way to use FFmpegMediaMetadataRetriever with Maven Repo?

Update for FFMPEG 2.2

UPDATED: Workś fine without changing source, and used prebuilt library compiled in version 2.2

getFrameAtTime issues

I think writing an FFmpeg based MediaMetadataRetriever is a fantastic idea and I would like to use it but I think there are bugs in the getFrameAtTime command.

1). On an mp4 video of resolution 720x480, on a Nexus S phone, to get a frame at 1000 milliseconds I need to use a 'timeUs' of 300 x 1000 milliseconds, (I would expect to multiply by 1000 to go from milliseconds to microseconds). On a FHD video, on a Samsung S4 I need to multiply by 150 to get the correct frame.

2). It takes a long time to extract a frame (prohibitively long for me). For a 20 second mp4 at 720x480 resolution, it takes about 10 seconds per extracted frame on a Nexus S, whereas similar android FFmpeg based extractors (such as https://github.com/churnlabs/android-ffmpeg-sample, or FFmpeg4android) take about 75 milliseconds per frame.

Apart from this it works very well.

Please advise.

Let me know if you need more information.

First time it take image but next time it do not work.

When I am click to take video image then first time it work good but when i click same button next time to take image then it do not give any image.

I need to image after every 1 minute but i give image first minute. After next minute it do not work yet.

https protocal is supported or not?

Hi,

I have video's in amazon server,below is the sample url format
https://s3.amazonaws.com/XXXXX/filename.h264.
my requirement is getting the first frame of the video, is it possible to get first frame using your library? i am using the http in my video url it successfully get the first frame.but my video url's are https.
how to get first frame using https protocal?

Thanks

getFrameAtTime always return null

Hello,

I need to grab the last frame of the video in my VideoView, what i am doing is the following:

// get the time
int endTime = vidView.getDuration() * 1000;

//get the last frame
FFmpegMediaMetadataRetriever fmmr = new FFmpegMediaMetadataRetriever();
fmmr .setDataSource(videoSource);
Bitmap bmFrame = fmmr.getFrameAtTime(endTime, FFmpegMediaMetadataRetriever.OPTION_CLOSEST);
System.out.println("bmFrame: " + bmFrame); // <- NULL
fmmr.release();

videoSource is something like:
"/storage/sdcard0/folder/folder/video.mp4"

I have extracted the libs and jar from where and i have put it in my libs.
https://github.com/wseemann/FFmpegMediaMetadataRetriever/blob/master/fmmr-library/prebuilt-libs.tar.gz

My /libs folder contains the following 4 folders and the jar:
-armeabi
-armeabi-v7a
-mips
-x86
fmmr.jar

(= is it btw necassary to have all 4 folders? Because this makes my .apk like 30mb+ ...)

Is this still a bug or am i doing something wrong?
Thanks

possible native memmory leak

i noticed i have a native memmory related crash while using the library.
each call to setDataSource & getFrameAtTime allocates several MB from the native heap.
calling release() does not free it.

i use this code to check the memory related crash:
for(int i=0 ; i<60 ; i++){
Log.d("","iteration "+i);
printNativeMemoryHeapAllocationSize();
fmmr = new FFmpegMediaMetadataRetriever();
printNativeMemoryHeapAllocationSize();

        String pathToFile = "/mnt/sdcard/movie.mp4";
        fmmr.setDataSource(pathToFile);
        printNativeMemoryHeapAllocationSize();
        Bitmap bmp = fmmr.getFrameAtTime(1000);
        printNativeMemoryHeapAllocationSize();      
        fmmr.release();
        bmp.recycle();
        System.gc();
        printNativeMemoryHeapAllocationSize();          
    }

private void printNativeMemoryHeapAllocationSize(){
    Log.d("memory test","native heap alloc size: "+Debug.getNativeHeapAllocatedSize());
}

am i doing something wrong?

JNI WARNING: input is not valid Modified UTF-8: illegal continuation byte get VM aborting: Fatal signal 11

Hi,

I'm using FFmpegMediaMetadataRetriever to extract metadata from radio FM stream datasource. When my andorid app call extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ICY_METADATA) and receives as output string: string: 'StreamTitle='SIGLA PUBBLICIT� - Jingle di apertura';StreamUrl='';' (where � = A accented) is generated this stack trace:

I/MediaMetadataRetrieverJNI(7133): release
I/MediaPlayer(7133): Don't send intent. msg.arg1 = 0, msg.arg2 = 0
W/dalvikvm(7133): JNI WARNING: input is not valid Modified UTF-8: illegal continuation byte 0x20
W/dalvikvm(7133): string: 'StreamTitle='SIGLA PUBBLICIT� - Jingle di apertura';StreamUrl='';'
W/dalvikvm(7133): in Lwseemann/media/FFmpegMediaMetadataRetriever;.extractMetadata:(Ljava/lang/String;)Ljava/lang/String; (NewStringUTF)
I/dalvikvm(7133): "main" prio=5 tid=1 NATIVE
I/dalvikvm(7133): | group="main" sCount=0 dsCount=0 obj=0x41c04508 self=0x41be9ef0
I/dalvikvm(7133): | sysTid=7133 nice=0 sched=0/0 cgrp=apps handle=1074233136
I/dalvikvm(7133): | schedstat=( 4024719325 2458892748 6318 ) utm=342 stm=59 core=0
I/dalvikvm(7133): #00 pc 00001260 /system/lib/libcorkscrew.so (unwind_backtrace_thread+27)
I/dalvikvm(7133): #1 pc 0005f944 /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const_, int)+35)
I/dalvikvm(7133): #2 pc 000537ec /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const_, Thread_, bool)+303)
I/dalvikvm(7133): #3 pc 00053886 /system/lib/libdvm.so (dvmDumpThread(Thread_, bool)+25)
I/dalvikvm(7133): #4 pc 00038e42 /system/lib/libdvm.so
I/dalvikvm(7133): #5 pc 0003a1f4 /system/lib/libdvm.so
I/dalvikvm(7133): #6 pc 0003c452 /system/lib/libdvm.so
I/dalvikvm(7133): #7 pc 00002ac0 /data/data/com.rcn101.activity/lib/libffmpeg_mediametadataretriever_jni.so
I/dalvikvm(7133): #8 pc 0001deb0 /system/lib/libdvm.so (dvmPlatformInvoke+112)
I/dalvikvm(7133): #9 pc 0004d102 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const_, JValue_, Method const_, Thread_)+393)
I/dalvikvm(7133): #10 pc 00027324 /system/lib/libdvm.so
I/dalvikvm(7133): at wseemann.media.FFmpegMediaMetadataRetriever.extractMetadata(Native Method)

This maybe generates the VM aborting Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 7133, that making my app crash.

How I can fix this issue. I try to put the call of extractMetadata(...) method in a try/catch block. but no exception is raised.

Thank you very much for your help.

framerate detection does not work with avi

I expirienced that your detection of the average framerate does not work with avis. Could there be a problem with different codecs in your code?

FYI
I get back null of this:
String frameRateString = this.fmmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_FRAMERATE);

ARGB_8888 getFrameAt

One of the deficiencies of MediaMetadataRetriever was that the getFrameAt function could only retrieve frame data at RGB_565 quality even though it seems 24 bit colour information exists in the video.

Would you be able to add an option/ flag that enables ARGB_8888 still images to be retrieved?

IcyMetadata

When I tried to retrieve metadata for icycast, I saw the strings METADATA_KEY_ICY... were commented in the class. And it doesnot work.

https in prebuild-libs.tar.gz

Are extra install steps required to get https working? I have an app that works fine over http, but I get the same error described in issue #1 over https, including when I use the url given in issue #3.

java.lang.UnsatisfiedLinkError

Hi,

for people using Android Studio and gradle, the .so should be under /src/main/jniLibs/armeabi/. If you put them somewhere else, you'll get an UnsatisfiedLinkError exception.

Can not get metadata for audio

Hello,

I tried to get metadata for mp3, mp2 file, but the error was taken at set_data_source.

Can you check it or I need to configure some place to make it work.

getFrameAtTime always returns null

I used the pre-built jar files with Android Gradle system.
I put the jar file in the libs folder and the armeabi, armeabi-v7a, mips and x86 folder under
src/main/jnilibs/

So I have a very simple demo application and I'm trying to fetch frames from a video picked from gallery. But getFrameAtTime always returns null regardless of what the time is. I can fetch the metadata (I think the metadata is being rounded to the nearest thousand) Any ideas?

FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
File file = new File(getPath(videoPath));
FileInputStream inputStream = new FileInputStream(file);
mmr.setDataSource(inputStream.getFD());
String time = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION);
Bitmap test = mmr.getFrameAtTime(1000000, FFmpegMediaMetadataRetriever.OPTION_CLOSEST_SYNC);

setDataSource(Native Method)

Hi

working with mp3 stored on DropBox, i was able to read mp3's metadata until one mounth ago.
Now i'm take a FATAL EXCEPTION, i tried to use the new version of libraries in my project but seems to be the same:

follow my log:

08-07 14:48:32.249: E/AndroidRuntime(31903): FATAL EXCEPTION: main
08-07 14:48:32.249: E/AndroidRuntime(31903): Process: com.dropbox.android.sample, PID: 31903
08-07 14:48:32.249: E/AndroidRuntime(31903): java.lang.IllegalArgumentException: setDataSource failed: status = 0xFFFFFFFF
08-07 14:48:32.249: E/AndroidRuntime(31903): at wseemann.media.FFmpegMediaMetadataRetriever.setDataSource(Native Method)
08-07 14:48:32.249: E/AndroidRuntime(31903): at com.dropbox.android.sample.DownloadRandomPicture.play(DownloadRandomPicture.java:331)
08-07 14:48:32.249: E/AndroidRuntime(31903): at com.dropbox.android.sample.DownloadRandomPicture.onPostExecute(DownloadRandomPicture.java:281)
08-07 14:48:32.249: E/AndroidRuntime(31903): at com.dropbox.android.sample.DownloadRandomPicture.onPostExecute(DownloadRandomPicture.java:1)
08-07 14:48:32.249: E/AndroidRuntime(31903): at android.os.AsyncTask.finish(AsyncTask.java:632)
08-07 14:48:32.249: E/AndroidRuntime(31903): at android.os.AsyncTask.access$600(AsyncTask.java:177)
08-07 14:48:32.249: E/AndroidRuntime(31903): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
08-07 14:48:32.249: E/AndroidRuntime(31903): at android.os.Handler.dispatchMessage(Handler.java:102)
08-07 14:48:32.249: E/AndroidRuntime(31903): at android.os.Looper.loop(Looper.java:136)
08-07 14:48:32.249: E/AndroidRuntime(31903): at android.app.ActivityThread.main(ActivityThread.java:5001)
08-07 14:48:32.249: E/AndroidRuntime(31903): at java.lang.reflect.Method.invokeNative(Native Method)
08-07 14:48:32.249: E/AndroidRuntime(31903): at java.lang.reflect.Method.invoke(Method.java:515)
08-07 14:48:32.249: E/AndroidRuntime(31903): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
08-07 14:48:32.249: E/AndroidRuntime(31903): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
08-07 14:48:32.249: E/AndroidRuntime(31903): at dalvik.system.NativeStart.main(Native Method)

Thanks
Nik

Get list of I-Frame Times

I've been reading the source code for a while now and have not found a method for retrieving a list of I-Frame times. Basically, I am trying to restrict the times that can be input to mediaPlayer.seekTo(int) based off the I-Frame times. Is this currently possible? If not currently possible, could it be possible in the future?

FFmpegMediaMetadataRetriever is not working on Samasung GT-S7562

I have tried to use FFmpegMediaMetadataRetriever for capture frame from a video it's working properly for some device but not working on Samsung GT-S7562. It's throwing exception Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1286]: 112 cannot locate '__aeabi_ldiv0'...

getFrameAtTime returning the same frame

Hello,

What I'm trying to do, is capture a video and then play it frame-by-frame.
The way I decided to do this is load the video into your library, and using a SeekBar change the "Preview" image.

The first problem I encountered was the duration I received was always 0. After playing around with this for a little bit, I found that the library returns only duration in multiplications of a thousand. (0-1000-2000-etc).

When I try getting frames using getFrameAtTime - I get the same frame and not actual frames from the video.

At first I thought the problem was relating to the video being time lapsed (using setCaptureRate) - but after removing this option it didn't change much.
When pulling the video to my computer it plays fine and recognized as MPEG format.

What could be the problem?

Here is the extraction code:

// Set the media player with the video
final FFmpegMediaMetadataRetriever metadataRetriever =
        new FFmpegMediaMetadataRetriever();
final SeekBar videoSeek = (SeekBar) view.findViewById(R.id.video_seek);
videoSeek.bringToFront();

Log.d(TAG, mMediaFilepath);
metadataRetriever.setDataSource(mMediaFilepath);
String duration = metadataRetriever
        .extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION);

Log.d(TAG, "Duration = " + duration);
mediaPreview.setImageBitmap(metadataRetriever.getFrameAtTime(0));

videoSeek.setMax(Integer.parseInt(duration));

// Set the seek bar actions
videoSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
    @Override
    public void onProgressChanged(SeekBar seekBar, int progress,
                                  boolean fromUser) {
        Bitmap bm2 = metadataRetriever.getFrameAtTime();
        Bitmap bm = metadataRetriever.getFrameAtTime(progress,
                FFmpegMediaMetadataRetriever.OPTION_CLOSEST);
        if (bm == null || bm2 == null) {
            Log.e(TAG, "bm is null");
        }
        mediaPreview.setImageBitmap(bm);
    }

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
    }

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
    }
});

One thing to note:
the function never return's a null value - just the same bitmap all over again.

Thank you,
Ron.

P.S.: Here is a link to the video just in case it will help you: https://drive.google.com/file/d/0B50D54gw1jgHT25rQ0ZuRFc5cFk/view?usp=sharing

Use InputStream as data source

Would it be possible at all to make this able to accept an InputStream (not FileInputStream) as the data source?

I'm trying to produce thumbnails for files stored on a remote server (not HTTP or any other protocol accessible via a URL), while downloading as little of each file as possible. The actual remote server connection could be one of several different types, but I can get them all to provide an InputStream for each file.

(I would have a go at implementing this myself, if it wasn't for all the NDK business) :/

Thanks :)

setDataSource failed: status = 0xFFFFFFFF

I'm getting issue using FFmpegMediaMetadataRetriever in a simple example project when setting the data source; I get a RuntimeException.

java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFFF
at wseemann.media.FFmpegMediaMetadataRetriever.setDataSource(Native Method)
at wseemann.media.FFmpegMediaMetadataRetriever.setDataSource(FFmpegMediaMetadataRetriever.java:181)
at ca.dasoft.metadata.MainActivity.onCreate(MainActivity.java:31)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1098)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2185)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2270)
at android.app.ActivityThread.access$800(ActivityThread.java:136)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1225)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5171)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:837)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:653)
at dalvik.system.NativeStart.main(Native Method)

Here is the code:

        FFmpegMediaMetadataRetriever retriever = new FFmpegMediaMetadataRetriever();
        try
        {
            FileDescriptor fd = getAssets().openFd("songs/001.mp3").getFileDescriptor();
            if(fd != null) {
                retriever.setDataSource(fd);

                String artist = retriever.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ARTIST);
                String album = retriever.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ALBUM);
                String title = retriever.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_TITLE);
            }
            else
            {
                Logger.getLogger(MainActivity.class.getName()).log(Level.SEVERE, "FileDescriptor Invalid");
            }
        }
        catch (IOException ex)
        {
            Logger.getLogger(MainActivity.class.getName()).log(Level.SEVERE, null, ex);
        }
        catch (IllegalArgumentException ex)
        {
            Logger.getLogger(MainActivity.class.getName()).log(Level.SEVERE, null, ex);
        }
        catch (RuntimeException ex)
        {
            Logger.getLogger(MainActivity.class.getName()).log(Level.SEVERE, null, ex);
        }

ExceptionInInitiliazerError

I'm having issues using your library in eclipse. I tried incorporating it in two ways:

  1. adding ffmr.jar to my libs folder

this leads to the error ExceptionInItializerError when I try to run the following line:
FFmpegMediaMetadataRetriever fmmr = new FFmpegMediaMetadataRetriever();

  1. adding ffmr.jar to my libs folder and adding ffmr-library to my application's libraries (by going to properties > android > add... and adding the appropriate library)

When I do this, the program fails to build and I get the error Unable to execute dex: Multiple dex files define Lwseemann/media/FFmpegMediaMetadataRetriever;

How can I resolve these issues?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.