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
.
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.