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

微笑、不失礼 提交于 2019-11-30 09:47:54

问题


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 format and then store them on sdcard ,at last ,i can play back the 3gp or mp4 video on my android phone ,thanks in advance.


回答1:


I am not aware of state of mobo's ffmpeg source out there. I had built it long back.

I tried the rockplayer's ffmpeg port. This has hassle free build. I was able to build it today successfully on NDK_r4b.

You can download the source from here : http://www.rockplayer.com/tech_en.html

modify the config.mk to change your tool paths and run build_andriod.sh (spelling is wrong, but it works :) )

let me know how it goes




回答2:


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



来源:https://stackoverflow.com/questions/8632607/how-to-save-the-mjpeg-stream-as-3gp-or-mp4-format-video-files-to-the-sdcard-in-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!