ffmpeg only drawing last text

Issue

Im using ffmpeg in flutter using the flutter ffmpeg plugin. While experimenting with it this is what I am trying to do: Show text between 1 to 2 seconds and a different text between 3 to 4 seconds in video.

Only the text mentioned between 3 to 4 seconds is shown. So for me only the last drawText would work. What am I missing here?

The is the list of arguments generated

 Running FFmpeg with arguments: [-y, -i, /storage/emulated/0/DCIM/Camera/20200707_234610.mp4, -i, /data/user/0/com.example.example/app_flutter/watermark.png, -filter_complex, [0:v][1:v]overlay=main_w-overlay_w-5:5 ,drawtext=fontfile='/data/user/0/com.example.example/app_flutter/font.ttf':fontsize=90:x=20:y=20:text='Testing':enable='between(t\,1\,2),drawtext=fontfile='/data/user/0/com.example.example/app_flutter/font.ttf':fontsize=90:x=20:y=260:text='OTHER TEXT':enable='between(t\,3\,4)'', -crf, 27, -preset, veryfast, -c:v, libx264, -r, 30, /data/user/0/com.example.example/cache/2020-07-21T07:50:39.206386.mp4]

Solution

You’re missing a single quote ('):

  • Change 'between(t\,1\,2),drawtext to 'between(t\,1\,2)',drawtext.

You also have an extra ' at the end of your filtergraph, but it was not the cause of the problem:

  • Change 'between(t\,3\,4)'', -crf to 'between(t\,3\,4)', -crf.

Fixed command:

-y, -i, /storage/emulated/0/DCIM/Camera/20200707_234610.mp4, -i, /data/user/0/com.example.example/app_flutter/watermark.png, -filter_complex, [0:v][1:v]overlay=main_w-overlay_w-5:5,drawtext=fontfile='/data/user/0/com.example.example/app_flutter/font.ttf':fontsize=90:x=20:y=20:text='Testing':enable='between(t\,1\,2)',drawtext=fontfile='/data/user/0/com.example.example/app_flutter/font.ttf':fontsize=90:x=20:y=260:text='OTHER TEXT':enable='between(t\,3\,4)', -crf, 27, -preset, veryfast, -c:v, libx264, -r, 30, /data/user/0/com.example.example/cache/2020-07-21T07:50:39.206386.mp4

Answered By – llogan

Answer Checked By – Timothy Miller (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.