How to convert 3GP video for Android to view? - android

I'm creating 3GP videos with the Android - however, when the 3GP files are posted on a site, the same Android phone cannot view it back. (The file works on the iPhone).
What is right way to encode/resize the 3GP video so that the video player on Android can play it back?
Thanks

Solved this by converting it to MP4 and then recompiling the Nginx server to have the MP4 streaming module. By default, Nginx mimetype was set to [application/octet-stream] instead of [video/mp4].

This seemingly was resolved on Froyo handsets - at least, when a 3gp file is opened in a browser window using http, and not rtsp, the video plays fine. On 2.1 it doesn't.

To make mp4 video streamable, you should change it's 'atom' byte order.
I'm using qt-faststart tool from ffmpeg package for this.
This tool changes the order of some meta-data inside mp4 container and as result allows to perform video "streaming" over HTTP.

Related

How to make a Video Player using Native Android that have resolution switching ability like we see in YouTube?

I want to use a video player eg. using ExoPlayer in android app which will support switching of resolution like we see in YouTube.
My API have video files for 480p,720p,1080p.
I want to give those options in the player and can switch it from the player itself and will play the respective files from URL.
I have seen solutions like track selector etc,but does that work for online files? I have links like :
www.example.com/videos/480/demo.mp4
www.example.com/videos/720/demo.mp4
www.example.com/videos/1080/demo.mp4
Please suggest if there is any other solutions like API change or any other protocols etc.
Why you don't convert your mp4 file to hls or mpd streaming format with ffmpeg so you can stream it chunk by chunk and the player will select the best resolution based on his algorithm?
Have a look at this project, this allows user to select resolution manually via track selection from hls stream encoded by ffmpeg.
https://github.com/namespace7/HLS_Player
To generate hls stream from a video,go through this link
https://superuser.com/a/1302736/1108219

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 :)

Which video format and Codec in iOS, is supported in Android?

I am recodring video via UIImagePickerController. Then I upload my video to PHP server. But Android is not able to play video after downloading it from server.
UIImagePickerController returns video in .MOV format. I save this video in .mp4 format (just by changing file extension according to Second answer in this question) . To play it in android.
In iOS i am able to play video after downloading it from server but not in android. I think this is codec issue. Android does not support all iOS video codec. Someone please help :)
What should I do so that Video is compatible on iOS and android both.

is MP4 a streaming protocol or file format?

I am currently using Wowza to stream videos. I am currently trying to integrate Wowza, Android, and ChromeCast Device (CCD). According to this document, https://developers.google.com/cast/docs/media, Google Cast supports the "MP4 protocol".
So, my question is this: is MP4 a streaming protocol, file format, or both?
In the ChromeCast Android demo applications, they simply pass a URL like this http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 as metadata to the CCD.
To me, this implies that no server is required to stream the MP4 file. Meaning, I won't even need Wowza as an intermediary party to stream.
Is this understanding correct?
It seems that the client player will then be responsible to interact with the MP4 file directly (e.g. seek, pause, stop, play, etc...).
While you've already accepted an answer, and gotten your app to work (which was likely your ultimate goal), I thought it might be helpful to answer your question as well about what MP4 really is.
MP4 is a video container format; inside the MP4 container is video stream data (generally encoded in the H.264 format) and audio stream data (often encoded in the AAC format). The client player can interact with it directly because the Chromecast's browser has HTML5 video support for interpreting the MP4 container format and playing back the H.264 video and AAC audio, but it isn't "streaming" in the way that term is often used ... it's just downloading it from your web server in chunks and playing it back. There's nothing wrong with this if it's performing as you'd like (in fact, this is one of the big benefits of HTML5 video, that it doesn't need a streaming server backend), but if you actually want true media streaming (to leverage things such as adaptive bitrate switching, licensing, and so forth), you would have the MP4 file served via Wowza rather than via your web server.
If you simply have an MP4 file, just pass its url and it should work fine, just like the samples (CastVideos) projects that we have on the Github.

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