Is it possible to compress video on Android?

41,034

Solution 1

I used ffmpeg4android,

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

Solution 2

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

Share:
41,034

Related videos on Youtube

Jay Thakkar
Author by

Jay Thakkar

I am a Android Developer

Updated on July 09, 2022

Comments

  • Jay Thakkar
    Jay Thakkar almost 2 years

    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.

    • Kazekage Gaara
      Kazekage Gaara almost 12 years
      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 to get you started. And here's an answer that might help your cause.
    • Wim L.
      Wim L. over 9 years
      The library given in this answer stackoverflow.com/a/23815402/4153725 is free.
  • Noman
    Noman about 10 years
    How to use it in code ??
  • Eli
    Eli about 10 years
  • Rakki s
    Rakki s over 9 years
    I like to use the ffmpeg4android , Do i need to register or pay something for that . What are the license details?.
  • Narendra Singh
    Narendra Singh almost 7 years
    @Eli it is very very slow :(
  • Neo
    Neo almost 7 years
    I have implemented it. Its not working mostly all device above android M. is there any solution for it?
  • Narendra Singh
    Narendra Singh almost 7 years
    Is NDK necessary for that? As I have seen sdk examples too.
  • Eli
    Eli almost 7 years
    @MrNarendra Hi, It depends on a lot of factors (you can read the performance guide in the blog). If you still have problems, please email me, and I will try to assis you.
  • Macdroid Solution
    Macdroid Solution almost 7 years
    Yes it's necessary because ffmpeg library build in C++ Code and c++ Code need their own compiler (Ndk) :)
  • Dallas187
    Dallas187 almost 6 years
    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 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."