How to compress video file in android

I want to compress the video file before uploading to the server. I went through this link How to compress the video to the maximum level of android , but I did not receive a response. Can anyone help me out?

+4
source share
3 answers

Try

mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));     
mediaRecorder.setVideoEncodingBitRate(690000 );
+3
source

We can compress video using ffmpeg in android.

To integrate FFmpeg into android, we can use pre-compiled libraries like ffmpeg-android .

You can use the command below to compress the video

String[] command = {"-y", "-i", inputFileAbsolutePath, "-s", "160x120", "-r", "25", "-vcodec", "mpeg4", "-b:v", "150k", "-b:a", "48000", "-ac", "2", "-ar", "22050", outputFileAbsolutePath};

Here

-y

Overwrite output files without request.

-i

ffmpeg "", -i

-s

-r

-vcodec

.

-b: v

-b:

-ac

.

-ar

,

ffmpeg android , ffmpeg video editor tutorial , ffmpeg -

https://androidlearnersite.wordpress.com/2017/03/17/ffmpeg-video-editor/

0

ffmpeg lib : -

ffmpeg -i input.mp4 -acodec mp2 output.mp4
-1

Source: https://habr.com/ru/post/1545351/


All Articles