Skip to content
codingtube

codingtube

Coding and Programming tutorials

  • javascript
  • React
  • ES6
  • React js
  • coding
  • ffmpeg
  • java
  • programming
  • information
  • coding
  • Privacy Policy
  • Twitter trends
  • Age Calculatore
  • Codingtube Community
  • YouTube Tags Generator
  • About
  • Toggle search form

How to make Android Video Editing App using FFmpeg

Posted on December 5, 2021December 5, 2021 By christo No Comments on How to make Android Video Editing App using FFmpeg

If you’re looking to make Android video editing App then just implement this and make Android video editing App using FFmpeg

This video processing framework based on FFmpeg developed on Android is simple, easy to use, and small in size, helping users quickly realize video processing functions. Contains the following functions: editing, cropping, rotating, mirroring, merging, separating, variable speed, adding LOGO, adding filters, adding background music, accelerating and decelerating video, rewinding audio and video.

V1.0.0 version update instructions
  1. Update FFmpeg to version 4.2.2, compile with ndk-r21, use clang tool;
  2. Added x86_64 support;
  3. Removed the function of adding text (due to some problems of dependent library compilation, this method is temporarily unavailable, and will be added back later, if you need this function, please use v0.9.5 version);
  4. Add MediaCodec support.

How to use:

  • Add in build.gradle:
allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }
  • Add gradle dependency:
compile 'com.github.yangjie10930:EpMedia:v1.0.1'

Single video processing:

  • create pending video:
EpVideo epVideo = new EpVideo(url);
  • clip
//The first parameter is the start time of the clip, the second parameter is the duration, in seconds
epVideo.clip(1,2);//From the first second, edit for two seconds
  • crop
//The parameters are the crop width, height, starting position X, starting position Y
epVideo.crop(480,360,0,0);
  • rotate and mirror
//The first parameter is the rotation angle, the second parameter is whether to mirror, only supports 90,180,270 degree rotation
epVideo.rotation(90,true);
  • add logo
// Add picture class
// The parameter is the image path, X, Y, the width and height of the image, whether it is a moving image (only png, jpg, gif images are supported, if it is a gif image, the last parameter is true)
EpDraw epDraw = new EpDraw(filePath,10,10,50,50,false);
epVideo.addDraw(epDraw);

or

epVideo.addDraw(new EpDraw(filePath,10,10,50,50,false,3,5));//The last two parameters are the displayed start time and duration
  • Add custom filter
// Custom filters, all filters supported by ffmpeg command are supported
// For detailed results, please refer to: http://blog.csdn.net/u012027644/article/details/77833484
// For details, please refer to ffmpeg official website:http://www.ffmpeg.org/ffmpeg-filters.html
//Examples: String filter = "lutyuv=y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val";
epVideo.addFilter(filter);
  • Processing a single video
EpVideo epVideo = new EpVideo(url);
//Output options, the parameter is the output file path (currently only supports mp4 format output)
EpEditor.OutputOption outputOption = new EpEditor.OutputOption(outFile);
outputOption.width = 480;//The width and height of the output video, if not set, the original video width and height
outputOption.height = 360;//Output video height
outputOption.frameRate = 30;//frame rate, default 30
outputOption.bitRate = 10;//bit rate, default 10
EpEditor.exec(epVideo, outputOption, new OnEditorListener());
  • Add background music
//The parameters are video path, audio path, output path, original video volume (1 is 100%, 0.7 is 70%, and so on), add audio volume
EpEditor.music(videoPath, audioPath, outfilePath, 1, 0.7, new OnEditorListener());
  • Separate audio and video
//The parameters are the video path, output path, and output type
EpEditor.demuxer(videoPath, outfilePath,EpEditor.Format.MP3, new OnEditorListener());
  • Change video playback speed
//The parameters are video path, output path, variable speed ratio (only supports 0.25-4 times), variable speed type (VIDEO-video (if VIDEO is selected, audio will be shielded), AUDIO-audio, ALL-video audio and variable speed)
EpEditor.changePTS(videoPath, outfilePath, 2.0f, EpEditor.PTS.ALL, new OnEditorListener());
  • Rewind video
//The parameters are video path, output path, whether the video is reversed, and whether the audio is reversed (if both are true, the audio and video are reversed, if the video ture audio is false, the output is reversed without audio video, video false audio ture If it is, input the audio of the reverse playback, and the audio reverse playback also uses this configuration)
EpEditor.reverse(videoPath, outfilePath, true, true, new OnEditorListener());
  • Video to image
//The parameters are the video path, the output path (the path is in the form of a collection, such as pic% 03d.jpg, supports both jpg and png image formats), the width of the output picture, the height of the output picture, and the number of output pictures per second (if 2 It ’s 2 frames per second, if 0.5f, it ’s one frame every two seconds.)
EpEditor.video2pic(videoPath, outfilePath, 720, 1080, 2, new OnEditorListener());
  • Image to video
//The parameters are picture collection path, output path, output video width, output video height, output video frame rate
EpEditor.pic2video(picPath, outfilePath, 480, 320, 30, new OnEditorListener());

Multiple video processing & merging

  • Merge video (support other processing operations on the video to be merged)
