I would like to draw diagonal lines in the video.
Vertical and horizontal lines
-i input-vf drawerbox=10:10:1:200:color='#ff0000':8:enable='between(t,3,5)output
I was able to draw with drawbox as shown in , but I don't know how to use diagonal lines.
How can I draw a diagonal line?
Thank you for your cooperation.
ffmpeg
According to ffmpeg draw a line from point, the if statement can be used in the geq filter to repeat the "draw a point at coordinates where X and Y coordinates match" process as quoted below.
ffmpeg-in.mp4-filter_complex
US>" color=red:s=490x490, geq=lum='p(X,Y))':a='if(eq(X,Y),255,0)'[c];
[0][c] overlay=10:10:shortest=1"
out.mp4
However, as stated in the comment in the answer above, this process is expensive because it scans the entire screen with a geq filter and draws dots.
GEAQ's "How to lighten the load" advice (quoted below) that allows you to draw lines, circles, and patterns in mathematical formulas may also be helpful.
The geq filter is heavy, so if there is no change in the image, it is better to take out only one frame with a trim filter and repeat it with a loop filter.
ffplay-flavfi-i color, geq='st(0, between(X,W/3,2*W/3)* between(Y,H/3,2*H/3));ld(0)*255:128', trim=end_frame=1, loop=-1:1:0, setspts=N/FRAME_RATE/TB
An alternative is to prepare a diagonal image and synthesize it into a video.
Note:
Mix and synthesize videos and images with FFmpeg
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
620 Uncaught (inpromise) Error on Electron: An object could not be cloned
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.