On Windows there's the Speech Recognition API, which is very easy to use, as in a few function calls, and you're all set.
Otherwise, albeit slower, you can use Google Cloud Speech API, or IBM Watson, and Amazon's Alexa Voice Server to do the same with internet connection.
You can always redirect audio output into audio capture device (you can do that on windows with the audio loopback device, and most OSes support a way of doing this), in which case all the audio output of your computer, such as YouTube audio, can be captured by the said APIs.
Unfortunately I don't specifically know a dedicated application for this, but for Windows this might contain what you need.
Otherwise a bit of programming skill, it should be easy to do it — I would be surprise if no one hasn't yet.
An extensive list of speech recognition software, some of which may contain the ability to save text output to a file I found here: