Fast Video Compression on Android

后端 未结 2 1346
广开言路
广开言路 2020-11-27 22:56

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 78MB within a minu

2条回答
  •  一整个雨季
    2020-11-27 23:05

    x264 cpu capabilities

    Your ffmpeg console output/log shows the following message from libx264:

    using cpu capabilities: none!
    

    For your device I would expect something like:

    using cpu capabilities: ARMv7 NEON
    

    You should re-evaluate how you compiled x264 so it properly supports the capabilities of your CPU. With none it encodes significantly slower.

    • Do not use the --disable-asm configure option for x264.
    • After you run ./configure for x264 the console output should show asm: yes.
    • Use a recent x264. I see many users compiling old versions that may miss out on optimizations.
    • Then recompile ffmpeg so it uses the new x264. Make sure ffmpeg does not link to the wrong x264 if you have multiple versions.

    MediaCodec hardware acceleration

    ffmpeg currently supports hardware assisted H.264 and HEVC decoding via the MediaCodec API in Android which may help decrease the overall processing time. For more info and an up-to-date list of capabilities see FFmpeg Wiki: Hardware Acceleration.

    To use it ensure your ffmpeg is compiled with --enable-jni and --enable-mediacodec.

提交回复
热议问题