I want to compress video and found only one solution to use ffmpeg.
I found this Trying to use FFMPEG for android. Compiling but still not working but not able to get how he compiled it.
You could use precompiled libs from the JavaCPP Presets along with FFmpegFrameRecorder from JavaCV to compress images, as shown in the RecordActivity sample, for example.
Related
I need to make movie (MP4) using sequence of bitmaps. I am using Jcodec it's working fine but if i share the video which one is builded using Jcodec, it's not supported by whatsapp. So i plan to make the movie from ffmpeg (Prebuilt libraries https://github.com/tanersener/mobile-ffmpeg) it's working fine. But my universal apk size was increased up to (50mb). I just need to make movie from sequance of images so i don't need any external libraries and audio features also. So please help me someone to build the ffmpeg for only convert the sequance images to video only.
Thank you.
You can remove some packages like an opus.
probably you don't need all future.
you should change this file
I am working on an Android Camera Application which have capability of Image and Video capturing. Later users can annotate on the image and add watermark to Video. All went fine when drawing Annotation on Image but failed to get no solution. In iPhone there AVComposition Library to draw watermark on Videos. I don't know whether such library exists for android or not but I would like to know if someone has come across such requirement and got any solution.
Can some one guide how to get it started for composing an image on Video. Atleast adding text to the Video somewhere
In case anyone is still looking for this - ffmpeg can be used on Android to add a watermark to a video, but you do need to be aware that video processing on a power and processing limited device like a mobile may be slow and may run down battery if used extensively.
An example of the ffmpeg command to add a watermark to a video using ffmpeg, from the ffmpeg documentation is:
ffmpeg -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map '[out]' out.mkv
See here for the official documentation: https://ffmpeg.org/ffmpeg.html and look at '-filter_complex filtergraph (global)'
ffmpeg can be used in Android projects using one of the wrapper libraries that exist to support this. Although, ffmpeg was designed as a command line tool, this approach does work reliably in my experience.
The library below is a good example of a well supported Android ffmpeg wrapper library and it includes a sample APK so you may be able to actually try out the ffmpeg command you need with that to ensure it works before adding to your own project.
https://github.com/WritingMinds/ffmpeg-android-java
I have successfully compiled and build ffmpeg library in android after 3,4 days research work.
Now I want to grab frames from video. But I don't know which ffmpeg method with command to be called from java class to grab the all frames. Any one have idea about it? or I want to overlay 2 videos. Is there any direct method available in ffmpeg to merge two videos one over another? If yes, how to call it from java class?
compile ffmpeg.c and invoke its main() via jni.
For more details see how to Use FFMPEG on Android .
Also refer this github project. And this tutorial too will help you.
I hope this will help you.
I need to merge images to video as an overlay and export it. I have found ways to create video from images using javacv but didn't find any jar or library which do add images as an overlay to existing video, some of the links suggest to use FFMPEG and JNI to achieve this but sadly i don't have any knowledge of JNI. They use avfoundation framework in IOS to achieve the same.
The above image is replica of my requirements, if any one can guide me in right direction and provide me some useful stuff to start with would be appreciated.
What i have achieved so far is:
1) Compiled FFMPEG.
2) Generated .so files
3) Compiled and able to run Hello Jni project.
What i am searching for is:
1) Splitting video into frames.
2) Merging my overlay images with video frames
3) Recreating the video with audio.
and i know JNI is the only way to achieve this so searched a lot but didn't find any good JNI stuff to start with. I am not asking for the whole code but if some one can point me out with some good tutorial or blog would be great help.
Thanks!!
The way to accomplish this is like you said - incorporate a video codec and use it to re-compose the video.
Decode the original video
Draw your overlay over the original video frames
Encode the frames again.
Using FFMPEG with JNI is the obvious solution, but if you find any other codec library that can accomplish the same with pure Java, it will work too.
No knowledge of JNI? That's about time to learn it =)
References for learning:
NDK docs on your file system: http://developer.android.com/tools/sdk/ndk/index.html#Docs
JNI - http://192.9.162.55/docs/books/jni/html/jniTOC.html
FFMPEG for Android - there are many tutorials out there and many source trees that contain a ready build environment.
You can either follow them or just do it on your own - provided that you understand the NDK environment and can read makefiles.
This is an example: http://vec.io/posts/how-to-build-ffmpeg-with-android-ndk
Using FFMpeg to encode\decode frames - sadly, no good up-to-date tutorials here, there is the API documentation: http://ffmpeg.org/doxygen/trunk/index.html
Blending bitmaps - use Android's Canvas infrastructure, or just manually copy pixels over each other and blend according to alpha values.
Warning - this is a complex library to build and you'd better experiment with easier NDK projects before attempting this one.
I want to create a video using ffmpeg by taking byte[] data from Android Camera. Now the problem is i don't have much knowledge about ffmpeg. So i need some documentation on ffmpeg. I will appreciate if anyone can provide some useful tutorial / sample code / example on ffmpeg and how it works , how it can be used to create video programmatically, Thanks.
ffmpeg is a C library so you will have to use NDK to build it and bridge it together with your Android device using a JNI interface. As far as I know, I dont think its possible to record a video directly using ffmpeg. However, you can use openCv to capture video stream then decode/encode it with ffmpeg if you decided to go this route. Once again, all of this must be done in C/C++, and the information can be sent to the android device via JNI using NDK once you finished processing it with ffmpeg.
Here is the link to OpenCV Library for Android
http://opencv.org/downloads.html
Once downloaded, there are sample projects which show you how to record video using native android camera and as well as using opencv feature.