FFMPEG
FFMPEG
Fast Forward Mpeg
Morris Lin
2019FFMPEG
Fast Forward Mpeg
What is FFMPEG
FFMPEG is a free and open-source project consisting of a vast software suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the FFMPEG program itself, designed for command-line-based processing of video and audio files, and widely used for format transcoding, basic editing (trimming and concatenation), video scaling, video post-production effects, and standards compliance (SMPTE, ITU).
History
The project was started by Fabrice Bellard (using the pseudonym "Gérard Lantau") in 2000, and was led by Michael Niedermayer from 2004 until 2015. Some FFMPEG developers were also part of the MPlayer project.
On January 10, 2014, two Google employees announced that over 1000 bugs had been fixed in FFMPEG during the previous two years by means of fuzz testing.
In January 2018, the ffserver command-line program – a long-time component of FFMPEG – was removed. The developers had previously deprecated the program citing high maintenance efforts due to its use of internal application programming interfaces (API).
The project publishes a new release every three months on average. While release versions are available from the website for download, FFMPEG developers recommend that users compile the software from source using the latest build from their source code Git version control system.
Common commands
-i : input file name
-f : output format
-s : resolution of the video (width x height)
-y : overwrite the file if the output file already exists
-b : bitrate
-vcodec : video encoding format
-r : fps
-acodec : audio encoding format
-ab : audio bitrate
-ac : number of channels of audio
-ar : audio rate. default is 44100
-fs : end conversion when the specified file size is exceeded
-title : set title
-timestamp : set timestamp
-t : specify the duration of the output file. (unit sec)
-ss : start converting from the specified time. (unit sec)
Note: If need other commands or functions, you can refer official document,
https://www.ffmpeg.org/documentation.html
How to use FFMPEG in Android (Kotlin)
- Install NDK
- Install FFMPEG by gradle
- Import FFmpeg in class
And then you can use it like this:
val outputLocation = Utils.getConvertedFile(current_OutputDirPath, current_OutputFileName)
val cmd = arrayOf<String>("-i", current_InputVideo!!.path, "-ss", current_StartTime.toString() , "-t", current_EndTime.toString(), "-c", "copy", outputLocation.path)
FFmpeg.getInstance(context).execute(cmd, object : ExecuteBinaryResponseHandler() {
}
This is an example for cutting video. Now You can see that you can edit video by using command I wrote above.
Now let’s demo how to cut video
Get permission and then execute command