ffmpeg-android-java icon indicating copy to clipboard operation
ffmpeg-android-java copied to clipboard

How to speed up the video compression?

Open ananth10 opened this issue 7 years ago • 8 comments

Hi ,

I am using following command to compress video in android . but it takes more time. e.g for 1 min video it takes 50sec to compress.

-y -i "+mInputPath+" -vf -s 640x480 -threads 5 -preset ultrafast -strict -2 "+mOutputPath.getAbsolutePath();

Does anyone know how to increase speed?

ananth10 avatar Feb 27 '17 11:02 ananth10

I'd love to know this too. I think though for the line you pasted doing -threads 5 might make it slower since -threads is default auto. If it can actually use more threads, you would be limiting it.

http://ffmpeg.org/ffmpeg-all.html

romedtino avatar Mar 07 '17 22:03 romedtino

@romedtino .. Thank you for the information.

ananth10 avatar Mar 08 '17 04:03 ananth10

Still cannot solve this .. can anyone help me out?

ananth10 avatar Mar 18 '17 09:03 ananth10

If you can use libx264, use this command. -y -i "+mInputPath+" -c:v libx264 -preset ultrafast -tune fastdecode -vf -s 640x480 -threads 5 -strict -2 "+mOutputPath.getAbsolutePath();

-preset ultrafast maybe will not work without libx264. libx264 has the preset ultrafast. To using libx264, you must build libx264 and rebuild ffmpeg.(as --enable-libx264)

In my case, when using x264 ultrafast, performance was about 3-4 times faster in reverse filter.

novawoo-kr avatar Sep 24 '17 15:09 novawoo-kr

@novawoo-kr I'm facing with same problem. Can you help me to rebuild ffmpeg? Do you have any tutorials ?

vfa-tuantt avatar Oct 13 '17 01:10 vfa-tuantt

i am facing the same problem: video compression taking so much time to compress video, i am using this command - String cmd1[] = new String[]{"-y", "-i", sourcePath, "-strict", "experimental", "-r", "25", "-vcodec", "mpeg4", "-c:v", "libx264", "-preset", "ultrafast", "-b", "2097152", "-ab", "48000", "-ac", "2", "-ar", "48000", destinationPath}; how could i speed up this?

arpitjoshi08 avatar Dec 22 '17 10:12 arpitjoshi08

minSdkVersion 19 targetSdkVersion 28

What should be the configuration for the Pie version

Mayank1904 avatar Oct 11 '19 10:10 Mayank1904

Any Luck Anyone I am Facing similar issue

Mr-Ramzan avatar Aug 31 '20 11:08 Mr-Ramzan