Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalArgumentException #30

Open
vvbhandare opened this issue Sep 8, 2017 · 6 comments
Open

java.lang.IllegalArgumentException #30

vvbhandare opened this issue Sep 8, 2017 · 6 comments

Comments

@vvbhandare
Copy link

vvbhandare commented Sep 8, 2017

I am getting below error when I pass

SiliCompressor.with(this).compressVideo("/storage/emulated/0/DCIM/Camera/VID_20170908_122018.mp4", "/storage/emulated/0/abc.mp4");

java.lang.IllegalArgumentException
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:64)
at com.iceteck.silicompressorr.videocompression.MediaController.convertVideo(MediaController.java:252)
at com.iceteck.silicompressorr.SiliCompressor.compressVideo(SiliCompressor.java:300)
at com.xxx.farwide.coreview.activity.s3filehandling.S3FileTransactionActivity$1.run(S3FileTransactionActivity.java:74)
at java.lang.Thread.run(Thread.java:764)
@ArslanKathia
Copy link

I am also getting this error
any solution?

@Tourenathan-G5organisation
Copy link
Owner

Thanks both of you ( @vvbhandare & @ArslanKathia) for using this library.
I'm very sorry for my late response. I was not feeling well and i have been off for some while.
I have look at this issue critically and i have found that the issue is not the application(library) but the parameters you passed.
The compressVideo(String videoFileUri, String destinationUri) takes two parameters of type string which are actually Uris which have been converted to string using the toString method.
@vvbhandare the parameter you passed above is a path and not a uri, please use the method Uri.fromFile(new File("your-path-here")) to make your parameter a fully qualified parameter. In your case you will use it as below
SiliCompressor.with(this).compressVideo(Uri.fromFile(new File("/storage/emulated/0/DCIM/Camera/VID_20170908_122018.mp4")).toString(), Uri.fromFile(new File("/storage/emulated/0/abc.mp4")).toString());

@Tourenathan-G5organisation
Copy link
Owner

@ArslanKathia i hope the solution provided is also valid for you

@varun7952
Copy link

varun7952 commented Oct 26, 2017

I am also Getting same error while passing these as Argument for compress video .
URI content://com.android.providers.media.documents/document/video%3A4500
SAVED PATH /storage/emulated/0/MyFile/Media/Video/Temp1509006345128.mp4

@aminefilali1
Copy link

The second parameter is the destination directory, not the destination file path. Try something like this:
String sourceFilePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES) + "/MyAppVideos/myVideo1.mp4";
String destinationDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES) + "/MyAppVideos/";
String compressedFilePath = SiliCompressor.with(context).compressVideo(sourceFilePath, destinationDir);

@kirkaDev
Copy link

kirkaDev commented Feb 26, 2022

In my case was thrown IllegalArgumentException without any messages and causes, because MediaMetadataRetriever couldn't create FileDescriptor.

In total, works for me when videoFilePath is:
/storage/emulated/0/DCIM/Camera/VID_20220226_160644.mp4

and not work when videoFilePath looks like this:
file:///storage/emulated/0/DCIM/Camera/VID_20220226_160446.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants