I am creating a video streaming app which uses a IP Camera as external device.
I can already get the image (.cgi format) from the ip url of the device(192.168.x.x/image/image.cgi). I can update the image view every several milli seconds to update its content and its working great, no issues there.
The question is, can I save this bitmaps as video (.mp4)? I tried MediaRecorder before and works, is there a way to do that on streaming bitmaps ?
thanks
The "video" is a stream of jpeg images.
See
http://thistleshrub.net/Joomla/index.php?option=com_content&view=article&id=115:displaying-streamed-mjpeg-in-java&catid=43:robotics&Itemid=64
for some java code that displays such images. You need to transcode the images to a different format. E.g. on the command line that can be done with
https://unix.stackexchange.com/questions/12193/transcoding-mjpeg-stream-to-flv-or-mp4
Doing this on android has been discussed at how to save the mjpeg stream as 3gp or mp4 format video files to the sdcard in android
googling for mjpegstream video convert gives you more results ...
Related
i am developing an android app for my ip camera, and the camera has some specific api commands that it can respond to. the problem i am stuck on is that i want to display a list of videos available on the memory card of the camera. I am getting the file list but i also want to get the thumbnails of those files.
The problem in getting the thumbnail is that i don't have any direct IP address of the video, the camera only provides me two things for accessing the video
1. RTSP URL of the video
2. Data stream of the video, so that i can download it in my code.
Can someone tell me how can i get the thumbnail of the videos if i have the above mentioned available options?
Note: there's also one API available in the camera for providing the thumbnail of the video, when i send that command it returns me one frame of the video, currently it is sending me the corrupt frame and this method is not working, that's why i am focusing on getting the thumbnail from the other two available options.
any help will be highly appreciated.
Thanks
You could open a socket and stream a few seconds from each video, saving the file locally on your Android device.
Once you have it there, so long as it is a recognisable video format, you should be able to create a thumbnail in the usual way (http://developer.android.com/reference/android/provider/MediaStore.Video.Thumbnails.html).
You would need to be careful to make sure that your app actually did not try to play these truncated videos, and went instead to the proper stream URL if someone wanted to view them. You could actually deleted the file after creating the thumbnail if you wanted to be sure.
Doing this may take a little time initially if your camera has a lot of videos, but you should be able to set it up to only create thumbnails for new videos once it has run once which should speed things up.
It is also possible to create thumbnails from streams directly using ffmpeg or VLC (e.g. https://superuser.com/q/592160) but I think you may find the above approach is simpler for your needs and it avoids you having to integrate ffmpeg etc with your app.
Scenario : I want to give user an option to save some part of the live streaming video from the surfaceview present in android (give him a control startSaving() and stopSaving())
I am able to display live streaming on android surfaceview by giving the url of ipcamera to it.
Now i want to save part of the live streaming in my sdcard (in any playable video format)
What i tried : i am able to get data in byte[] which is most probably mjpeg frame(dont know what format they are in), I stored them up in vector and tried converting them to a file with .mp4 extension, obviously video was corrupted as i did not encode it in any way.
So my question is how should i save it as media file(any playable format)? how should i approach this?
note: i dont want to use NDK
Thanks in advance.
I want to play some animtaions (actually, gifs) which were previously encoded (with h264 codec) and downloaded from network as mp4 files (because mp4 files are much smaller than corresponding gifs). So, on a device I want to decode mp4 and get all the frames to create animations. And the question - what is the best way to decode mp4 to accomplish my task?
I have got a Bluetooth application on android that sends jpeg to PC. I want to convert the jpeg to h.263 or any other video format and send the video stream via bluetooth.Is it possible to convert the streaming jpeg images to video format on Android or PC ?
I found one Windows application to convert jpeg images into Video format. Check this software, it may help you.
JPGVideo Download
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.
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
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