I am trying to play a video in android native code using new API mediacodec. I dont want to go mediaPlayer way due to unavoidable reasons. can anybody share some code snippet as to how to go about it? Thanks in advance.
Your original question is too generic. And to be honest, create a new media player in native code is a huge task for your own.
If you are only seeking for some media player solution which has better supporting for variety of formats/codecs like VLC player, you can either try VLC lib which is open source but still in beta release. I have tried VLC, but it really has some crash issues or ANR issues, which is inside the whole framework.
Or you can try with Vitamio SDK which is a library without souce code. Check it out at this link: https://github.com/yixia/VitamioBundle Below is the feature list of it:
I have tried this solution, it is very stable, also some minor issue on 4.3, but still acceptable. So I am not posting any spam here, just copying from the official document:
Vitamio is an open multimedia framework or library for Android and iOS, with full and real hardware accelerated decoder and renderer. It's the simple, clean and powerful API of Vitamio that makes it famous and popular in multimedia apps development for Android and iOS.
According to the developers' feedback, Vitamio has been used by more than 1000 apps and 100 million users around the world.
Vitamio can play 720p/1080p HD mp4,mkv,m4v,mov,flv,avi,rmvb,rm,ts,tp and many other video formats in Android and iOS. Almost all popular streaming protocols are supported by Vitamio, including HLS(m3u8), MMS, RTSP, RTMP, and HTTP.
Network Protocols
The following streaming protocols are supported for audio and video playback:
MMS
RTSP (RTP, SDP), RTMP
HTTP progressive streaming
HLS - HTTP live streaming (M3U8)
And yes, Vitamio can handle on demand and live videos in all above protocols.
Media formats
Vitamio used FFmpeg as the demuxers and main decoders, many audio and video codecs are packed into Vitamio beside the default media format built in Android platform, some of them are listed below.
DivX/Xvid
WMV
FLV
TS/TP
RMVB
MKV
MOV
M4V
AVI
MP4
3GP
Subtitles
Vitamio support the display of many external and embedded subtitle formats.
SubRip(.srt)
Sub Station Alpha(.ssa) / Advanced Sub Station Alpha(.ass)
SAMI(.smi/.sami)
MicroDVD(.sub/.txt)
SubViewer2.0(.sub)
MPL2(.mpl/.txt)
Matroska (.mkv) Subtitle Track
More features
More wonderful features
Support wide range screens from small phone to large tablet
Multiple audio tracks support
Mutitiple subtitles support, including external and embedded ones
Processor optimization for many platforms
Buffering when streaming
Adjustable aspect ratio
Automatically text encoding detection
Related
I am testing out Azure Media services and I am looking for a preset or a custom config which takes an mp3 file and encodes it for playback on iOS, Android (4.0+) and HTML5 for streaming (one manifest hopefully). Currently I am seeing presets for HTML5 and HLS (none for Android) however they are separate and not in one config/workflow. How can I set this up to done. Note I am using the UI and not programming at this time.
Are you planning to deliver in both HLS and MPEG-DASH across multiple HTML5 browsers? You will need to use both of those protocols to reach all of the devices that you have in mind. Android has a really poor implementation of HLS. Most of the Android devices only support HLS v3, so make sure to test your devices with the v3 (muxed ts) protocol.
I would encourage you to use the Azure Media Explorer tool for everything.
http://aka.ms/amse
It gives you easier access to all of the protocol URLs that you will need.
Try encoding everything to Standard Definition Multiple bitrate MP4 files to begin with. Most Android devices only like Baseline profile encoding.
Once you have Multiple bitrate Mp4 files encoded, you will need to enable at least 1 streaming Reserved Unit to allow you to get "dynamic packaging" to work. You need that feature to re-package your MP4 files on-the-fly to HLS and DASH.
Also, if you are looking for an awesome player framework for HTML5 delivery -check out our new Azure Media Player http://azure.microsoft.com/blog/2015/04/15/announcing-azure-media-player/
I am working on a video application and we are generating videos in H.264 AVC Codec. As per Android Media Formats this codec is supported in Android 3.0+ versions.
I wonder if there is any free library that help us to play this format on 2.2 or 2.3. I found a library but it is not free.
I want to support HTTP live streaming for our application and the issue is same.
I have used ServeStream in my project you can find the description from http://sourceforge.net/projects/servestream/files/
And you can also check faplayer-android.
Servestream is another opensource ffmpeg based media player.
It plays mms streams such as mms://streaming.radionz.co.nz/national-mbr.
It has a FFMpegMediaPlayer class that looks just like a regular MediaPlayer.
It plays videos too.
There's definitely no such library. If you're willing to accept software decoding, you can probably build something around ffmpeg/libav and NDK.
Suggest you these porting Libraries 。
ffmpeg ,vlc ,gstreamer
faplayer-android open source url :faplayer-android
Is it possible to invoke(deploy) HTTP Live Streaming (HLS) on Android(4.x)?
https://developer.apple.com/streaming/
Obviously iOS devices can both capture/play, and I know android can at least play, but how about capturing? I wonder interoperability.
Thanks.
The best answer I found so far is
Creating a HLS video stream with FFmpeg
12 May 2013
http://walterebert.com/blog/creating-on-hls-video-stream-with-ffmpeg/
For video conversion I use FFmpeg. Creation of HLS is possible with FFmpeg, but not really well documented. So I had to figure out how to create the video streams. After a lot of research and experimentation I created my FFmpeg HLS reference implementation that is available on Bitbucket.
On iOS the created video plays without problems on new devices. Older iOS devices with a maximum resolution of 480×320 pixels seem to select the best quality stream available, even if they cannot play it. For Android you have to create a MP4 video and before converting it into a MPEG stream. Doing this in a single command creates a choppy stream on Android. Flash playback has still some issues if you change the bitrate. So I still have some work to do.
These are the writings of Walter Ebert on web development, web design and free, open source software
Yes. HLS is widely used on Android 4.x.
We are working on an video streaming application in iOS and Android. We are using Wowza server. Application works fine from iOS to iOS and Android to Android. Means a video published from iOS device can be viewed on iOS device but not on Android device.
I know both Android and iOS support H.264 compression and we are publishing H.264 formatted stream. Here a bit confusion I thin H.264 is a compression technique and further defined by MP4, FLV etc please confirm.
What I think iOS publish stream something like .MOV defined H.264 stream which is not supported by Android that's why I think it doesn't work on Android. Please confirm.
Please suggest any way to play a video stream published through ios app to Android device.
There are two aspects to video files: The container and the encoding (or codec). H.264 is an encoding, and Android can deal with it, but Apple uses the QuickTime container format, which is similar to the MP4 container but apparently just different enough that Android can't handle it. Android can play MP4 files, and there are utilities to convert QuickTime to MP4, if that helps.
I am trying to play some video streams from mms and m3u8 inside my Android application. It seems that the MediaPlayer doesn't have support on this and from what I have read on FFMPEG it seems there isn't any easy way with that also. I am using Android 2.1 SDK.
Any ideas on what I should in order to make this work? There are some apps there in the store that already do this, but I don't know how.
You may try the Vitamio library, http://vitamio.org
Vitamio is a multimedia framework for all Android devices. Vitamio works like the Android's default MediaPlayer except that it includes much more powerful features. And it's absolutely free !
The following network protocols are supported for audio and video playback:
MMS
RTSP (RTP, SDP)
HTTP progressive streaming
HTTP live streaming (M3U8), for Android 2.1+