Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trim video in android (without ffmpeg)?

Hi I am trying to trim video in android, but all of the source codes I have found are using ffmpeg, is there a smaller library, which I can use ? Because ffmpeg library is about 8-9 MB, and my application is about 6 MB, adding ffmpeg library to my app will make it more than double size.

like image 707
Ivan Kolev Avatar asked Oct 20 '22 06:10

Ivan Kolev


1 Answers

You can do this with mp4parser library. Have a look at the ShortenExample it does exactly what the name suggests. Since the library cannot re-encode the video it can only cut the video at I-frames. So the points in time where you can make a cut are quite coarse.

On Android 4.1 you can access the hardware codecs via MediaCodec API which could be an option (but I haven't seen any example of that yet)

Or, you can use this class: TrimVideoUtils.java

like image 127
Danila Grigorenko Avatar answered Nov 01 '22 15:11

Danila Grigorenko