How to insert text into MP4 video at a certain position on top of the video?

Started by thoste, August 06, 2022, 04:45:18 PM

Previous topic - Next topic

thoste

Assume I have a MP4 video previously recorded with AVC H.264 and AAC audio codec.

Now I want to insert some text on top of the video at a certain position and only for a short time (e.g
from second 53 to 57).

How can I achieve this most easily?
If possible without re-encoding

Thomas

eumagga0x2a

This is called subtitles, you can use Aegisub to create (and eventually style) the text. Further steps depend on whether it is mandatory to avoid re-encoding and whether you want to have full control about the appearance, font size, position etc. of the text.

If you need just some text at the usual position where subtitles are displayed and don't care about its formatting, export a .srt file from Aegisub and use ffmpeg to mux it as a subtitle track into your mp4 file. The viewer of the video decides whether to turn on subtitles and see the text or not.

If some control over formatting is desired but re-encoding must be avoided, the only option AFAIK is to save subtitles as an .ass file with the same basename in the same directory as the mp4 file and hope that the player supports external subtitles.

If the text must become an integral part of the video (it is called hardcoded subtitles), you can use the "SSA/ASS/SRT" libass plugin in Avidemux with the .ass file out of Aegisub as input. In this case you must re-encode the entire video (leave audio track(s) in copy mode).