Android Compress Video before Upload to Server

前端 未结 5 1875
情书的邮戳
情书的邮戳 2021-02-09 01:41

How can I compress a video file in Android before uploading to a remote server? I\'m not looking to zip up the file, because I don\'t think that will help much. I want to compre

5条回答
  •  一整个雨季
    2021-02-09 02:09

    One of the app that I worked on earlier has this requirement of sending the video file after compressing it. Here are the steps I followed which worked:

    1. Compress the file using a Silicompressor library in android. Run the compression task on a background thread.

    2. The output file format will have the mime type "video/raw". You can check that in logcat. So, you need to add this mime type in your server so that the compressed file format is uploaded successfully.

    3. After this is done, trying sending the compressed file and it should work.

    Make sure the mime type of the file you are uploading to server is accepted by the server.

提交回复
热议问题