how to save the mjpeg stream as 3gp or mp4 format video files to the sdcard in android

前端 未结 2 723
广开言路
广开言路 2020-12-21 19:57

i have saved the mjpeg stream to the sdcard as xxx.mjpeg .However, the mjpeg video file was not supported in android. so how could i encode mjpeg video into 3gp or mp4 forma

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-21 20:25

    There is no way you can achieve this with current Android API.

    You need to encode the frames using an encoder in C++ and pass your bitmaps to the encoder via JNI. You can start with MoboPlayer's ffmpeg port. You may find the download link to their ffmpeg port at the bottom of this page

    If you have the image sequence in Bitmaps, you can access the Bitmap's buffer from JNI using the AndroidBitmap_* methods and pass it on to ffmpeg for encoding

提交回复
热议问题