cropsly / ffmpeg-android-java

Android java library for FFmpeg binary compiled using https://github.com/writingminds/ffmpeg-android
http://writingminds.github.io/ffmpeg-android-java
GNU General Public License v3.0
3.33k stars 828 forks source link

Very long processing time . . . 10 times longer than the other lib. #161

Open sench93 opened 7 years ago

sench93 commented 7 years ago

I have one command to create video from images and attach mp3 . 209 images, 25 fps. Total 9 sec video. The library takes 50 seconds to create the video on HTC One M7.

http://androidwarzone.blogspot.am/2011/12/ffmpeg4android.html

The library in the link mentioned above is also using ffmpeg and processing time is only 5-6 seconds. Somehow they put 400 $ licence on their library.

I want to know what's the problem with your library, because in core you are using same ffmpeg commands. Is there anything that i did wrong ?

I am using your sample app. My command is

-start_number 1 -y -r 25 -i /storage/emulated/0/Tickle/temp/files/sht%d.jpg -i /storage/emulated/0/Tickle/files/mp3/weightlifting_audio.mp3 -strict experimental -ar 44100 -ac 2 -ab 256k -b 2097152 -ar 22050 -vcodec mpeg4 -b 2097152 -s 640x385 /storage/emulated/0/Tickle/files/mp4/weightlifting.mp4"

Image sizes are 640x385 jpegs. Video output size is about 2 megabytes. Frame quantity is 209. Fps is 25.

Is there anything that i am doing wrong or it's because of your library ?

stefanodefaria commented 7 years ago

I'm also having peformance issues with this lib.

ruha9005 commented 7 years ago

@sench93 Have you tried to add -preset ultrafast? In an article that you provided, there is a section "Performance Tuning", which are some details on which we can assume that maybe used some other global presets. It may be wrong, but it can be useful.

sench93 commented 7 years ago

@ruha9005 -preset ultrafast is for h264 encoding. I am using the most simple`mpeg4.

sench93 commented 7 years ago

While creating the video, program is using only 3.4 % of CPU . . . -threads X is not helping. Result is the same. What's the point of using only 3.4 percent of CPU during video creation and encoding ? Does anybody knows how make the library to use more CPU power and reach faster results ?

stefanodefaria commented 7 years ago

I've got something similar: using x264 with preset ultrafast, it gets only 20% CPU usage and 45 threads.

maxglu commented 7 years ago

This is great library, but I have same isuue with low performance and -threads X or -preset ultrafast parameters not working. In log on Android studio i dont see any usages of cpu or gpu. How i can increase cpu using?

sench93 commented 7 years ago

Everyone here has that issue . . . but it looks like developers of library don't care :)

matteinn commented 7 years ago

+1

douglasfeitosa commented 7 years ago

+1

palmithor commented 7 years ago

+1

olafurr commented 7 years ago

+1

ruha9005 commented 7 years ago

+1

fxhereng commented 7 years ago

+1

jossydeleon commented 7 years ago

+1

jossydeleon commented 7 years ago

Converting a .M4A music file of 4 minutes to mp3 is taking 3 minutes and the cellphone gets hot

AhhhhDong commented 7 years ago

This lib is just a simple , the author has other two lib but not free , lol.

Aditya94A commented 7 years ago

+100

Joining two mp3s...

-i A.mp3 -i B.mp3 -filter_complex concat=n=2:v=0:a=1 C.mp3

takes all of 5 seconds on my computer, but with this library it takes more time than the length of the files I'm combining in the first place. Same with all the other commands, converting formats, cropping videos/audio etc. @zoedevelopers Yes! I too noticed my phone getting hot.

Is there any alternative for this library? All the resources I've looked at are outdated or long defunct. Has someone used the link mentioned in the first comment? Is it any better? (It seems a bit shady at first sight..)

@wjd19941224 what other libs? Can you please share the link?

@hiteshsondhi88 any thoughts?

RafagSL commented 7 years ago

+1

daufinsyd commented 7 years ago

+1

erleizh commented 6 years ago

+1

mwshubham commented 6 years ago

Any community updates or comments ? @sench93

Aditya94A commented 6 years ago

Yes @mwshubham. Use bravobit/FFmpeg-Android. It's a lot better and up-to-date, there are some slight API changes but they're all for the better.

As for the performance, it still sucks everywhere.