So I have tried 2 things: 1. inserted a MediaPlayer and 2. Inserted a VideoView in my layout, and tried setting the Url of the video.
None have worked, both with an MP4 and FLV file. From what I've read on SO, the videos probably have unsupported encoding or such, and my guess is that I need codecs for them to play.
So naturally, I have these questions:
If I have the MP4 or FLV files, can I check which codecs I need?
Once I know which codecs I need, how would I go about adding them in my app? Are there any open source ones, or do I need to write my own?
Note: Chrome on a PC can run these videos just fine.
The problem might be with the video encoding. Android FROYO and Gingerbread doesn't support H264 formats other than "Baseline" H264. So if your video is Mp4 & H264 encoded make sure its "AVC baseline" encoded. Use some tools like "Media info" in windows/Linux and check your video encoding. Convert the video to Baseline if possible.
An alternative workaround is to skip the Videoview and use a video play intent and redirect the playback to an app. User will be prompted to pick a player to handle the playback. Obviously if the video view cant play the file, the default player also wont be able to handle the file. you can choose some other installed player like Mx-Player which will stream the file perfectly.
The problem why the videos does not played was the phone does not have the supporting video codecs.
This is because the video is recorded in some device with specific codec(mpeg4), but that recorded video cannot be played in other devices that does not have that mpeg4 codec.
So to overcome this we need to install the missing codec on to the phone. This can be done by
1) Install MX video Player from the Google Play Store
2) This MX Player itself ask the user to install the codec that the phone needs.
3) Click ok to Install the codec from Google play store. Click “install” and click “Accept & Download”
4) Click Keep Shopping button to start download.
5) After download completed. Then click the video file and open it in MX Video Player to play the video.
6) If it ask to upgrade the player, please proceed to install latest MX player using the Google Play Store(proceed step 3,4 and 5)
7) Otherwise video will get played on MX Video Player.
Related
I am aware that some unsupported .MP4 videos doesn't play in Android.
Video is recorded from default camera app in iPhone and shared to android device.
I've also checked for any available answers. I found FFmpeg library. I guess it is used to stream online videos but I want to play local video stored on SDcard.
I tried to fire an intent and let user choose to play video from any installed player eg. mxPlayer. It shows the error "can't play video" but after clicking on OK it starts playing the same video. Other players like vlc n moboplayer doesn't play the video.
So is there a way to play every recorded video from iPhone in Android?
I would like to show some video in my android application.
Video are like: http://myserver.com/video/myvideo.mov All the video are in .mov and some in .flv.
.mov have H264 - MPEG-4 AVC (avc1) video channel, and MPEG ACC Audio (mp4a) audio channel.
.flv have Flash Video (flv1) video channel, and MPEG Audio layer 1/2/3 (mpga) audio channel.
If I play the .mov with the default android player I can see the video image, but I can't hear anithing.
With the .flv I can see and hear the file in the default android player.
Is there a way to play correctly the .mov with the MPEG ACC Audio (mp4a) audio channel?
Anyone know if there is a custom library to play this .mov files? Thank you in advance!
As stated here MOV container even with H264/AAC inside is not supported in Android. The underlying reason is that MOV (aka quicktime file format) is a proprietary container from Apple (it is a close one from MP4 but still not the same) - most of the time it works 100% only on Apple device and/or quicktime player.
FLV container from Adobe is also not supported in Android (FLV can be packed with H263 or H264 video inside).
It can work on some device but as you experienced it, it can be clunky and surely inconsistent across devices.
Your best bet is to package/transcode your file in a format where you know you will have cross-Android compatibility.
If you want it badly you could think about building your own video player/decoder to play back mov/flv files (like with ffmpeg) but it is an advanced project in itself and providing code for that would be outside of the scope of stackoverflow - maybe have a look here.
after a long try and searching on the net i found no way to play video with all extensions programmatically. I tried videoView and other android normal tools that play just few video extension and tried to configure android vlc player but it failed to run.
can any body help me to play videos with all extensions or convert them to standard extension that android can play them such as MP4 (conversion can be server side and no programming language restriction exists)
I installed the following programs on my android device and so far it plays all video formats...
MX player pro
FLV video player
MOBO video player pro
I'm working on certain project that allows some video editing, uploading edited video to server (Amazon S3) and playing this video on device.
The iOS version is already completed. I'm using there GPUImage to edit and encode videos.
I'm using quicktime container and h264 codec.
Now I'm working on android version of this project and have encountered several problems.
While I'm able to download and play these videos (encoded on iPhone) on the android devices, I'm not able to play the stream of these videos on most of android devices.
I have done some research and one of advices was to add some code to iOS postencoding that converts to mp4 and fixes MooV http://fabiensanglard.net/mobile_progressive_playback/index.php, but it doesn't help.
The only thing that I have achieved after that "fix" is to hear audio track and not getting error message on Galaxy SII device, but on other devices there is the same story.
After that I have downloaded VLC player from play store and it plays these videos.
So my question is, what do I need to do to play h264 stream?
How can I implement my own video player or how can I use VLC source code to play these videos.
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.