Solution 1:

I have to admit I didn't know what the FourCC tx3g really stood for. The FFmpeg codec mov_text and tx3g are the same thing: MPEG-4 Part 17 (Timed Text).

The only thing that FFmpeg does not support is custom styling for the text it embeds. If you look at the source code you'll find that they apply a default style:

For now, we'll use a fixed default style. When we add styling support, this will be generated from the ASS style.

That being said, the free and cross-platform MP4Box should be able to add these subtitles to MP4 files, as you requested. Even with styling. How you add them to the file depends on how they're encoded in the first place. From its documentation:

There is no official textual representation of a text stream. Moreover, the specification relies on IsoMedia knowledge for most structure descriptions. In order to help authoring text streams, an XML format has been developed in GPAC, called TTXT for timed-text – the extension used being .ttxt.

To create a TTXT file, you can do the following:

Find an SRT or SUB subtitle file, and run MP4Box -ttxt file.srt. This will convert the subtitles in TTXT format.

MP4Box should then be able to add the subtitle stream to an existing MP4 file like so:

MP4Box -add input.mp4 -add subtitles.ttxt output.mp4

It's important that you convert the subtitle files to TTXT before. If they're still SUB or SRT-encoded, MP4Box will simply lay them out with default options:

When importing SRT or SUB files, MP4Box will choose default layout options to make the subtitle appear at the bottom of the video.

Solution 2:

The pure ffmpeg method of embedding macOS and iOS-compatible subtitles on MP4 videos is:

ffmpeg -i input.MOV -i input.srt -c copy -c:s mov_text -tag:s:s:0 tx3g output.mov

The -tag:s:s:0 tx3g does the trick.