Android: How to Solve Video Compression

Android: How to Solve Video Compression

Android Video Compression

A high quality recording by an Android phone for 30 seconds is around 40 to 45 MB in size; storage space is not a concern now-a-days! However, it is a concern for anyone while sharing the video through an app or mail. For example, sharing it in WhatsApp is a problem, as the app does not support videos more than 16 MB in size. This article will help you in Video Compression so that you can share it easily!

What is Video Compression?
Video compression uses modern coding techniques to reduce redundancy in video data. Most video compression algorithms and codecs combine spatial image compression and temporal motion compensation. Most video codecs also use audio compression techniques in parallel to compress the separate, but combined data streams as one package.

To implement the video compression in Android we need a video to be recorded with the surfaceView and a Media recorder. Therefore, before starting a video recording we need to set the required parameters to the Media recorder like the Video Frame Rate, Video Size, Video Encoder, and Video Encoding Bitrate.

Compressing a video of 20MB can reduce to 2 to 4 MB, helping users to a much faster sharing/uploading.

Here’s the code snippet for compressing a video file in the Android app.

mediaRecorder.setVideoSize(640, 480);


Compressed video files will take less time to Upload, Sync, Share while saving storage space. However, compressing a video file may reduce the video quality depending upon the settings that have been applied.


Jayadev Das

Do what you do best in – that’s what I’ve always believed in and that’s what I preach. Over the past 25+ years (yup that’s my expertise ‘n’ experience in the Information Technology domain), I’ve been consulting to small, medium and large companies ‘bout Web Technologies, Mobile Future as well as on the good-and-bad of tech. Blogger, International Business Advisor, Web Technology Expert, Sales Guru, Startup Mentor, Insurance Sales Portal Expert & a Tennis Player. And top of all – a complete family man!

    Contact Us

    We’d love to help & work with you

    When do you want to start ?

    Enter your email address to stay up to date with the latest news.
    Holler Box

    Exit pop up

    Sad to see you leaving early...

    From "Aha" to "Oh shit" we are sharing everything on our journey.
    Enter your email address to stay up to date with the latest news.
    Holler Box