How to compress a video to maximum level android
Asked Answered
W

0

2

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);
Whimper answered 8/1, 2014 at 17:12 Comment(2)
For people who know something about compression: Is there a theoretical "maximum compression", assuming your video would be total chaos? Each pixel random.Alternation
@MartijnCourteaux it depends.. the way video compression usally works is similar to JPEG (if you're familiar and if you're using lossy compression), and then you have intermediate frames that hold an image, and frames between those intermediate frames that are built depending on the frame before it or the frames before/after it (depending on compression type). So really it depends on how many colors are involved and what the video is of (how much movement/is the camera steady?/etc). Better explanationIncapacity

© 2022 - 2024 — McMap. All rights reserved.