wseemann / FFmpegMediaMetadataRetriever

FFmpegMediaMetadataRetriever provides a unified interface for retrieving frame and meta data from an input media file.
1.72k stars 387 forks source link

How to import FFmpegMediaMetadataRetriever();? #261

Open NeighborhoodCoding opened 1 year ago

NeighborhoodCoding commented 1 year ago

I added gradle and lib, but

FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();

has red lines..

wseemann commented 1 year ago

Hello @NeighborhoodCoding

Make sure you are adding:

dependencies {
    implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-core:1.0.16'
    implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native:1.0.16'
}

to your app or libraries build.gradle. Sync your project after that and the library should be available then.

Documentation about the library can be found here.

NeighborhoodCoding commented 1 year ago

Thanks for your answer. This works fine. But

FFmpegMediaMetadataRetriever mmr_ffmpeg = new FFmpegMediaMetadataRetriever();

is not working...

It maybe my importation is some wrong? sorry.

NeighborhoodCoding commented 1 year ago

Thanks in advance.

I'm currently build APK in windows OS. It is no problem I believe, it is OK? T.T

wseemann commented 1 year ago

Thanks for your answer. I was using mmr by

MediaMetadataRetriever mmr = new MediaMetadataRetriever();
xmmr.setDataSource(this.getApplicationContext(), mVideoUri);

This works fine. mVideoUri is "androud.resource://org.appname/raw/video1" and I don't know about this.getApplicationContext() actually.

But

FFmpegMediaMetadataRetriever mmr_ffmpeg = new FFmpegMediaMetadataRetriever();
mmr_ffmpeg.setDataSource(this.getApplicationContext(), mVideoUri);

is not working...

2022-09-26 15:27:32.081 24063-24096/org.appname/AndroidRuntime: FATAL EXCEPTION: Thread-4 Process: org.vqml_mobile, PID: 24063 java.lang.RuntimeException: setDataSource failed: status = 0xFFFFFFFF at wseemann.media.FFmpegMediaMetadataRetriever.setDataSource(Native Method) at wseemann.media.FFmpegMediaMetadataRetriever.setDataSource(FFmpegMediaMetadataRetriever.java:189) at org.vqml_mobile.MainActivity.getResult(MainActivity.java:363) at org.vqml_mobile.MainActivity.run(MainActivity.java:211) at java.lang.Thread.run(Thread.java:1012)

It maybe my importation is some wrong? sorry.

As noted in the documentation, setDataSource will throw an exception if an error occurs when attempting to set the data source.