I’m attempting to use drawtext to add multiple subtitle-like text onto a video.. It works when I have 1 or 2 drawtext arguments like this:
WORKING:
/home/zedkay22/ffmpeg-git-20190302-amd64-static/ffmpeg -i outa.mp4 -vf "[in]drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=60: fontcolor=white:x=20: y=500:text='My real fear is that':enable='between(t,5,10)',drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=60: fontcolor=white:x=0: y=500:text='the truth of the matter is people':enable='between(t,11,20)'[out]" output.mp4
but when I attempt to add multiple drawtext options, I get errors and a failed conversion.
Please see my attempt below and then the output from the failed conversion. Any steps in the right direction would be appreciated.
**FYI: I also tried to burn an SRT file directly but the styling options were limited so I’ve avoided that and used drawtext instead.
Attempt:
ffmpeg -i outa.mp4 -vf "[in]drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='My real fear is that they\\'re going to invent a ':enable='between(t,0,4)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='better eye for blind people . And when they do ':enable='between(t,4,9)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text=', like Look how amazing this is . We\\'ve given ':enable='between(t,8,11)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='blind people the ability to see again , too possum ':enable='between(t,11,13)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='. But now they also have all these other features ':enable='between(t,13,16)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='that you don\\'t have with your regular eyes . Let ':enable='between(t,16,17)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='us scooped those bad boys . ':enable='between(t,17,18)'[out]" aoutput.mp4
The Output I get on terminal with the failed conversion:
ffmpeg -i outa.mp4 -vf "[in]drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='My real fear is that they\\'re going to invent a ':enable='between(t,0,4)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='better eye for blind people . And when they do ':enable='between(t,4,9)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text=', like Look how amazing this is . We\\'ve given ':enable='between(t,8,11)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='blind people the ability to see again , too possum ':enable='between(t,11,13)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='. But now they also have all these other features ':enable='between(t,13,16)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='that you don\\'t have with your regular eyes . Let ':enable='between(t,16,17)';drawtext=fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text='us scooped those bad boys . ':enable='between(t,17,18)'[out]" aoutput.mp4 ffmpeg version N-48288-g3b23eb283a-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2019 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg libavutil 56. 26.100 / 56. 26.100 libavcodec 58. 47.102 / 58. 47.102 libavformat 58. 26.101 / 58. 26.101 libavdevice 58. 6.101 / 58. 6.101 libavfilter 7. 48.100 / 7. 48.100 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'outa.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.26.101 Duration: 00:03:25.92, start: 0.000000, bitrate: 147 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 810x660, 12 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (aac (native) -> aac (native)) Press [q] to stop, [?] for help [drawtext @ 0x650edc0] [Eval @ 0x7fffcb9196b0] Missing ')' or too many args in 'between(t' [drawtext @ 0x650edc0] Error when evaluating the expression 'between(t' for enable [AVFilterGraph @ 0x650b9c0] Error initializing filter 'drawtext' with args 'fontfile=fonts/BebasNeue-Regular.otf:fontsize=40: fontcolor=white:x=20: y=500:text=My real fear is that they\re going to invent a :enable=between(t' Error reinitializing filters! Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #0:0 [aac @ 0x5e11e40] Qavg: 11771.192 [aac @ 0x5e11e40] 2 frames left in the queue on closing
How do I avoid this error? Thanks in advance! Any steps would be appreciated.