VideoCrop
VideoCrop copied to clipboard
Crop video with Android Media Codec API
Video crop app
UPDATE: Actually, used approach is not the best one. Consider using Surface approach for both decoder and encoder. Doing it this way, you can get predictable result before crop, using sufrace for rendering video in UI, and after crop using surface for encode it. I created this project just to check, if it is possible to use ByteBuffer
s instead. Also audio does not work for some reason...
You can crop video to make it square and be less than 20 seconds in duration.
It uses MediaCodec API for decoding and encoding video. Source video file is read by MediaExtractor. Frame transformations are done with regular Bitmap. To be able to do so, it is required to convert frame's pixel array from YUV to RGB and back with help of RenderScript. Frames are saved to file with help of MediaMuxer after encoding.
Screenshots
License
WTFPL because I don't even know if this code works on devices other than mine.