[FFmpeg-user] filters zoompan and crop

S Andreason sandreas41 at gmail.com
Fri Oct 26 21:57:28 EEST 2018


Hi,
Does zoompan not work outside the range 1 .. 8?
I want to generate an overlay to zoom in, have the input png start 
small, and grow to half the video size, like from 20 to 320 in width. 
Starting the zoompan at z=0.1 does not seem to work.
Also if the first filter was successful, I need to crop it so that it 
grows over time. I am having trouble getting crop to adjust based on the 
frame number. From my testing it seems n in this case starts at 0 when 
the enable between starts, instead of the output video frame number like 
the other filters I have been using.
Is there a manual or wiki with more information then at
https://ffmpeg.org/ffmpeg-filters.html ?
Thank you

$ ffmpeg -loglevel verbose -i 
20181025_SHS_RBP3000-freezerOFF-2filters-zoom.png -i 
20181024_RBP3000-1212_measuring-GS-filters-h640x360e.mp4 -c:v h264 
-filter_complex 
"[0]zoompan=z='if(lte(on,157),0.1,min(zoom+0.033,1))':d=180:fps=30 [0z]; 
[0z]crop=w='if(lte(n,0),32,n/23*320)':h='if(lte(n,0),23,n/23*234)' 
[0zc]; 
[1][0zc]overlay=x='495-((n-156)*175/24)':y='256-((n-156)*126/24)':enable='between(t,5.2,6)'" 
-s 640x360 -c:a copy testzoompan.mp4
ffmpeg version 3.2.12-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers
   built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
   configuration: --prefix=/usr --extra-version='1~deb9u1' 
--toolchain=hardened --libdir=/usr/lib/i386-linux-gnu 
--incdir=/usr/include/i386-linux-gnu --enable-gpl --disable-stripping 
--enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa 
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca 
--enable-libcdio --enable-libebur128 --enable-libflite 
--enable-libfontconfig --enable-libfreetype --enable-libfribidi 
--enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg 
--enable-libopenmpt --enable-libopus --enable-libpulse 
--enable-librubberband --enable-libshine --enable-libsnappy 
--enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora 
--enable-libtwolame --enable-libvorbis --enable-libvpx 
--enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid 
--enable-libzmq --enable-libzvbi --enable-omx --enable-openal 
--enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 
--enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 
--enable-shared
   libavutil      55. 34.101 / 55. 34.101
   libavcodec     57. 64.101 / 57. 64.101
   libavformat    57. 56.101 / 57. 56.101
   libavdevice    57.  1.100 / 57.  1.100
   libavfilter     6. 65.100 /  6. 65.100
   libavresample   3.  1.  0 /  3.  1.  0
   libswscale      4.  2.100 /  4.  2.100
   libswresample   2.  3.100 /  2.  3.100
   libpostproc    54.  1.100 / 54.  1.100
Input #0, png_pipe, from 
'20181025_SHS_RBP3000-freezerOFF-2filters-zoom.png':
   Duration: N/A, bitrate: N/A
     Stream #0:0: Video: png, 1 reference frame, pal8(pc), 320x234, 25 
tbr, 25 tbn, 25 tbc
[h264 @ 0x184d0e0] Reinit context to 640x368, pix_fmt: yuv420p
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 
'20181024_RBP3000-1212_measuring-GS-filters-h640x360e.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     encoder         : Lavf57.56.101
   Duration: 00:00:50.02, start: 0.000000, bitrate: 827 kb/s
     Stream #1:0(und): Video: h264 (High), 1 reference frame (avc1 / 
0x31637661), yuv420p(left), 640x360 (640x368), 562 kb/s, 29.97 fps, 
29.97 tbr, 30k tbn, 59.94 tbc (default)
     Metadata:
       handler_name    : VideoHandler
     Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 
stereo, fltp, 255 kb/s (default)
     Metadata:
       handler_name    : SoundHandler
