Android - Merge image files to a movie (but not using JMF) - android

I'd like to write an app that merges multiple images into a movie on Android. JMF has a basic implementation (JpegImagesToMovie). But, JMF isn't supported on Dalvik.
Is there an alternative library that I can use for this ? Or if there is no library available, does anyone have any pointers for what I need to research to implement myself.
Rgds, Kevin.

I'm not aware of any pure-Java video encoders, and the built-in video encoder in Android appears to be limited to capturing video from the camera alone, rather than a custom input source.
You could look at writing a multi-part JPEG (quite rare but well supported) writer, or even an MJPEG (used by many digicams) encoder.

Related

How to trim a video without using ffmpeg on Android?

I am building an application in which I need to trim videos. It is possible to do this using ffmpeg, but I can't use it because it uses the gpl license.
I tried using mediaCodec but can't use the codes I found.
How can i trim videos on android?
I had to develop trim functionality into my app a few months back and found that FFMPEG is very heavy and wasn't as accurate as MediaCodec.
None of the examples helped me but as I was developing in Kotlin I had to rewrite it anyway.
Here is the breakdown of how to use MediaCodec:
Pass the file to your mediacodec class
Extract the video from a file
Create your buffer size
Seek to where you want to file to be trimmed from or to
Mux your audio and video together
We tried to find a way to do the start and finish times together but we ended up just duplicating the clip first and passing both in with a start and and end time.
You'll need to post your code and show where you're having the issue with MediaCodec for people to help you.

Using MediaCodec asynchronously to decode and render a Video File

Recently started toying around with the Android Media Codec class to render the video frames from a Native C++ application. Was able to successfully decode and render both audio and video streams using Android MediaCodec class using synchronous approach[queueInputBuffer and deququeInputBuffer].
Android has a good reference example of how to do it in Native C++ Application. Ex : SimplePlayer.cpp
Now i have started with the implementation of asynchronous approach using callbacks and feed the input streams to codec in those callbacks[OnInputBufferAvailable/ OnOutPutBufferAvailable].
I was searching around for a sample code on internet and all i can find are the references which are based on Java MediaCodec class.
If anyone has any sample reference code or any links to the C++ based asynchronous usage of MediaCodec to render a video file, that would be great.
Any guidance on this would also be great on this.
An example of converting the ExtractDecodeEditEncodeMuxTest example from synchronous mode to asynchronous mode is available at https://github.com/mstorsjo/android-decodeencodetest. See the commit history for all the steps leading up to this.
This isn't C++ and it isn't for rendering, but it covers a few of the essential aspects at least.

which process to use for encoding and editing videos in android

i want to build a video editor like this app Link
my problem is that should i use ffmpeg or any other similar library to encode the videos to edit and then to decode them
or should i use completely different approach to edit the videos.
any help will be appreciated
Why not make a list of your proposed features then check if FFmpeg can do them? That will answer your own question.
You can use FFmpeg to decode various formats to raw data like pixels (for image) and PCM (for audio) then use the audio programming skills or pixel manipulation skills you already have to modify the data. If you have no skills then you're limited to making a user-interface for FFmpeg, aren't you?
For example : If a user moves the slider to adjust image (video frame) brightness is your code using a for loop to adjust each pixel values or maybe you're using a colorMatrix? How will you show live preview since FFmpeg must first encode the entire video with new brightness. This information is missing from your question.
Then use FFmpeg again to re-encode to output format (some formats like MPEG require a paid license to encode data in its format by any "paid-for" software so check your rights as Android developer, maybe Google covered that step for you).

How to read each frame from a movie file in android?

My application want to read each frame from a movie file and used to other.
How can I do it?
I don't know that there's a way to do this using the built-in decoders (but would be glad to hear of it if there is). You might have to make something based on modifications to the alternative software decoder included in the android sources, or an external alternative such as ffmpeg or mplayer.

Decoding Encoded Audio Data (MP3s, etc) on Android Without Playing It

Short version: What is the best way to get data encoded in an MP3 (and ideally in an
AAC/Ogg/WMA) into a Java array or ByteBuffer that I can then
manipulate?
I'm putting together a program that has slowing down and speeding up
sound files as one of its features. This works fine for WAV files,
which are a header plus the exact binary data that needs to be sent to
the speaker, and now I need to implement it for MP3 (ideally, this
would also support AAC, Ogg, and WMA, but since those are less popular
formats this is not required). Android does not expose an interface
to decode the MP3 without playing it, so I need to create that
interface.
Three options present themselves, though I'm open to others:
1) Write my own decoder. I already have a functional frame detector
that I was hoping to use for option (3), and now should only need to
implement the Huffman decoding tables.
2) Use JLayer, or an equivalent Java library, to handle the
decoding. I'm not entirely clear on what the license ramifications
are here.
3) Connect to the libmedia library/MediaPlayerService. This is what
SoundPool does, and the amount of use of that service make me believe
that while it's officially unstable, that implementation isn't going
anywhere. This means writing JNI code to connect to the service, but
I'm finding that that's a deep rabbit hole. At the surface, I'm
having trouble with the sp<> template.
I did that with libmad and the NDK. JLayer is way to slow and the media framework is a moving target. You can find info and source code at http://apistudios.com/hosted/marzec/badlogic/wordpress/?p=231
I have not tried it, but mp3transform is LGPL.

Categories

Resources