I want to upload video files to server and compress before uploading. I'm using ffmpeg libx264. I have seen viber can upload 30 second video file of size 32MB within a minute [reduce it's down to 2.3MB]. I want to know how do they do it so fast?

What I have tried so far -

FFMPEG version :  n2.4.2 
Built with gcc 4.8

Build Configuraiton : --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/armeabi-v7a-neon --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -mfpu=neon' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=


ffmpeg -y -i /storage/emulated/0/main.mp4 -s 480x320 -r 20 -c:v libx264 -preset ultrafast -c:a copy -me_method zero -tune fastdecode -tune zerolatency -strict -2 -b:v 1000k -pix_fmt yuv420p /storage/emulated/0/output.mp4

The result so far is, a 30second 78MB file gets compressed to 4.3MB which takes around 1min 28seconds. Here is the console dump - http://pastebin.com/rn81acGx . I mainly want to reduce the time it takes to compress. How can I achieve this?

Thanks in advance.

  • You need to show the complete console output from your command. Also, 0.11.1 is ancient and unsupported. – LordNeckbeard Oct 29 '15 at 19:42

Use SiliCompressor, a library on android that gives you the possibility to easily compress while maintaining the quality of your video and images.

  • Its not working for me. I got this issue when using SiliCompressor. – Narendra Singh Jul 10 '17 at 18:49
  • This library has too many bugs. Like 1. The actual video size is 10 and after compress video size is 14MB or 15MB. 2. At video compress time take too much time. – Ali Jul 26 '20 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.