How to reduce video size with java/kotlin on Android?

September 18, 2019, at 09:30 AM

I want reduce the video size at Android Studio and for upload to PlayStore needs to be compatible for 64 bits arquitecture, I tried before with ffmpeg and it compress mp4 succefully but take longer time and this solution with 3gp not include the audio. Theres another option or library to compress mp4 and 3gp with audio and video?

Answer 1

You can do so using this library:


//step 4: using compressor
GiraffeCompressor.create() //two implementations: mediacodec and ffmpeg,default is mediacodec
                  .input(inputFile) //set video to be compressed
                  .output(outputFile) //set compressed video output
                  .bitRate(bitRate)//set bitrate 码率
                  .resizeFactor(Float.parseFloat($.id( video resize factor 分辨率缩放,默认保持原分辨率
                  .watermark("/sdcard/videoCompressor/watermarker.png")//add watermark(take a long time) 水印图片(需要长时间处理)
                  .subscribe(new Subscriber<GiraffeCompressor.Result>() {
                      public void onCompleted() {
                          $.id("start compress");
                      public void onError(Throwable e) {
                          $.id("start compress");
                      public void onNext(GiraffeCompressor.Result s) {
                          String msg = String.format("compress completed \ntake time:%s \nout put file:%s", s.getCostTime(), s.getOutput());
                          msg = msg + "\ninput file size:"+ Formatter.formatFileSize(getApplication(),inputFile.length());
                          msg = msg + "\nout file size:"+ Formatter.formatFileSize(getApplication(),new File(s.getOutput()).length());
Google sheets to salesforce

Google sheets to salesforce

Im trying to connect data in google sheet to salesforce

How to retrieve data from my java code to html?

How to retrieve data from my java code to html?

I am working on a small webpage projectI wrote my functions code with java, and now I am having problems to display the data I got to HTML to display it in a webpage

Bootrap-Select can&#39;t be selected on multiple value

Bootrap-Select can't be selected on multiple value

I have a modal with input like this: