[FFmpeg-user] Plotting Circles and labels on individual frames of a movie

Rainer M Krug Rainer at krugs.de
Thu Apr 8 10:46:37 EEST 2021


Hi

I have a series of videos of moving particles (multiple particles per frame / movie), and would like to add a circle around each particle and add a label. At the moment I am using a script in R to plot, for each frame, these circles and labels into a png with alpha channel, combine the pngs to a movie, and overlay this movie to the original movie (see the thread 'Overlay images to frames in video’ for the background).

Now I realised, that the actual plotting of the labels takes up nearly 40% of the time of the R script and I would like to make this process faster.

I have found “draw_text” (https://ffmpeg.org/ffmpeg-filters.html#drawtext), but I have no idea how I could do this. We can assume that I have a text file with the following columns:

FRAME: the frame on which the labels and circle should be plotted
X:     the x-coordinate
Y:     the y=coordinate
LABEL: label for the point

Also possibly important, there are multiple (many) particles for which circles and labels need to be plotted on each frame. 

I also found the “sendcmd” (https://ffmpeg.org/ffmpeg-filters.html#sendcmd_002c-asendcmd) but I do not get my head around how I can combine these two.

Any help appreciated,

Rainer


--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Zürich
Office Y34-J-74
Winterthurerstrasse 190
8075 Zürich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug at uzh.ch
		Rainer at krugs.de
Skype:     RMkrug

PGP: 0x0F52F982



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4372 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210408/977e2298/attachment.bin>


More information about the ffmpeg-user mailing list