Reputation: 145
I need to send a video to the server. Video sizes differ randomly, some can be a Meg and others can be 900Mb.. How does one resize a video to a smaller size?
I can get iOS examples but have not found any Android versions.
Upvotes: 1
Views: 1868
Reputation: 74184
A lot of it depends upon what you mean by making it smaller:
Android's MediaCodec library can change a number of things, but does not give the user a lot of options on "how" it does it:
(that is just a quick sampling of MediaCodec's ability)
The way you use the Android MediaCodec for "transcoding" is use the Decoder to process the original video (off screen), pass those frames to the Encoder (using different encoding options then the original) and save the results to file...
The most popular method for video resizing/transcoding/etc... on Android seems to be using ffmpeg
due to the large number of options available and how well known that application is.
There Java wrappers (and a couple of C# wrappers) available for Android, I have only used the Java based ones via a Binding project. (Google is your friend for finding these).
There is a bunch of licensing "issues" in using FFmpeg and you should review their license:
FFmpeg License and Legal Considerations
Upvotes: 4