How to use hardware decoding of media files using ffmpeg android? - android

i am developing a media player application in android which uses ffmpeg for decoding which i think is software decoding. it doesn't play high resolution videos smoothly so i would like to switch to hardware decoding. I came to know that libstagefright will do the thing. But how to implement it using libstagefright? Is there any samples or documentation . Please help in using the libstagefright.

if you are using ICS you can use MediaCodec to encode or decode using hardware.
see http://developer.android.com/reference/android/media/MediaCodec.html for more details and examples.
Thanks,
NinjAndroid,
MoMinis R&D team

Related

Is it possible to convert h265 video to h264 with resizing in Android app without the FFMPEG?

I want to convert all videos based on h265 to h264 and at the same time reduce the resolution to for example 720p to avoid working on very big resolutions and later uploading that kind of big size files.
I see docs https://developer.android.com/guide/topics/media/media-formats says that for h265 Android OS supports only decoding, not encoding.
I know that FFMPEG will solve all my problems, but including FFMPEG will increase the app size very much, I'd like to avoid that. I am trying to use currently the Android MediaCodec, but it looks like it would work fine with converting h264 to h264 but not with h265 to h264.
Do you have any ideas? I don't need to support old Android versions.
Thanks for any advice.
If you're compiling it for Android 12 or higher, you can use the built-in transcoder
Otherwise, you'll need to include a 3rd-party media transcoder library, and FFMPEG is still your best choice

Streaming and recording video on android at the same time

I am searching for a library which offer ability for streaming video from android device (5.1+) and recording it at the same time.
I tried MediaRecorder - the usual way to record videos on android - but with it I am not able to stream it over webrtc or rtsp because camera is busy.
Currently I am using libstreaming. With little modification done app can record and stream over rtsp concurrently. But this lib lacks support for hardware codec in MTK and SPRG chipsets.
I am wonder if you can recommend a solution or another lib which.
By the moment lib works only on nexus 4 with qcom chipset.
After several days of research, I came to the decision to use a combination of FFMpeg and MediaCodec.
It seems that the only way to get frames from camera at high rate is to use Android MediaCodec API. But MediaCodec supports only mp4 file formats, which is not an option for me (I need ts), while FFMpeg can process\create any kind of human known video formats.
Currently I am trying to make it work together (read ByteBuffer from MediaCodec and feed FFMpeg recorder with it).
Useful links:
Grafika project: https://github.com/google/grafika
ContinuousCapture and Show + record are the most interesting parts to check
javacpp (specifically FFMpeg wrapper): https://github.com/bytedeco/javacpp
Has example with recording and streaming.
kickflip sdk: https://github.com/Kickflip/kickflip-android-sdk
The library which makes two mentioned above tools works together and also is open sourced. Sadly it doesn't solve my problem fully. The feature I need is requested but not already implemented: https://github.com/bytedeco/javacv/issues/95

Library to support H.264 AVC .mp4 on Android 2.2, 2.3?

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

Transcode/Convert Video to Mp4 on Android

I've a requirement where I need to transcode small video clips shot from Native camera app to lower bitrate/resolution Mp4 which is shreable via email etc.
What is the best way to transcode/convert the video on device itself. FFMPEG or any other library?
p.s. I know this is an overkill for the device but client leaves me with no option. He doesn't care about battery or time it takes. I'm targeting this for quad-cores, where CPU is not a problem.
Your best bet would be to use something like ffmpeg which has been ported to Android (see this SO post: ffmpeg for a android (using tutorial: "ffmpeg and Android.mk") and the ffmpeg port for android which is here: http://bambuser.com/opensource). You'll have to use JNI etc, but that will save you the hassle of dealing with the byte stream yourself.
Haven't tried it on Android myself, so YMMV:
Is there a Java API for mp4 files?
http://code.google.com/p/mp4parser/
If you're recording on-device, why not set the expected format from your code? It appears the api lets you set video size, framerate etc. in the MediaRecorder class.

How to implement a h.264 encoder at mobile platform(android, ios, symbian)

As far as I know, not all the mobile platform(android, ios, symbian) support h.264 encoding. Now I want to implement a h.264 encoder at mobile platform, encoding the videos and transfer them from one mobile phone to another. I found ffmpeg is useful, but I cannot find some useful tutorial. And is there some other efficient methods? Thanks!
update:I have read that manual before and found android 2.1+ does not support h.264 encoding. Different means of implementing h.264 video encoding on each OS or a way of doing this in a cross-platform manner are both ok :-)
How about http://developer.android.com/reference/android/media/MediaRecorder.html?
There is also a link to how the AudioRecorder is used. Guess the procedure is the same for video.

Categories

Resources