Save some part of livestreaming video from videoview like VLC player - android

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.

Related

Playing videos from external Camera to Exoplayer without the usage of Streaming(RTMP,RTSP etc)

I have a situation wherein ,I want to capture video and audio from a external camera and view the media in any container format like (MP4,FLV,MKV etc) and play it in ExoPlayer or any ..Is this possible.??
And I am using a HiMedia Q10 Android Box..
...It would be really helpful if someone could suggest me with some ideas...!!

Set cover image while record audio in android

Hello I am recording audio using MediaRecorder and save it in MP4 format. and upload to the server. as well record video as MP4 using camera and upload to server.
So while I am receive my uploaded item from server as uploaded url list. and I am playing all it in VideoView. video and audio play good. now here is the thing while I am playing video it's display video frame on video view but while playing audio it's black. basically audio and video file extension are MP4 so I can't make different while adding it in to VideoView other wise I'll add imageview and display some default image and hide VideoView.
so is there any way to record audio with cover image so while I am playing it in Video view so it display that cover image...
I know that using ffmpeg we can do this but I got lots of error while compiling it in my windows pc. so is there any way to add cover image while record audio with pure android api? sorry for bad english.
I google everything but I can't find any solution for convert audio file to video file with using image. So I have to go with FFMPEG.
So I add WritingMinds java FFMPEG in my project using gradle dependency. Then convert MP4 audio with cover image into the MP4 video.
There are some limitation in this precompile library. like it not work in android 24 and some commands like -speed, cpu-used, -deadline which are most important for all the operation(But still we can perform other operation). there are some disadvantage also like slow speed, and some features which required for specific operation are not include in the compile library. (So I gave advice to compile your own ffmpeg library for android project in linux or mac pc(windowns have lots of issues)).
I hope this will help someone who's this type of scenario :)

Saving .cgi stream image format as Video

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

FFMPEG output video from stream of images

I know how to use ffmpeg to covert image sequence to a video.
What I want to do is start converting images to video, before I have all the images ready, i.e. as soon as I start to output images, ffmpeg starts conversion, and stops when the images stop coming. Is there any way to achieve this?
Edit : I'm trying this in Android.
If you want to store video on sdcard, you should start with FFMpegFrameRecorder class from OpenCV for Android. You can google it easily. It will allow you to add single frames and create a video bit-by-bit.
If you need to keep your video in memory, you will have to write your own frame recorder, which is not that trivial, but doable and I can help you a bit.

Android VideoView streaming

I have a project with a VideoView in it I am streaming a video from online using this method:
mVideoView.setVideoURI(Uri.parse("http://db.tt/ij7w1Nw"));
My videos are mp4 files downloaded from Youtube. I then upload them to my dropbox, that is where the url comes from. This works fine if I download the video and do not make any changes to it, and upload it straight to dropbox. However if I try to make any changes to it for instance convert from .flv to .mp4, or change the size, then I upload it to dropbox it no longer plays in the VideoView. I get a dialog that says 'Unable to play video. Invalid streaming data'. If I take this same exact video and put it on the SD card either manually or even by having my app download it from the url then play it off of the SD card using
mVideoView.setVideoPath(path);
it works fine. I am using Wondershare Video Converter Platinum to do the conversions and size changes.
Is there some sort of specific encoding that is required to stream an mp4 file rather than play it from a local copy? Am I getting this because of some sort of bug/error with wondershare? Has anyone else experienced this type of problem, if so how did you end up fixing it.
Thank you.
The media format guide may help you see what's available. In my experience wrapping a H.264 AVC or MPEG 4-encoded video in a 3GPP container provides the easiest integration. Android is very fickle with both audio and video streaming.

Categories

Resources