If you want to do this via command line, you can use the FFmpeg library :
Most built-in gallery apps have a "Video Editor" or "Create" tool.
A great online tool if you don't want to install software. Upload the MP4 to Canva's Video Editor and use the text tool. 🛠️ For Developers (FFmpeg)