简体   繁体   中英

Android MediaCodec api compress video

I am building an app where i need to compress video before uploading it to server. I have tried ffmpeg4android( https://github.com/chloette/ffmpeg4android ) which is very heavy in size. Its increasing 20MB size of my app.

I tried MediaCodec android api, which is not working as expected.

Can anyone have working code example for compressing a video with MediaCodec android api?

Update: Yes looking for MP4 containers.

This is a vague question since you do not specify a codec or file container, but assuming you are interested in H.264 codecs and MP4 containers there are a lot of examples here . Specifically, you will probably be interested in CameraToMpegTest.java .

Note that even though the requirements are stated as Android 4.3, MediaCodec support is poor until Android 5.1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM