I need to trim the video in my android apps like Instagram or Whatsapp. I searched a lot but did not find much stuff. Is there any library for this like aviary SDK for video trimming? At the time of trimming in Instagram or Whatsapp video is split or cut into multiple frames like given screenshot and after that user select specific frames from it for trimming video between these frames or specific time.
FFmpeg can be used to extract frames from video and cut video.
For integrating FFmpeg in android we can use precompiled libraries like ffmpeg-android.
For extracting image frames from video use below command-
String[] complexCommand = {"-y", "-i", inputFileAbsolutePath, "-an", "-r", "1/2", "-ss", "" + startMs / 1000, "-t", "" + (endMs - startMs) / 1000, outputFileAbsolutePath()};
For cutting video use below command-
String[] complexCommand = {"-ss", "" + startMs / 1000, "-y", "-i", inputFileAbsolutePath, "-t", "" + (endMs - startMs) / 1000, "-s", "320x240", "-r", "15", "-vcodec", "mpeg4", "-b:v", "2097152", "-b:a", "48000", "-ac", "2", "-ar", "22050", outputFileAbsolutePath};
You can use RangeSeekBar to allow user to select the time range for cutting video from original video. For complete tutorial check out below post on my blog-
https://androidlearnersite.wordpress.com/2017/03/17/ffmpeg-video-editor/
Use this Library for video trimming like whats app and insta. see this library
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With