I am looking for a way to "compress" an mp4 video. To achieve this, I want to reduce the resolution of the video and / or reduce FPS.
After long research, I think the way to do it is to use MediaCodec and related APIs as follows :
-> MediaExtractor to extract encoded media data from a mp4 file. -> MediaCodec (Decoder): Decode each frame for later processing. -> MediaCodec (Encoder): At this point, I guess that's where we should establish MediaFormat parameters such as video resolution, which should help us to reduce the final size of the mp4 file. -> MediaMuxer for generate mp4 file (MinSDK 18, this might be a problem, but for now... ok) .
I don't want to use a SurfaceView/TextureView. Regarding the audio, I don't want to process it to reduce quality.
I've been looking at all the examples here: http://bigflake.com/mediacodec/
I've also seen CTS source code modules.
And I've been looking at several projects like these: https://github.com/vecio/MediaCodecDemo/blob/master/src/io/vec/demo/mediacodec/DecodeActivity.java
And of course I have read dozens of posts on stackoverflow.
The problem is that I have not yet found any code example that works well for this porpuse. I tried to take various pieces of code and put them together on a project, but does not really work.
Thanks.