Video compression on android using new MediaCodec Library

前端 未结 1 1147
不思量自难忘°
不思量自难忘° 2020-11-30 00:47

In my app I\'m trying to upload some videos that the user picked from gallery. The problem is that usually the android video files are too big to upload and so- we want to c

相关标签:
1条回答
  • 2020-11-30 01:24

    The output of MediaCodec is a raw elementary stream. You need to package it up into a video file format (possibly muxing the audio back in) before many players will recognize it. FWIW, I've found that the GStreamer-based Totem Movie Player for Linux will play "raw" video/avc files.

    Update: The way to convert H.264 to .mp4 on Android is with the MediaMuxer class, introduced in Android 4.3 (API 18). There are a couple of examples (EncodeAndMuxTest, CameraToMpegTest) that demonstrate its use.

    0 讨论(0)
提交回复
热议问题