[FFmpeg-user] Combining xfade and drawtext

Cecil Westerhof Cecil at decebal.nl
Mon Sep 12 20:05:16 EEST 2022


I am using xfade and drawtext without problems. But now I want to use
both. But combining the two goes wrong.

I use:
ffmpeg -ss 308 -t 4 -i 00011-00016.MTS -ss 329 -to 374 -i 00011-00016.MTS -pix_fmt yuv420p -vcodec libx264 -crf 26 -acodec libmp3lame -qscale:a 9 -preset veryfast -filter_complex 'xfade=transition=hlslice:duration=4:offset=0;acrossfade=d=4,drawtext=                                box        = 1:                         boxborderw = 6:                         boxcolor   = black at 0.2:                 fontcolor  = white at 0.4:                 fontfile   = FreeSerifBold.ttf:         fontsize   = 32:                        text       = © 2022 Cecil Westerhof - Cecil at Decebal.nl:             x          = ((main_w - text_w) / 2):   y          = main_h - (text_h * 2)    ' xfadeMusicalTestTemp/accordeonmuziek.ts

But this gives:
ffmpeg version 4.3.4-0+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mpegts, from '00011-00016.MTS':
  Duration: 01:31:13.52, start: 1.440000, bitrate: 16005 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 256 kb/s
Input #1, mpegts, from '00011-00016.MTS':
  Duration: 01:31:13.52, start: 1.440000, bitrate: 16005 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #1:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #1:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 256 kb/s
[Parsed_drawtext_2 @ 0x56143c223540] Using "/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf"
[Parsed_acrossfade_1 @ 0x56143c5f9880] Media type mismatch between the 'Parsed_acrossfade_1' filter output pad 0 (audio) and the 'Parsed_drawtext_2' filter input pad 0 (video)
[AVFilterGraph @ 0x56143c54a500] Cannot create the link acrossfade:0 -> drawtext:0
Error initializing complex filters.
Invalid argument
Command exited with non-zero status 1


What am I doing wrong?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list