Some time ago I wanted to make a DashCam with an old phone.
I haven't found any solution to do it in real time.
or else
@Erel solution. But the result is bad.
I recorded in real time in a subtitle file (*.srt) the system time using a timer. Every second.
Then you have a choice.
1 you play the video with the subtitle which will display the time of the recording.
2 you recompile the video with ffmpeg and you can thus embed the time of the recording in the video.