ArrayList<EpVideo> epVideos = new ArrayList<>();
epVideos.add(new EpVideo(url));//Video 1
epVideos.add(new EpVideo(url2));//Video 2
epVideos.add(new EpVideo(url3));//Video 3
//Output options, the parameter is the output file path (currently only supports mp4 format output)
EpEditor.OutputOption outputOption = new EpEditor.OutputOption(outFile);
outputOption.width = 480;//Output video width, default 480
outputOption.height = 360;//Output video height, default 360
outputOption.frameRate = 30;//Output video frame rate, default 30
outputOption.bitRate = 10;//Output video bit rate, default 10
EpEditor.merge(epVideos, outputOption, new OnEditorListener());
  • Lossless merged video (strict on the video format, requiring the same resolution, frame rate, and bit rate. It does not support other processing operations on the video to be merged. The method of merging is very fast. Another: two pieces of audio in the same format are also spliced. (This method can be used)
ArrayList<EpVideo> epVideos = new ArrayList<>();
epVideos.add(new EpVideo(url));//Video 1
epVideos.add(new EpVideo(url2));//Video 2
epVideos.add(new EpVideo(url3));//Video 3
EpEditor.mergeByLc(epVideos, new EpEditor.OutputOption(outFile), new OnEditorListener());

Custom commands

  • Enter the ffmpeg command (you don’t need to input ffmpeg at the beginning, for example “-i input.mp4 -ss 0 -t 5 output.mp4”, the second parameter is the video length, the unit is microseconds, you can fill in 0)
EpEditor.execCmd("", 0, new OnEditorListener() {
    @Override
    public void onSuccess() {

    }

    @Override
    public void onFailure() {

    }

    @Override
    public void onProgress(float progress) {

    }
});

android Tags:FFmpeg

Post navigation

Previous Post: React native video processing
Next Post: Make Android Video editing App using Phoenix SDK

Related Posts

What is Android Manifest File android
How to Parse a Json Using Volley in Android using simple GET request android
Overriding the Application Lifecycle Events in Android android
Search Functionality for RecyclerView in Android android
Android full source code to create Press Back Again to Exit using java android
How to Send an Email via Intent in Android android

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • Affiliate Marketing Principles
  • The Basics You Need to Know About Affiliate Marketing
  • Affiliate Marketing Options
  • All About Affiliate Marketing
  • Classification of Database Management Systems
  • Three-Tier and n-Tier Architectures
    for Web Applications
  • Two-Tier Client/Server Architectures for DBMSs
  • Basic Client/Server Architectures in DBMS
  • Centralized DBMSs Architecture in DBMS
  • Tools, Application Environments, and Communications Facilities in DBMS

Categories

  • Affiliate marketing (5)
  • Algorithm (43)
  • amp (3)
  • android (223)
  • Android App (8)
  • Android app review (4)
  • android tutorial (60)
  • Artificial intelligence (61)
  • AWS (3)
  • bitcoin (8)
  • blockchain (1)
  • c (5)
  • c language (105)
  • cloud computing (4)
  • coding (4)
  • coding app (4)
  • complex number (1)
  • Computer Graphics (66)
  • data compression (65)
  • data structure (188)
  • DBMS (44)
  • digital marketing (9)
  • distributed systems (11)
  • ffmpeg (26)
  • game (3)
  • html (6)
  • image processing (35)
  • Inequalities (1)
  • information (4)
  • java (212)
  • java network (1)
  • javascript (9)
  • kotlin (4)
  • leetcode (1)
  • math (21)
  • maven (1)
  • mysql (1)
  • Node.js (8)
  • operating system (109)
  • php (310)
  • Principle Of Mathematical Induction (1)
  • programming (6)
  • Python (4)
  • Python data structure (9)
  • React native (1)
  • React.js (22)
  • Redux (1)
  • seo (4)
  • set (12)
  • trigonometry (6)
  • vue.js (35)
  • XML (3)

sitemap

sitemap of videos

sitemap of webstories

sitemap of website

  • Affiliate marketing
  • Algorithm
  • amp
  • android
  • Android App
  • Android app review
  • android tutorial
  • Artificial intelligence
  • AWS
  • bitcoin
  • blockchain
  • c
  • c language
  • cloud computing
  • coding
  • coding app
  • complex number
  • Computer Graphics
  • data compression
  • data structure
  • DBMS
  • digital marketing
  • distributed systems
  • ffmpeg
  • game
  • html
  • image processing
  • Inequalities
  • information
  • java
  • java network
  • javascript
  • kotlin
  • leetcode
  • math
  • maven
  • mysql
  • Node.js
  • operating system
  • php
  • Principle Of Mathematical Induction
  • programming
  • Python
  • Python data structure
  • React native
  • React.js
  • Redux
  • seo
  • set
  • trigonometry
  • vue.js
  • XML
  • Blog
  • Data compression tutorial - codingpoint
  • How to change mbstring in php 5.6
  • How to diagnose out of memory killed PHP-FPM
  • Introduction to jQuery
  • Privacy
  • Affiliate marketing
  • Algorithm
  • amp
  • android
  • Android App
  • Android app review
  • android tutorial
  • Artificial intelligence
  • AWS
  • bitcoin
  • blockchain
  • c
  • c language
  • cloud computing
  • coding
  • coding app
  • complex number
  • Computer Graphics
  • data compression
  • data structure
  • DBMS
  • digital marketing
  • distributed systems
  • ffmpeg
  • game
  • html
  • image processing
  • Inequalities
  • information
  • java
  • java network
  • javascript
  • kotlin
  • leetcode
  • math
  • maven
  • mysql
  • Node.js
  • operating system
  • php
  • Principle Of Mathematical Induction
  • programming
  • Python
  • Python data structure
  • React native
  • React.js
  • Redux
  • seo
  • set
  • trigonometry
  • vue.js
  • XML
  • Blog
  • Data compression tutorial - codingpoint
  • How to change mbstring in php 5.6
  • How to diagnose out of memory killed PHP-FPM
  • Introduction to jQuery
  • Privacy

© codingtube.tech