4

I've also checked a few or more similar posted questions, but none of them was having any satisfying response.

My requirement is to compress videos in approx. 1-2 minutes. The video size restriction in my app is 500 MB and the duration limit is 4 minutes.

The commands, I have tried -

-i /storage/sdcard0/Videos/Lat_test.mp4 -r 20 -vcodec mpeg4 -preset ultrafast -c:a copy -tune fastdecode -strict -2 -b:v 150k /storage/sdcard0/Videos/output.mp4

-y -i /storage/sdcard0/Videos/test3.mp4 -crf 24 -vcodec mpeg4 -preset ultrafast -c:a copy -me_method zero -tune fastdecode -tune zerolatency -strict -2 -b:v 1000k -pix_fmt yuv420p /storage/sdcard0/Videos/output.mp4

and a few more mentioned here

1) https://github.com/Tourenathan-G5organisation/SiliCompressor (the one using MediaCodec, instead of FFMPEG).

2) https://github.com/lalongooo/VideoCompressor

When tried with Samsung Galaxy Grand GT-i9082, version 5.0.1 (rooted), it failed with the below error -

> java.lang.IllegalStateException
> at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
> at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:1033)
> at com.iceteck.silicompressorr.videocompression.MediaController.convertVideo(MediaController.java:491)
> at com.iceteck.silicompressorr.SiliCompressor.compressVideo(SiliCompressor.java:300)
> at com.iceteck.silicompressor.SelectPictureActivity$VideoCompressAsyncTask.doInBackground(SelectPictureActivity.java:379)
> at com.iceteck.silicompressor.SelectPictureActivity$VideoCompressAsyncTask.doInBackground(SelectPictureActivity.java:358)
> at android.os.AsyncTask$2.call(AsyncTask.java:288)
> at java.util.concurrent.FutureTask.run(FutureTask.java:237)
> at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
> at java.lang.Thread.run(Thread.java:818)

Please suggest how to resolve this issue.

Or please suggest any other better video compressing approach / sample / reference, if possible

I have tried various samples of video compression using FFMPEG, as well as MediaCodec, but none of them are working well. A few are very very slow. and rest gets failed in a few devices.

Narendra Singh
  • 3,990
  • 5
  • 37
  • 78

0 Answers0