[FFmpeg-user] Using expressions in "FADE" filter

Shlomo Morosow smorosow at jemedia.org
Wed Apr 29 23:57:43 CEST 2015


I need the ability to input mathematical values for setting the start time
(st)  on the "fade" filter, I've attempted to use an expression and this
particular filter does not seem to work with expressions, nor simple math
as "10*1". I've included here the input and output of two commands which
I've run, the first with a number as the "st" value which ran successfully
and the second with an expression as the "st" value which returned errors.
Does anyone have any creative solutions? perhaps using the "blend" filter?

Thanks very much


Input 1:

ffmpeg.exe -y -ss "0:00:20" -t "0:00:10" -i input.avi -filter_complex
"fade=out:st=9:d=1" -f dvd -target ntsc-dvd -r 29.97 -aspect 4:3 -b:v 4500k
-mbd rd -trellis 1 -flags +mv0 -cmp 0 -subcmp 2 -b:a 128k output.vob


Output 1:

ffmpeg version N-70875-g3c5c687 Copyright (c) 2000-2015 the FFmpeg
developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
--enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 29.100 / 56. 29.100
  libavformat    56. 26.101 / 56. 26.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 13.101 /  5. 13.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, avi, from 'input.avi':
  Duration: 00:00:42.54, start: 0.000000, bitrate: 30316 kb/s
    Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv411p, 720x480 [SAR
8:9 DAR 4:3], 28793 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 2
channels, s16, 1536 kb/s
Output #0, dvd, to 'output.vob':
  Metadata:
    encoder         : Lavf56.26.101
    Stream #0:0: Video: mpeg2video, yuv420p, 720x480 [SAR 8:9 DAR 4:3],
q=2-31, 4500 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.29.100 mpeg2video
    Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc56.29.100 ac3
Stream mapping:
  Stream #0:0 (dvvideo) -> fade (graph 0)
  fade (graph 0) -> Stream #0:0 (mpeg2video)
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> ac3 (native))
Press [q] to stop, [?] for help
frame=   88 fps=0.0 q=5.3 size=    1736kB time=00:00:03.19
bitrate=4451.6kbits/s
frame=  178 fps=177 q=2.6 size=    3332kB time=00:00:06.10
bitrate=4469.8kbits/s
frame=  255 fps=169 q=2.0 size=    4378kB time=00:00:09.01
bitrate=3976.7kbits/s
frame=  300 fps=180 q=1.6 Lsize=    4536kB time=00:00:10.01
bitrate=3711.9kbits/s
video:4269kB audio:156kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 2.506122%





Input 2:

ffmpeg.exe -y -ss "0:00:20" -t "0:00:10" -i input.avi -filter_complex
"fade=out:st=%{expr\\\: (10-1)}:d=1" -f dvd -target ntsc-dvd -r 29.97
-aspect 4:3 -b:v 4500k -mbd rd -trellis 1 -flags +mv0 -cmp 0 -subcmp 2 -b:a
128k output.vob



Output 2:

ffmpeg version N-70875-g3c5c687 Copyright (c) 2000-2015 the FFmpeg
developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
--enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 29.100 / 56. 29.100
  libavformat    56. 26.101 / 56. 26.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 13.101 /  5. 13.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, avi, from 'input.avi':
  Duration: 00:00:42.54, start: 0.000000, bitrate: 30316 kb/s
    Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv411p, 720x480 [SAR
8:9 DAR 4:3], 28793 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 2
channels, s16, 1536 kb/s
[fade @ 0000000002c80f60] Unable to parse option value "%{expr: (10-1)}" as
duration
    Last message repeated 1 times
[fade @ 0000000002c80f60] Error setting option st to value %{expr: (10-1)}.
[Parsed_fade_0 @ 0000000002c6a540] Error applying options to the filter.
[AVFilterGraph @ 000000000035a440] Error initializing filter 'fade' with
args 'out:st=%{expr\: (10-1)}:d=1'
Error configuring filters.


More information about the ffmpeg-user mailing list