Hello programmers,
Did you know you can make text on a video to slides diagonally. There are 4 types, variants or examples of these slides: first, sliding from top left top right bottom, second, vice versa, from right bottom to top left, third, from top right to left bottom and fourth, last, from left bottom to top right.
Below are the code for each types, variants or example. Note: you can change the number 100 to any movement speed (pixel/s) that you like.
1. Sliding from top left to right bottom
ffmpeg -i input_file -vf drawtext="text=text_to_display:x=mod(t*100\,w):y=(x*h)/w:fontsize=60" output_file_name
2. Sliding from right bottom to top left
ffmpeg -i input_file -vf drawtext="text=text_to_display:x=w-mod(t*100\,w+(19*15)):y(x*h)/w:fontsize=60:shadowx=2:shadowy=2:shadowcolor=red:fontcolor=white" output_file_name
3. Sliding from top right to left bottom
ffmpeg -i "input_file" -vf drawtext="text=text_to_display:x=w-mod(t*100\,w+(19*15)):y=h-(x*h)/w:fontsize=60:shadowx=2:shadowy=2:shadowcolor=red:fontcolor=white" output_file_name
4. Sliding from left bottom to top right
ffmpeg -i "input_file" -vf drawtext="text=text_to_display:x=mod(t*100\,w):y=h(x*h)/w:fontsize=60:shadowx=2:shadowy=2:shadowcolor=red:fontcolor=white" output_file_name