FFmpegMediaMetadataRetriever icon indicating copy to clipboard operation
FFmpegMediaMetadataRetriever copied to clipboard

How to import FFmpegMediaMetadataRetriever();?

Open NeighborhoodCoding opened this issue 3 years ago • 4 comments

I added gradle and lib, but

FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();

has red lines..

NeighborhoodCoding avatar Sep 24 '22 04:09 NeighborhoodCoding

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.

wseemann avatar Sep 24 '22 10:09 wseemann

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 avatar Sep 26 '22 06:09 NeighborhoodCoding

It may happen, when the video is in the assets folder...

Ref :

https://github.com/wseemann/FFmpegMediaMetadataRetriever/issues/246

and

https://github.com/wseemann/FFmpegMediaMetadataRetriever/issues/191

NeighborhoodCoding avatar Sep 26 '22 06:09 NeighborhoodCoding

Thanks in advance.

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

NeighborhoodCoding avatar Sep 26 '22 09:09 NeighborhoodCoding

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.

wseemann avatar Feb 14 '23 04:02 wseemann