There are lots of free software and tools (such as Aegisub or Subtitle Workshop), that help you to type the subtitles yourself and attach them to a specific time code so it matches the visual elements. It's good to remember that when adding the subtitles manually, it can be a very time-consuming process.
Video content producers or owners who already have a YouTube channel can use the platform’s speech recognition technology to generate subtitles automatically after a video has been uploaded. Currently, this option is available only for Russian, Japanese, English, Portuguese, German, Spanish, Korean, French, Italian, and Dutch languages. You have to use more manual methods of making subtitles for your YouTube videos
if your language is not currently supported there.
Here’s a quick guide to help you add subtitles to your videos using YouTube:
There are also a tonne of other speech-to-text solutions out there like rev.com
that can help you automate your subtitle or caption creation. Most will also do this for you in multiple languages!