Here are a number of ffmpeg commands that I think are less common and therefore worth noting. They solve very specific requirements, but you can also use them as inspiration or source for other combinations or variations.

ffmpeg -framerate 50 -pattern_type glob -i 'frame-*.png' -i mask.png -filter_complex [0]overlay=x=0:y=0[out] -map [out] -c:v libx264 -pix_fmt yuv420p output.mp4
  1. Set the framerate to 50.
  2. Get individual PNG frames for the video
  3. Load a PNG mask
  4. Use a filter to overlay the PNG mask over the video
  5. Output a MP4 File

The video filter places the timestamp hours:minutes:seconds:milliseconds with a white yellow font.ttf on a black background a the bottom center of the frame

drawtext=text='timestamp: %{pts \: hms}': x=(w-tw)/2 : y=h-(2*lh) : fontsize=32 : fontcolor=yellow@1 : fontfile=font.ttf : box=1 : boxcolor=black@0.8

The entire ffmpeg command

ffmpeg -i input.mp4 -vf "drawtext=text='timestamp: %{pts \: hms}': x=(w-tw)/2 : y=h-(2*lh) : fontsize=32 : fontcolor=yellow@1 : fontfile=font.ttf : box=1 : boxcolor=black@0.8" -c:a copy output.mp4
  1. Takes a video file input.mp4
  2. Takes a font file font.ttf
  3. Write the timecode in the frame, yellow font (height 32) on a black background at the bottom center of the frame
  4. Keep the audio track
  5. Output to video file output.mp4

The video filter places the timecode hours:minutes:seconds:frames with a white yellow font.ttf on a black background a the bottom center of the frame

drawtext=timecode='00\\:00\\:00\\:00': r=25 : x=(w-tw)/2 : y=h-(2*lh) : fontsize=32 : fontcolor=yellow@1 : box=1 : boxcolor=black@0.8 : fontfile=font.ttf

The entire ffmpeg command

ffmpeg -i input.mp4 -vf "drawtext=timecode='00\\:00\\:00\\:00': r=25 : x=(w-tw)/2 : y=h-(2*lh) : fontsize=32 : fontcolor=yellow@1 : box=1 : boxcolor=black@0.8 : fontfile=m5x7.ttf" -c:a copy output.mp4
  1. Takes a video file input.mp4
  2. Takes a font file font.ttf
  3. Assume a framerate of 25 fps. This value must be set and is not read from the input file.
  4. Write the timecode in the frame, yellow font (height 32) on a black background at the bottom center of the frame
  5. Keep the audio track
  6. Output to video file output.mp4

Return the framerate of a given video file

ffprobe -v error -select_streams v -of "default=noprint_wrappers=1:nokey=1" -show_entries stream=r_frame_rate input.mp4

If your file has 30 fps the return value will be

30/1