You can use the drawtext filter with the n or frame_num function:

Looping 5 fps example
Example command:
ffmpeg -i input -vf "drawtext=fontfile=Arial.ttf: text="%{frame_num}": start_number=1: x=(w-tw)/2: y=h-(2*lh): fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=5" -c:a copy output
- You may have to provide the full path to the font file, such as
fontfile=/usr/share/fonts/TTF/Vera.ttf. n/frame_numstarts at 0, but you can make the frame count start from 1 with thestart_numberoption as shown in the example.
You could add additional text if desired, but be aware that you have to escape some special characters:
text="Frame\: %{frame_num}"

See the drawtext filter documentation for more info.