[FFmpeg-user] question about displace filter
Michael Koch
astroelectronic at t-online.de
Sun Nov 19 10:49:10 EET 2017
Finally I found a solution how to make curved text for a fulldome video.
It's awfully slow because in the geq filter the same calculations are
made for each frame again and again. But it works. Below is the Windows
batch file.
Most probably the remap filter would make this process much faster, but
I haven't yet figured out how to make the Xmap and Ymap files.
Michael
REM make a video with curved text for fulldome fade-in fade-out
set "DUR=10" : duration of video
set "FPS=30" : framerate
set "BACK=black" : background color
set "FONT=arial.ttf" : font
set "TEXT=my_text.txt" : text file
set "COLOR=orange" : text color
set "FSIZE=15" : font size
set "POS_X=(w-tw)/2" : X text position, for centered text: (w-tw)/2
set "POS_Y=h*0.9" : Y text position
set "S=2" : start time for text
set "E=8" : end time for text
set "FI=2" : fade-in duration (may be small, but not zero)
set "FO=2" : fade-out duration (may be small, but not zero)
set "SIZE=1000" : video size (quadratic)
c:/ffmpeg/ffmpeg ^
-f lavfi ^
-i color=c=%BACK% ^
-r %FPS% ^
-t %DUR% ^
-aspect "1:1" ^
-vf
"scale=%SIZE%:%SIZE%,drawtext='fontfile=%FONT%:textfile=%TEXT%:fontcolor_expr=%COLOR%@%%{e\:clip(((t-%S%)/%FI%)*between(t,%S%,%S%+%FI%)+(%E%-t)/%FO%*between(t,%S%+%FI%,%E%),0,1)}:fontsize=%FSIZE%:x=%POS_X%:y=%POS_Y%',geq=p(if(gt(Y\,H*0.7)\,W/2+H/2*atan((X-W/2)/(Y-H/2))\,0)\,if(gt(Y\,H*0.7)\,H/2+hypot(X-W/2\,Y-H/2)\,0))"
^
-c:v mpeg4 ^
-q:v 0 ^
-y test.mp4
pause
More information about the ffmpeg-user
mailing list