Compression in Android taking long time

2019-07-27 23:45发布

I am new to Video related operations. I am using [FFMPEG][1] to compress a video in my Android application.

I am trying to compress a video of 50MB to 10MB by executing following command

ffmpeg -y -i /videos/in.mp4 -strict experimental -s 640x480 -r 25 -vcodec mpeg4 -b 150k -ab 48000 -ac 2 -ar 22050 /videos/out.mp4

Video compressing successfully, but it taking more than 150 seconds. I am unable find out how to reduce that time.

I want to change this command to complete this process in less time.

1条回答
Luminary・发光体
2楼-- · 2019-07-28 00:34

You can't do much here,few things you can try :

  1. you can set the -preset value to fast/veryfast/ultrafast you can set the -crf value (usually 18 to 28).
  2. If you do not want to alter your audio/video codecs, you should retain the original settings using: -c copy (this can drastically improve the execution time, depending upon your use-case)

Also read this :https://github.com/WritingMinds/ffmpeg-android-java/issues/54

3.possibly use x264 "ultrafast" options (you can set the -preset value to fast/veryfast/ultrafast), or if you want mp4 video codec, maybe decrease the resolution or some option it allows

查看更多
登录 后发表回答