[FFmpeg-user] Changing the crop filter's output width over time?

John Hawkinson jhawk at alum.mit.edu
Sun Apr 26 08:21:37 EEST 2020

I wanted to execute zoom-and-pan out over a few seconds by parametrizing the width and height of the crop filter via sendcmd (the result of which would then be handed to a scale filter), and when I try to do this, I get errors that I don't understand.

When I use:

  sendcmd=c='0-1 crop w 1146+t*(1920-1146), crop h 1080'

I get:

  Error when evaluating the expression '1146+t*(1920-1146)'

When I use

  sendcmd=c='0-1 crop w 1146+T*(1920-1146), crop h 1080'

I get:

  Unknown function in 'T*(1920-1146)'
  Error when evaluating the expression '1146+T*(1920-1146)'

Neither of these seem to make sense to me. The crop filter docs indicate it takes the parameter 't', and the general eval api docs refer to 'T'. I'm not sure which (or both?) applies, but both fail in odd ways.

Same problem with a simpler exmpression like '1146+T'.

What am I doing wrong? Console output below.

I ultimately managed to get the zoompad filter to work for me, but it doesn't really seem designed to work well with video (rather than a still). I ended up using


where if I didn't specify the fps rate, it desynced my audio and video, and the expression necessary to make it work, depending on pzoom, and specifying the zoom steps...just felt fragile. (On the other hand, presumably it's more performant than a crop filter followed by a scale filer).

Thanks you.

jhawk at alum.mit.edu
John Hawkinson

$ sh -x diag.sh
+ ffplay -i v -vf '
  sendcmd=c='\''0-1 crop w 1146+T, crop h 1080'\'',
ffplay version 4.2.2 Copyright (c) 2003-2019 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libzvbi
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, matroska,webm, from 'v':
    COMPATIBLE_BRANDS: iso6avc1mp41
    MAJOR_BRAND     : dash
    ENCODER         : Lavf58.29.100
  Duration: 00:04:30.30, start: -0.007000, bitrate: 2977 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
      HANDLER_NAME    : ISO Media file produced by Google Inc.
      DURATION        : 00:04:30.270000000
    Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
      DURATION        : 00:04:30.301000000
[Parsed_crop_1 @ 0x7f7f8d7955c0] [Eval @ 0x7000072cedb0] Undefined constant or missing '(' in 'T'
Error when evaluating the expression '1146+T'
[Parsed_crop_1 @ 0x7f7f8d7955c0] [Eval @ 0x7000072cedb0] Undefined constant or missing '(' in 'T'
Error when evaluating the expression '1146+T'
Switch subtitle stream from #-1 to #-1 vq=  162KB sq=    0B f=0/0   
   2.09 A-V: -0.030 fd=   5 aq=   20KB vq=  143KB sq=    0B f=0/0   

More information about the ffmpeg-user mailing list