Tente usar o recorte antes da escala. Obviamente, você também precisa modificar os parâmetros de escala e corte.
Eu tenho 5 segundos de vídeo .mp4 de 1280x720 e quero escalar, cortar e girar:
ffmpeg -i input.mp4 -filter_complex scale=1138:640, crop=640:640:249:0, transpose=1 -threads 3 -preset ultrafast -strict -2 -y output.mp4
E leva cerca de 13 segundos para realizar essas operações em um vídeo de 5 segundos usando meu telefone. Existe alguma maneira de acelerar? Perder a qualidade é aceitável se for o único caminho.
Aqui está a saída:
ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Sep 6 2015 00:45:52 with gcc 4.8 (GCC)
configuration: --target-os=linux --cross-prefix=/home/mike/Downloads/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/mike/Downloads/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/mike/Downloads/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/mike/Downloads/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/mike/Downloads/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/mike/Downloads/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/original0.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-09-13 19:12:47
Duration: 00:00:05.36, start: 0.000000, bitrate: 67205 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1280x720, 65036 kb/s, SAR 65536:65536 DAR 16:9, 29.91 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2015-09-13 19:12:47
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s (default)
Metadata:
creation_time : 2015-09-13 19:12:47
handler_name : SoundHandle
[libx264 @ 0xb5829c00] using SAR=1462/1463
[libx264 @ 0xb5829c00] using cpu capabilities: none!
[libx264 @ 0xb5829c00] profile Constrained Baseline, level 3.1
[libx264 @ 0xb5829c00] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to '/storage/emulated/0/processed0.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf56.4.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x640 [SAR 10233:10240 DAR 10233:10240], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
encoder : Lavc56.1.100 libx264
Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2015-09-13 19:12:47
handler_name : SoundHandle
encoder : Lavc56.1.100 aac
Stream mapping:
Stream #0:0 (h264) -> scale (graph 0)
transpose (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 4 fps=0.0 q=0.0 size= 0kB time=00:00:01.00 bitrate= 0.4kbits/s dup=1 drop=0
frame= 14 fps= 13 q=26.0 size= 124kB time=00:00:01.00 bitrate=1015.6kbits/s dup=1 drop=0
frame= 25 fps= 16 q=26.0 size= 257kB time=00:00:01.00 bitrate=2098.3kbits/s dup=1 drop=0
frame= 30 fps= 14 q=26.0 size= 319kB time=00:00:01.53 bitrate=1699.2kbits/s dup=1 drop=0
frame= 34 fps= 13 q=26.0 size= 371kB time=00:00:02.00 bitrate=1514.9kbits/s dup=1 drop=0
frame= 44 fps= 14 q=26.0 size= 495kB time=00:00:02.00 bitrate=2021.5kbits/s dup=1 drop=0
frame= 55 fps= 15 q=26.0 size= 635kB time=00:00:02.00 bitrate=2594.8kbits/s dup=1 drop=0
frame= 61 fps= 15 q=26.0 size= 711kB time=00:00:02.32 bitrate=2505.9kbits/s dup=1 drop=0
frame= 64 fps= 13 q=26.0 size= 747kB time=00:00:03.00 bitrate=2033.9kbits/s dup=1 drop=0
frame= 74 fps= 14 q=26.0 size= 867kB time=00:00:03.00 bitrate=2360.7kbits/s dup=1 drop=0
frame= 83 fps= 14 q=26.0 size= 979kB time=00:00:03.00 bitrate=2667.1kbits/s dup=1 drop=0
frame= 92 fps= 14 q=26.0 size= 1091kB time=00:00:03.02 bitrate=2951.2kbits/s dup=1 drop=0
frame= 94 fps= 14 q=26.0 size= 1116kB time=00:00:04.01 bitrate=2280.0kbits/s dup=1 drop=0
frame= 104 fps= 14 q=26.0 size= 1240kB time=00:00:04.01 bitrate=2533.4kbits/s dup=1 drop=0
frame= 114 fps= 14 q=26.0 size= 1363kB time=00:00:04.01 bitrate=2784.3kbits/s dup=1 drop=0
frame= 123 fps= 14 q=26.0 size= 1465kB time=00:00:04.03 bitrate=2976.5kbits/s dup=1 drop=0
frame= 125 fps= 14 q=26.0 size= 1490kB time=00:00:05.01 bitrate=2435.0kbits/s dup=1 drop=0
frame= 134 fps= 14 q=26.0 size= 1605kB time=00:00:05.01 bitrate=2623.0kbits/s dup=1 drop=0
frame= 143 fps= 14 q=26.0 size= 1715kB time=00:00:05.01 bitrate=2802.8kbits/s dup=1 drop=0
frame= 151 fps= 14 q=26.0 size= 1815kB time=00:00:05.01 bitrate=2965.8kbits/s dup=1 drop=0
frame= 158 fps= 14 q=26.0 size= 1903kB time=00:00:05.31 bitrate=2934.4kbits/s dup=1 drop=0
frame= 160 fps= 14 q=-1.0 Lsize= 1984kB time=00:00:05.35 bitrate=3035.2kbits/s dup=1 drop=0
video:1898kB audio:80kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.292008%
[libx264 @ 0xb5829c00] frame I:1 Avg QP:20.00 size: 16321
[libx264 @ 0xb5829c00] frame P:159 Avg QP:25.93 size: 12118
[libx264 @ 0xb5829c00] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0xb5829c00] mb P I16..4: 58.6% 0.0% 0.0% P16..4: 33.8% 0.0% 0.0% 0.0% 0.0% skip: 7.6%
[libx264 @ 0xb5829c00] coded y,uvDC,uvAC intra: 72.9% 10.6% 0.0% inter: 43.7% 15.5% 0.0%
[libx264 @ 0xb5829c00] i16 v,h,dc,p: 21% 12% 55% 12%
[libx264 @ 0xb5829c00] i8c dc,h,v,p: 52% 17% 22% 9%
[libx264 @ 0xb5829c00] kb/s:2914.67