23

I want to do video compression.

Actually in my application I want to have two options, one is low and another is high. If I choose the low option then the application will compress the video and then upload it. If I choose high then it will upload the original video which I have recorded itself.

I want to do this thing in my application and I'm confused. I have searched google a lot but I'm not able to find the useful way to solve this question please if anyone can help me out.

Jay Thakkar
  • 743
  • 1
  • 5
  • 24
  • 3
    To compress a video, you will need to re-encode it to a lower bit-rate or maybe a lower resolution. You can search the Google to find many libraries available to encode videos in Java. I would suggest you to try ffmpeg. Here's a [link](http://fmj-sf.net/ffmpeg-java/getting_started.php) to get you started. And here's an [answer](http://stackoverflow.com/questions/8515967/encode-video-using-ffmpeg-from-javacv-on-android-causes-native-code-crash) that might help your cause. – Kazekage Gaara Jun 12 '12 at 07:29
  • I M still not getting the solution.... – Jay Thakkar Jun 18 '12 at 08:34
  • Did you try the codes on the link's that I have provided? If you want someone to provide you with code that you can copy paste,then please don't expect that. – Kazekage Gaara Jun 18 '12 at 08:36
  • you provided me the good help i m not telling that i want to code to copy paste i m not at all expecting that thing i m still working on this stuff i will get back to you thanks – Jay Thakkar Jun 18 '12 at 08:42
  • Hello i just want to ask you that do i need only one ffmpeg-java Jar ?? – Jay Thakkar Jun 18 '12 at 11:28
  • Probably yes, that would do. – Kazekage Gaara Jun 18 '12 at 11:39
  • 1
    The library given in this answer http://stackoverflow.com/a/23815402/4153725 is free. – Wim L. Oct 17 '14 at 13:26

2 Answers2

13

I used ffmpeg4android,

And was able to achieve this in about 10min using only java, Note that its a commercial library.

Eli
  • 707
  • 8
  • 16
3

Yes in android you can us ffmpeg4android for compress video it's native library

Please check this link

ffmpeg4android Code

Install the Android NDK First to Use it

  • Is NDK necessary for that? As I have seen sdk examples too. – Narendra Singh Jul 11 '17 at 09:37
  • Yes it's necessary because ffmpeg library build in C++ Code and c++ Code need their own compiler (Ndk) :) – Macdroid Solution Jul 13 '17 at 06:27
  • I realize this is an old post, but in case it helps anyone else who reads this comment, FFmpeg4Android can run FFmpeg commands in Java without the need for C code, or installing the NDK. See this [link](http://androidwarzone.blogspot.com/2011/12/ffmpeg4android.html) for more info. At time of this comment, the page clearly states: "FFmpeg4Android is a way your application can run FFmpeg commands, only Java, no need for C code, or NDK." – Dallas187 Jun 19 '18 at 23:20