Search code examples
androidvideocompressionandroid-mediacodec

Compressing video file based with Multiple Resolution format options in Android


I am using MediaCodec Native API to compress video. My requirement is , I also need to show the user, list of available resolution formats for video compression(assuming that if user selects any of the resolution format, the output file should be less than 5MB). So, I need to be able to calculate the compressed video size based on resolution option chosen by the user before the actual compression. Is this possible in Android? I have searched extensively, but unable to find any answer. Any leads would be very helpful. Thanks!


Solution

  • You can calculate the output size by multiplying the output bitrate (bit per second) with the length (seconds) of the video.