question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.IllegalArgumentException

See original GitHub issue

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)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
aminefilali1commented, Dec 26, 2017

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);

0reactions
kirkaDevcommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

IllegalArgumentException (Java Platform SE 8 )
Constructs a new exception with the specified detail message and cause. Note that the detail message associated with cause is not automatically incorporated...
Read more >
How to solve an IllegalArgumentException in Java?
An IllegalArgumentException is thrown in order to indicate that a method has been passed an illegal argument. This exception extends the ...
Read more >
Error: java.lang.IllegalArgumentException - Stack Overflow
It rises explicitly by API Developer or Programmer to indicate that a method has invoked with illegal argument. example: Thread t = new...
Read more >
How to Solve IllegalArgumentException in Java?
The IllegalArgumentException is a subclass of java.lang.RuntimeException. RuntimeException, as the name suggests, occurs when the program is ...
Read more >
How to Throw IllegalArgumentException in Java - Rollbar
The IllegalArgumentException is an unchecked exception in Java that is thrown to indicate an illegal or unsuitable argument passed to a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found