[FFmpeg-user] timestamp overlay

Jesse Koegler jessekoegler at gmail.com
Tue Aug 30 23:51:25 EEST 2016


On Tue, Aug 30, 2016 at 1:47 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com>
wrote:

> Hi!
>
> 2016-08-30 14:14 GMT+02:00 franck all <all.franck007 at gmail.com>:
> > I would like to add timestamp overlay with format
> > "hours:mintues:seconds:millseconds" on a video. I have tried to do it
> with
> > ffmpeg and the best I have managed to do is "hours:minutes:seconds:frames
> > number"
>
> Please provide your command line and the complete, uncut console output.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


Hi Franck,

I am not sure what platform you are on but I recently had this problem on
Windows. I would love a command-line only solution but wasn`t able to
figure one out. In the interest of time I ended up doing the following as a
 workaround (Note: steps 2-4 involve some scripting or programming. I used
C# and would be happy to share the algorithm/code I used if you are
interested.)

1. force the video to a fixed frame rate, in my case 30 fps; i.e. ffmpeg -i
myVideo.mp4 -r 30 myNewVideo.mp4
2. ffprobe the video for duration, parse stderr for the duration
3. convert the duration to total seconds, then multiply that by your fps.
This gives you total frames.
4. Create an .srt file, loop through the number of frames, and write a
timestamp for each frame.
5. Write the subtitles to the video; something like: ffmpeg  -y -i
myNewVideo.mp4 -vf
"subtitles=SubtitleFile.srt:force_style='Fontsize=10,Alignment=1,Shadow=0,Fontname=Arial,PrimaryColour=&H00F2F5&,Bold=0,Italic=0,MarginL=0,MarginV=260,Outline=0'"
myNewVideoWithSubtitles.mp4


If anyone knows an easier way to do this on Windows I`d love to know.

Jesse


P.S: Apologies in advance for top-posting or any formatting errors.


More information about the ffmpeg-user mailing list