I am building an app using AndroidFFmpeg(https://github.com/appunite/AndroidFFmpeg).
With medium file size(<100MB), the player works well. But with the large file size(from 100MB) or HD video format, the video is so slow and lag, not sync with audio, the audio is break.
Can anyone know this issue, please help me. Any suggestion would be appreciated. Thanks!
both video files were created with the same codecs?
This is very important, because you will experiment an annoying lag if some videos has codecs that are not supported.
In android i have the standard for codecs:
H.264 for video.
AAC for audio.
Related
I have found a solution for resampling an .mp4 video taken with the camera on the device to make it smaller (resizing by resolution, bitrate, and framerate). The problem is, it doesn't carry the audio over.
I have looked at several different options for trying to get the audio out of my source (large) mp4 and push it into my smaller mp4 and I can't not seem to get any of these procedures to work correctly.
I've tried the following:
1) extracting the PCM audio from the source using: How do I extractor audio to mp3 from mp4 using java in Android?
2) converting the PCM to M4A and then adding the M4A to the smaller MP4 using: https://github.com/tqnst/MP4ParserMergeAudioVideo/blob/master/Mp4ParserSample-master/src/jp/classmethod/sample/mp4parser/MainActivity.java
that's the method I got closest with but the audio was really slow and didn't match up at all with the video in the smaller mp4.
I also tried a "direct copy" from one mp4 to the other with a variation of this: Concatenate multiple mp4 audio files using android´s MediaMuxer
that made my smaller mp4 actually larger (in file size) than my source mp4 and it didn't actually move the sound over.
The android documentation for MediaMuxer is pretty terrible and I can't make heads or tails of what I need to do to get this to work. It seems like it should be a pretty trivial task....
any suggestions or advice would be greatly appreciated.
TIA
I ended up just using ffmpeg with this solution:
https://github.com/WritingMinds/ffmpeg-android-java
My company's app relies heavily on video recording and playback of web-based videos. I use the MediaRecorder API to record videos, through this library designed by me: https://github.com/afollestad/material-camera.
For playback, I use this library which is basically a wrapper around Google's ExoPlayer library: https://github.com/brianwernick/ExoMedia.
It works fine for the most part with small videos, especially if I decrease bit rates for audio and video. However, larger and higher quality videos have many issues. Sometimes they seem to buffer forever, sometimes playback doesn't even start successfully, etc. Again, these videos are being streamed over HTTP from Amazon S3.
I've read a little bit about FFMPEG, and how it can process MP4's for "faststart", splitting the files into chunks for DASH, etc. However, FFMPEG solutions for Android seem a bit complex, so...
Is there anyway to record MP4's from Android, with MediaRecorder, MediaCodec, or some other API which results in a video file that is fast to stream? It amazes me how well Snapchat has figured this out.
Well, I ended up trying the stock MediaPlayer API again. As long as you're on API 16 or above, there should be no major issues with the default hardcoded buffer size.
I ended up making a small library in case others need a nice solution to video playback: https://github.com/afollestad/easy-video-player
I'm creating an app that has a function that plays user selected video's. Nothing fancy, just playback of video's on the device itself without any advanced settings. Since MediaPlayer has issues with some video types I use Vitamio. It works great on smaller compressed video's but when I select a mp4 video that I've recorded with my phone itself it stutters, both audio and video. I tried changing video quality of the Vitamio Media Player, but it doesn't seem to have any effect.
I'm quite stuck in finding a solution, anyone who has any experience with this?
Please sure the video you recorded is ok, you can playback the video use VPlayer. or pull the video to your computer playback it.
if first ok ,you can try use Vitamio hardware decoder playback it.
I've recently been struggling a lot with playback of a video inside an Android app. The video in question is an M3U8 file, which in turn links to a series of secondary M3U8s, each of which has a list of component MPEG-TS video files, and a single M3U8 file containing the audio components in AAC format. I had a fair bit of trouble making M3U8 cooperate, however that now seems to be working OK.
Unfortunately, the audio is lagging about a second behind the video. This lag is present both in my own Activity containing a MediaPlayer, and simply launching Android's default video player pointing to the stream. There is also frequent visual stuttering or corruption in the playback. Neither issue is present when played with VLC Beta, or in the iPhone version of this app, hence it's not a problem with the video file itself. I tried the Vitamio library, this ran even worse (far more frequent corruption, and no audio at all). Regrettably, changing the video format is not an option.
It seems to me that this issue may be caused by Android's limited support for MPEG-TS - the list of supported media formats specifies that it uses the AAC audio (whereas I assume the iOS version is simply playing both video and audio from the .ts file). Any recommendations/solutions for fixing this lag?
You could try Gstreamer which seems to work well on Android (http://gstreamer.com/), also Vitamio is
I am currently working on an android application in which i have to stream the mobile camera footage live to a public URL. I have managed to convert the .MP4 format to .FLV format so that the video stream can be viewed in a browser using a flash plugin. However, the lag in the stream is about 10-15 seconds. Can anyone suggest dome compression techniques or other tricks and tweaks so that i can reduce the lag time?
Thanks!
Use JW player for faster playback. Also reduce buffering by using suitable flashvar.
refer http://www.longtailvideo.com/support/jw-player/13/embedding-flash.
If you are streaming over WiFi you may face more delay.