How to compress a video to maximum level android

流过昼夜 提交于 2019-12-13 17:15:18

问题


I am working on Android app.

I am compressing recorded video clarity to send it to server. The maximum lenght of video is of 30 sec.

I am able to upload the video from the phones having 2 or 3 MP.

But unable to upload from the phones having 8 MP like Samsung S3 or S2 or grand..

screen keeps on loading (which means uploading).

Any once please help me how to compress video to maximum level.

My code:

File mediaFile = new File(
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI.getPath()
                        + "/IRCMS_video.3gp");

        Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

        Uri videoUri = Uri.fromFile(mediaFile);

        intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri);
        intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT,41943040);
        intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT,30);
        intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);

        startActivityForResult(intent, 3);

来源:https://stackoverflow.com/questions/21002163/how-to-compress-a-video-to-maximum-level-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!