I can add frame number to video with ffmpeg as below:
ffmpeg -y -i input.mp4 -an -vf drawtext=fontsize=36:fontcolor=yellow:text='%{frame_num}':x=20:y=20 -f mp4 output.mp4
How can I modify it to show HH:MM:SS instead of current frame number?
I can add frame number to video with ffmpeg as below:
ffmpeg -y -i input.mp4 -an -vf drawtext=fontsize=36:fontcolor=yellow:text='%{frame_num}':x=20:y=20 -f mp4 output.mp4
How can I modify it to show HH:MM:SS instead of current frame number?
As @kesh pointed out pts:hms instead of frame_num does the job but your specific command line, will lead you astray, as you have omitted a set of encapsulating quotes.
Whilst omitting them, works with frame_num, it will not work with pts:hms
Use:
ffmpeg -y -i input.mp4 -an -vf "drawtext=fontsize=36:fontcolor=yellow:text='%{pts\:hms}':x=20:y=20" -f mp4 output.mp4
Here the entire drawtext filter is wrapped in quotation marks.

Edit:
To achieve pure HH:MM:SS format use gmtime rather than hms i.e.
ffmpeg -y -i input.mp4 -an -vf "drawtext=fontsize=36:fontcolor=yellow:text=' %{pts\:gmtime\:0\:%T}':x=20:y=20" -f mp4 output.mp4