Matched encoder 'libx264' for codec 'h264'.
[graph 0 input from stream 0:0 @ 0x1860ae0] w:320 h:234 pixfmt:pal8 
tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
[graph 0 input from stream 1:0 @ 0x18604a0] w:640 h:360 pixfmt:yuv420p 
tb:1/30000 fr:30000/1001 sar:0/1 sws_param:flags=2
[scaler for output stream 0:0 @ 0x18723e0] w:640 h:360 flags:'bicubic' 
interl:0
[Parsed_zoompan_0 @ 0x1851020] auto-inserting filter 'auto-inserted fifo 
0' between the filter 'graph 0 input from stream 0:0' and the filter 
'Parsed_zoompan_0'
[auto-inserted scaler 0 @ 0x192fa60] w:iw h:ih flags:'bilinear' interl:0
[auto-inserted fifo 0 @ 0x1860e80] auto-inserting filter 'auto-inserted 
scaler 0' between the filter 'graph 0 input from stream 0:0' and the 
filter 'auto-inserted fifo 0'
[auto-inserted scaler 0 @ 0x192fa60] w:320 h:234 fmt:pal8 sar:0/1 -> 
w:320 h:234 fmt:yuva420p sar:0/1 flags:0x2
[Parsed_crop_1 @ 0x18728e0] w:1280 h:720 sar:0/1 -> w:32 h:22 sar:0/1
[Parsed_overlay_2 @ 0x18605a0] main w:640 h:360 fmt:yuv420p overlay w:32 
h:22 fmt:yuva420p eof_action:repeat
[Parsed_overlay_2 @ 0x18605a0] [framesync @ 0x1860644] Selected 1/30000 
time base
[Parsed_overlay_2 @ 0x18605a0] [framesync @ 0x1860644] Sync level 2
[scaler for output stream 0:0 @ 0x18723e0] w:640 h:360 fmt:yuv420p 
sar:0/1 -> w:640 h:360 fmt:yuv420p sar:0/1 flags:0x4
[libx264 @ 0x185efa0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 
AVX LZCNT BMI1 SlowPshufb
[libx264 @ 0x185efa0] profile High, level 3.0
[libx264 @ 0x185efa0] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC 
codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - 
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 
lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf 
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 
aq=1:1.00
Output #0, mp4, to 'testzoompan.mp4':
   Metadata:
     encoder         : Lavf57.56.101
     Stream #0:0: Video: h264 (libx264), 1 reference frame 
([33][0][0][0] / 0x0021), yuv420p, 640x360, q=-1--1, 29.97 fps, 30k tbn, 
29.97 tbc (default)
     Metadata:
       encoder         : Lavc57.64.101 libx264
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
     Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 
Hz, stereo, 255 kb/s (default)
     Metadata:
       handler_name    : SoundHandler
Stream mapping:
   Stream #0:0 (png) -> zoompan
   Stream #1:0 (h264) -> overlay:main
   overlay -> Stream #0:0 (libx264)
   Stream #1:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264 @ 0x18cf1e0] Reinit context to 640x368, pix_fmt: yuv420p
[Parsed_overlay_2 @ 0x18605a0] [framesync @ 0x1860644] Sync level 0= 
754.5kbits/s speed=2.12x
No more output streams to write to, finishing.
frame= 1499 fps= 62 q=-1.0 Lsize=    4831kB time=00:00:49.99 bitrate= 
791.7kbits/s speed=2.06x
video:3214kB audio:1563kB subtitle:0kB other streams:0kB global 
headers:0kB muxing overhead: 1.141019%
Input file #0 (20181025_SHS_RBP3000-freezerOFF-2filters-zoom.png):
   Input stream #0:0 (video): 1 packets read (2282 bytes); 1 frames 
decoded;
   Total: 1 packets (2282 bytes) demuxed
Input file #1 (20181024_RBP3000-1212_measuring-GS-filters-h640x360e.mp4):
   Input stream #1:0 (video): 1499 packets read (3517232 bytes); 1499 
frames decoded;
   Input stream #1:1 (audio): 2344 packets read (1600092 bytes);
   Total: 3843 packets (5117324 bytes) demuxed
Output file #0 (testzoompan.mp4):
   Output stream #0:0 (video): 1499 frames encoded; 1499 packets muxed 
(3291236 bytes);
   Output stream #0:1 (audio): 2344 packets muxed (1600092 bytes);
   Total: 3843 packets (4891328 bytes) muxed
[libx264 @ 0x185efa0] frame I:9     Avg QP:21.50  size: 21285
[libx264 @ 0x185efa0] frame P:456   Avg QP:24.18  size:  4438
[libx264 @ 0x185efa0] frame B:1034  Avg QP:28.03  size:  1040
[libx264 @ 0x185efa0] consecutive B-frames:  4.7%  8.8%  3.8% 82.7%
[libx264 @ 0x185efa0] mb I  I16..4: 11.1% 63.7% 25.1%
[libx264 @ 0x185efa0] mb P  I16..4:  4.2% 11.8%  1.7%  P16..4: 39.7% 
12.1%  5.1%  0.0%  0.0%    skip:25.4%
[libx264 @ 0x185efa0] mb B  I16..4:  0.4%  1.1%  0.1%  B16..8: 36.8%  
3.7%  0.5%  direct: 1.2%  skip:56.2%  L0:44.9% L1:50.5% BI: 4.5%
[libx264 @ 0x185efa0] 8x8 transform intra:66.5% inter:77.5%
[libx264 @ 0x185efa0] coded y,uvDC,uvAC intra: 46.9% 56.8% 11.1% inter: 
9.4% 11.8% 0.6%
[libx264 @ 0x185efa0] i16 v,h,dc,p: 28% 29%  9% 34%
[libx264 @ 0x185efa0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 20% 20% 4%  5%  
5%  8%  5%  6%
[libx264 @ 0x185efa0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 25% 13% 3%  5%  
5%  7%  3%  4%
[libx264 @ 0x185efa0] i8c dc,h,v,p: 47% 24% 23%  6%
[libx264 @ 0x185efa0] Weighted P-Frames: Y:8.6% UV:1.3%
[libx264 @ 0x185efa0] ref P L0: 60.9% 17.2% 13.9%  7.5%  0.5%
[libx264 @ 0x185efa0] ref B L0: 84.5% 11.7%  3.8%
[libx264 @ 0x185efa0] ref B L1: 95.1%  4.9%
[libx264 @ 0x185efa0] kb/s:526.31




More information about the ffmpeg-user mailing list