You need to reassign input (or use an intermediate variable). What's happening in each loop is you are taking the fresh input and drawing the text over that.

You could do something like

Copy...
        input = input.drawtext(
...

I believe, though I haven't worked with videos much. Like, you might need to do more to make sure the text doesn't all just layer over itself.

Answer from jojo on Stack Overflow
🌐
Bitbucket
hhsprings.bitbucket.io › docs › programming › examples › ffmpeg › drawing_texts › drawtext.html
drawtext — ffmpeg examples - bitbucket.io
#! /bin/sh pref="`basename $0 .sh`" ffmpeg -y -i "Pexels Videos 1457810.mp4" -filter_complex " [0:v] drawtext=' font=MS Gothic: fontsize=90:x=20:y=20: text=The quick brown fox jumps over a lazy dog. Sphinx of black quartz, judge my vow.' " "${pref}.mp4" For the relationship between font family names and file names, for example see ImageFont Module (Python Pillow examples).
🌐
GitHub
github.com › kkroening › ffmpeg-python › issues › 59
How to write frame number with drawtext · Issue #59 · kkroening/ffmpeg-python
January 21, 2018 - hello I'm trying to write the frame number on a video and would normally do it by text="%{n}" in ffmpeg when i try that in ffmpeg-python i just get it literally written like that, with escape_text=True or escape_text=False. so how would i actually do it? my whole command chain is this · ffmpeg.input(inputz) .drawtext(text="%{n}",start_number=0, fontfile="/Users/jamieparry/PyInstaller-2.1/kivthing/dist" "/kivthing/kivy_install/data/fonts/DroidSans-Bold.ttf", fontcolor="red",x=40,y=100,timecode="00:00:00:00",timecode_rate=25, fontsize="64",escape_text=True) .output(os.path.join(folderplace,"ff_outputz",justname)) .run(overwrite_output=True) No one assigned ·
Author   jamieparry
🌐
FFmpeg Python
kkroening.github.io › ffmpeg-python
ffmpeg-python: Python bindings for FFmpeg — ffmpeg-python documentation
Official documentation: drawtext · ffmpeg.filter(stream_spec, filter_name, *args, **kwargs)¶ · Apply custom filter. filter_ is normally used by higher-level filter functions such as hflip, but if a filter implementation is missing from ffmpeg-python, you can call filter_ directly to have ffmpeg-python pass the filter name and arguments to ffmpeg verbatim.
🌐
OTTVerse
ottverse.com › home › ffmpeg › ffmpeg drawtext filter to insert dynamic overlays, scrolling text, and timestamps
FFmpeg drawtext filter to Insert Dynamic Overlays, Scrolling Text, and Timestamps - OTTVerse
August 21, 2023 - Learn FFmpeg’s drawtext filter to dynamically overlay text on video and display information such as timecode, frame resolution, watermarks, etc. Also, let’s learn how to configure the font, font-size, position, background-color, alignment, ...
🌐
FFmpeg
ffmpeg.org › ffmpeg-filters.html
FFmpeg Filters Documentation
3 weeks ago - ffmpeg -i <INPUT> -vf drawtext=/text=/tmp/some_text <OUTPUT>
🌐
Python Programming
pythonprogramming.altervista.org › put-a-text-on-a-video-python-ffmpeg
Put a text on a video (python + ffmpeg) – python programming
import os def text(text, x="center"): ... os.system("""ffmpeg -i merola.mp4 -vf drawtext="fontfile=/path/to/font.ttf: \ text={text}: fontcolor=white: fontsize=24: box=1: [email protected]: \ boxborderw=5: x=0: y=h-30" -codec:a copy output.mp4""") text("Python's great"...
🌐
Hacker News
news.ycombinator.com › item
FFmpeg Drawtext Filter for Overlays, Scrolling Text, Timestamps on Videos | Hacker News
October 25, 2020 - ffmpeg -ss 66 -i crab.mp4 -t 30 -crf 27 -preset veryfast -vf "drawtext=fontfile=/usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf:text='YOUR TEXT HERE':fontcolor=white:fontsize=240:shadowx=5:shadowy=5:box=1:boxcolor=black@0.0:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2:enable='be...
Find elsewhere
🌐
YouTube
youtube.com › dev stef
FFMPEG Overlay And Drawtext: How To Easily Render Text And Images On Your Video! - YouTube
We are going to see how to apply an overlay text or image/video on top of your video using FFmpeg.First we see how we can burn normal text using the _drawtex...
Published   December 6, 2022
Views   6K
🌐
GitHub
github.com › kkroening › ffmpeg-python › blob › master › ffmpeg › _filters.py
ffmpeg-python/ffmpeg/_filters.py at master · kkroening/ffmpeg-python
Official documentation: `drawbox <https://ffmpeg.org/ffmpeg-filters.html#drawbox>`__ """ if thickness: kwargs['t'] = thickness · return FilterNode( stream, drawbox.__name__, args=[x, y, width, height, color], kwargs=kwargs · ).stream() · · @filter_operator() def drawtext(stream, text=None, x=0, y=0, escape_text=True, **kwargs): """Draw a text string or text from a specified file on top of a video, using the ·
Author   kkroening
🌐
GitHub
github.com › kkroening › ffmpeg-python › issues › 276
drawtext filter: using text expansion with pts · Issue #276 · kkroening/ffmpeg-python
October 8, 2019 - timer1Params['text'] = '%%{pts}' #### here be dragons #### timer1Params['fontsize'] = relativeSize(md, 'h', 12) timer1Params['x'] = roundUpToBase( (md['crop_w'] * .50), 20) timer1Params['y'] = roundUpToBase( (md['crop_h'] * .03), 20) timer1Params['enable'] = 'between(t,0,5)' # and so on to build up the drawtext parameters... then... ( ffmpeg .input(infile, ss=leadInFromFileStart, t=outputDuration) .drawtext(**timer1Params) .output(outfile) .run(capture_stdout=False, capture_stderr=False) )
Author   ljwobker
🌐
GitHub
github.com › kkroening › ffmpeg-python › issues › 873
drawtext causes a muted video output · Issue #873 · kkroening/ffmpeg-python
May 3, 2025 - I am using both CLI ffmpeg and python-ffmpeg in the same environment, which is Termux app installed in a Samsung GS8+ Android phone. When I run this command I get the expected output (text overlayed on the input video). $ ffmpeg -i input.mp4 -vf "drawtext=text='© Leóñardo da Vinci':x=(1100-text_w):y=(600-text_h):fontsize=32:fontcolor=black:box=1:boxcolor=white@0.5: boxborderw=5" -c:a copy ffmpeg_drawtext-output.mp4
Author   abubelinha
🌐
Medium
medium.com › @abdullah.farwees › ffmpegs-drawtext-filter-with-native-language-texts-b9b49721808a
FFmpeg’s Drawtext Filter with native language texts | by Abdullah Farwees - Video Audio Software Engineer | Medium
August 12, 2023 - ffmpeg -i video.mp4 -filter_complex “drawtext=fontfile=Khula.ttf:fontsize=60:fontcolor=blue:text=’जीवन की अगली कड़ी देखने के लिए जल्दी से फॉलो करें’:x=w-mod(max(t*90\,0)-100\,w+tw):y=80” output-right-to-left.mp4
🌐
GitHub
github.com › kkroening › ffmpeg-python › issues › 198
How to use real time input for drawbox or drawtext coordinates? · Issue #198 · kkroening/ffmpeg-python
April 25, 2019 - I'd like to use live data from a json as the coordinates for drawbox or drawtext, is it possible? Input source is raw stream, I'd apply a drawbox or drawtext filter to it with the live posi...
Author   davidkisvari