Adding text to mp4

This cannot be done in Shotcut. When you add text to a video (e.g. using the Text:Simple filter) that text is “burned into” the video when yu export it. This means that the (white?) pixels of the text are no different from any other pixels in the frame of the video, hence there is no way for YouTube to “switch the text on or off”.

If you want to add captions in YouTube itself, this is relatively easy. See the following for information: Add subtitles & captions - YouTube Help

If you want to create a subtitle file (and possibly burn it into your video with Shotcut) see here:

Create an MLT File Containing Subtitles From a Subrip (.srt) File.

Also, other platforms (like Vimeo) also permit you to upload subtitle files (.srt etc.) for them to display optionally while they are showig your video.