Video cropping with FFMpeg on Android is very slow -


this question has answer here:

what tried:

i trying implement video cropping on android using ffmpeg (ffmpeg-android).

here command use:

string[] complexcommand = {"-i", inputpath, "-strict", "experimental", "-vf", "crop=1080:1080:0:0", "-threads", "5", "-c:v", "libx264", "-preset", "ultrafast", filepath}; 

the problem:

video cropping working, though using needed options make operation fast, still takes 1min long video same duration crop.

how can achieve better speeds?
need implement video cropping on server instead of device?
there way implement video cropping on android instead of ffmpeg?

i understand can achieve better ux letting user edit cropped textureview/surfaceview while doing actual cropping in background, want avoid way takes more time.

update

here ffmpeg's log output:

success output : ffmpeg version n3.0.1 copyright (c) 2000-2016 ffmpeg developers     built gcc 4.8 (gcc)     configuration: --target-os=linux --cross-prefix=/home/vagrant/sourcecode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/sourcecode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --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/vagrant/sourcecode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/sourcecode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-i/home/vagrant/sourcecode/ffmpeg-android/toolchain-android/include -u_fortify_source -d_fortify_source=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-l/home/vagrant/sourcecode/ffmpeg-android/toolchain-android/lib -wl,-z,relro -wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=     libavutil      55. 17.103 / 55. 17.103     libavcodec     57. 24.102 / 57. 24.102     libavformat    57. 25.100 / 57. 25.100     libavdevice    57.  0.101 / 57.  0.101     libavfilter     6. 31.100 /  6. 31.100     libswscale      4.  0.100 /  4.  0.100     libswresample   2.  0.101 /  2.  0.101     libpostproc    54.  0.100 / 54.  0.100     input #0, mov,mp4,m4a,3gp,3g2,mj2, '/storage/emulated/0/dcim/100andro/mov_0066.mp4':     metadata:     major_brand     : mp42     minor_version   : 0     compatible_brands: isommp42     creation_time   : 2017-04-02 11:58:58     com.android.version: 6.0.1     duration: 00:00:59.60, start: 0.000000, bitrate: 17759 kb/s     stream #0:0(eng): video: h264 (high) (avc1 / 0x31637661), yuv420p, 1920x1080, 17498 kb/s, sar 1:1 dar 16:9, 29.90 fps, 29.92 tbr, 90k tbn, 180k tbc (default)     metadata:     rotate          : 90     creation_time   : 2017-04-02 11:58:58     handler_name    : videohandle     side data:     displaymatrix: rotation of -90.00 degrees     stream #0:1(eng): audio: aac (lc) (mp4a / 0x6134706d), 48000 hz, stereo, fltp, 155 kb/s (default)     metadata:     creation_time   : 2017-04-02 11:58:58     handler_name    : soundhandle     [libx264 @ 0xb5bc4400] using sar=1/1     [libx264 @ 0xb5bc4400] using cpu capabilities: none!     [libx264 @ 0xb5bc4400] profile high 4:4:4 predictive, level 3.2, 4:2:0 8-bit     [libx264 @ 0xb5bc4400] 64 - core 148 - h.264/mpeg-4 avc codec - copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0x1 me=dia subme=1 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=5 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0     output #0, mp4, '/storage/emulated/0/download/compress_video1.mp4':     metadata:     major_brand     : mp42     minor_version   : 0     compatible_brands: isommp42     com.android.version: 6.0.1     encoder         : lavf57.25.100     stream #0:0(eng): video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1080x1080 [sar 1:1 dar 1:1], q=-1--1, 29.92 fps, 11488 tbn, 29.92 tbc (default)     metadata:     handler_name    : videohandle     creation_time   : 2017-04-02 11:58:58     encoder         : lavc57.24.102 libx264     side data:     unknown side data type 10 (24 bytes)     stream #0:1(eng): audio: aac (lc) ([64][0][0][0] / 0x0040), 48000 hz, stereo, fltp, 128 kb/s (default)     metadata:     creation_time   : 2017-04-02 11:58:58     handler_name    : soundhandle     encoder         : lavc57.24.102 aac     stream mapping:     stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))     stream #0:1 -> #0:1 (aac (native) -> aac (native))     press [q] stop, [?]     frame=    6 fps=0.0 q 

any appreciated!

  1. use lesser resolution
  2. use server-size cropping if have got server. remember not have got internet connection.
  3. ffmpeg if rather fast. make concept better.

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -