I'm trying to use MediaCodec
in Android to compress videos.
It looks like MediaCodec
will give you back the raw stream. Is there a way to go from A->B (compress video with an output file at the end)?
Thanks.
I'm trying to use MediaCodec
in Android to compress videos.
It looks like MediaCodec
will give you back the raw stream. Is there a way to go from A->B (compress video with an output file at the end)?
Thanks.
You can employ the MediaMuxer
class to store the elementary streams into a file format like MP4
. Please refer to this cts
example for a good illustration of transcode + muxing where the encoded data is written into a file through the MediaMuxer
.