which process to use for encoding and editing videos in android - 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).

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.

How do you get amplitude of audio file in Android before you play it?

I know we can easily do it when we record it (several ways, actually). But how are we going about getting an amplitude graph from an mp3/ogg file?
As it is now, I see two options:
1. Quickly play it & construct it while its playing
2. Try to do it with ffmpeg (but I really don't want to do NDK)
Are there any other options beside these? Thank you
You can try to use my library Amplituda which calculate amplitudes from audio and provide it in different formats like json, list of integers and sequences.
If you want to draw a waveform from amplitudes data, you can directly use my WaveformSeekBar library fork in which Amplituda implemented.

Embedding Metadata to H.264 encoded file

I am currently developing an application which produces certain metadata with respect to preview frames coming from the camera. I can see this metadata being produced properly and I have no problems here.
However, I have to embed this metadata to these frames of interest (frames are processed by a native algorithm to produce this metadata). I am using ffmpeg with x264 to encode the frames into H.264. I have checked x264.h and some documentations but failed to find what I seek.
My question is; is there any unused portion of H.264 syntax that I can embed my metadata to encoded frames?
I hope I was clear enough. Thanks in advance.
Most video elementary streams have a provision for "user data". In h.264 this is part of the SEI nal unit. You can add one before every frame you want to associate it with. I don't think that x264 has support to add user data from outside.
Two choices:
Modify x264 / ffmpeg to add the SEI message where ever you want it taking input in some form you like.
Create your stream, create your metadata. Now write a small program separately to read your metadata and parse the files and push a SEI NAL before the frame you want.
For SEI syntax you should be able to google and get it. The best place to look though is the H.264 standard. A easier way is to just look at the code in x264. It does insert one user data at the begining (the encoding parameters).

creating Video from Android screen activities

In my app I have a requirement to create a video from the screen activities programatically. (ie: I am running some animations for some time I need to convert these animations to a video, like video demos.)
I have been searching for this for the last week, but I haven't found any solution. I don't know whether it is possible in Android or not. If it is, please tell me the way or suggest me some links.
If you want to capture the screenshots from "within your activity", it is possible. Follow this post
Having grabbed the screenshoton a bitmap, you need to encode the frames to a video yourself.
Captured bitmap --> JNI (Native-bitmap) --> feed input buffer to a native encoder (ffmpeg) --> save to file
This project will meet your request Android-MJPEG-Video-Capture-FFMPEG
It is just to convert jpegs into a movie file by ffmpeg bin

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

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.

Categories

Resources