<p>FFmpeg's <code>drawtext</code> filter can burn timecodes into frames.</p>

<p>edit: I misread the docs before.  I saw the <code>timecode</code> option to the filter, and missed seeing that there was a <code>pts</code> available for text expansion.  See the edit history for the longer-and-less-useful answer.</p>

<p>I eventually got around to trying it, and here's the command line I cobbled together from pasting and tweaking some examples:</p>

<p><code>ffmpeg -i /f/p/moto-g\ camera/VID_20141225_140557099.mp4 -filter_complex "drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='frame %{n}\\: %{pict_type}\\: pts=%{pts \\: hms}': x=100: y=50: fontsize=24: fontcolor=yellow@0.8: box=1: boxcolor=blue@0.9" -c:a copy -c:v libx264 -preset veryfast -crf 16 -x264-params keyint=60 -map 0 foo.mkv</code></p>

<p>Note the actual text to be printed needs a lot of escaping, to protect it from the shell, then from ffmpeg's arg-to-<code>drawtext</code>.  To modify it, change the <code>text='frame %{n}\\: %{pict_type}\\: pts=%{pts \\: hms}'</code> part of that ffmpeg command.</p>

<p>example output: "frame 0: I: pts=00:00:00.0000"  (I/B/P are frame types, from <code>%{pict_type}</code>.)</p>

<p>Modify <code>x</code> and <code>y</code> to put it somewhere else in the frame.  (you can use <code>x=iw/2</code> to put it horizontally in the middle.  <code>iw</code> = input width.  (anchor = top left corner of the text, I think?))  Modify other params to change colors or whatnot.</p>

<p>This works even with VFR video.  I checked with video from the camera in a Moto G phone, which makes variable frame-rate video.  The first second has 30 frames.  A later 1-sec interval in the video has 17 frames.  (Indoors, not very well lit, so I think it's lower FPS to get more light, not because it can't write to flash storage fast enough.)  The timestamps it puts in the MP4 container are correct, so it plays fine.</p>

<p>The encode parameters <code>-c:a copy -c:v libx264 -preset faster -crf 16 -x264-params keyint=60</code> are my suggestion for what you might want for scratch files with timestamps burned in: you just want it to encode fast, and don't care much about filesize since you're just going to use it locally, since it has timestamps scribbled all over it.  (There's even a superfast.  Don't use ultrafast except for lossless mode, though.)</p>

<p><code>keyint=60</code> will make sure there's an I frame at least as often as every 60 frames, for efficient scrubbing.  Leave it out if you don't need to be able to efficiently framestep backwards; lower it if you want high-rez seeking to be faster.</p>

<p>Use <code>-map 0</code> if you want multiple audio and metadata streams copied into the output, instead of just the first audio and first video tracks (and no e.g. chapter metadata).</p>

CC BY-SA 3.0
2015-02-23T14:34:26.840Z
basically re-did my answer, because I mis-read the docs the first time.  >.<  turns out ffmpeg can burn in timestamps without needing to be told the FPS or anything stupid like that.
Peter Cordes
CC BY-SA 3.0
2015-02-24T22:02:43.403Z
Thanks @peter-cordes . FFmpeg looks amazing - just checked out their website. But it does look quite complex and requires lots of pure coding :S
Kash
CC BY-SA 3.0
2015-02-24T23:36:35.237Z
Heh, it *took* lots of coding to write, but using it is at the simplest just a matter of finding a recipe and then using it on different input files.  On Mac, Windows, or GNU/Linux, you could set something up to let you drag a file onto a script, so the script runs ffmpeg on your file, making a new output file named `in_name-timestamped.mp4` or something.  Probably easier to do it from within the editing tool you already use, though, if it formats the timestamps in a way you like.
Peter Cordes
CC BY-SA 3.0
2015-02-25T01:05:50.340Z
Screenshot please?
hendry
CC BY-SA 3.0
2015-02-25T04:03:23.633Z
On Windows, if you put a Shortcut to a .bat on your desktop, dragging a file onto it will run the .bat with the dragged file as a command line arg.  So you write a bat file that uses `%1` as input and `timestamped-%1` as output.  On GNU/Linux, you either put your command in a shell script and use it from the command line yourself, or you make a `.desktop` file that lets you send files to it from a graphical file browser.  I assume something similar is possible on OS X.
Peter Cordes
CC BY-SA 3.0
2015-04-19T12:16:51.230Z
I went away to learn bit about the ffmpeg and the installation. I now know some basic stuff! @PeterCordes
Kash
CC BY-SA 3.0
2015-04-19T12:17:08.713Z
I using windows so I changed the font location to this:

ffmpeg -i in.mts -filter_complex "drawtext=fontfile=/Windows/Fonts/arial.ttf: text='frame %{n}\\: %{pict_type}\\: pts=%{pts \\: hms}': x=100: y=50: fontsize=24: fontcolor=yellow@0.8: box=1: boxcolor=blue@0.9" -c:a copy -c:v libx264 -preset veryfast -crf 16 -x264-params keyint=60 -map 0 out3.avi
Kash
CC BY-SA 3.0
2015-04-19T12:17:24.887Z
But I got this error:

[Parsed_drawtext_0 @ 03ba4060] Option 'pts' not found
[AVFilterGraph @ 03d8b8a0] Error initializing filter 'drawtext' with args 'fontfile=/Windows/Fonts/a
rial.ttf: text=frame %{n}\\: %{pict_type}\\: pts=%{pts \\: hms}: x=100: y=50: fontsize=24: fontcolor
=yellow@0.8: box=1: boxcolor=blue@0.9'
Error configuring filters.
Kash
CC BY-SA 3.0
2015-04-19T12:17:43.020Z
Do you know what this error is and how to resolve? @PeterCordes
Kash
CC BY-SA 3.0
2015-04-19T12:58:39.013Z
Your commandline, copy/pasted into a shell and changing the input file and font, works for me.  My quoting works for a Unix shell, I guess DOS cmd.exe has different quoting rules.  (Or actually, I think cmd.exe passes the entire arg as one string, and every program needs to do its own quote-removal.)  I don't have a working Windows with ffmpeg setup right now.
Peter Cordes
CC BY-SA 3.0
2015-04-19T12:59:19.050Z
However, I can tell you what the command line ffmpeg sees should be:  I ran echo ffmpeg ..., so see what happens after bash's quote remval.  `ffmpeg -i in.mts -filter_complex drawtext=fontfile=/Windows/Fonts/arial.ttf: text='frame %{n}\: %{pict_type}\: pts=%{pts \: hms}': x=100: y=50: fontsize=24: fontcolor=yellow@0.8: box=1: boxcolor=blue@0.9 -c:a copy -c:v libx264 -preset veryfast -crf 16 -x264-params keyint=60 -map 0 out3.avi`
Peter Cordes
CC BY-SA 3.0
2015-04-19T13:02:58.887Z
If I were you, I'd get a decent Unix shell for windows.  Git comes with bash compiled with mingw.  (http://git-scm.com/download/win)  Not a full cygwin bash, just minimal port to windows.  The installer sets up "new git bash here" context menu entries for folders for explorer, too.  It still runs in a DOS text window, instead of a decent terminal emulator, so copy/pasting sucks a bit, but it's pretty usable and very lightweight.   The other option, of course, is to figure out how to quote your command for `cmd.exe`. :P
Peter Cordes
CC BY-SA 3.0
2015-04-19T13:06:01.980Z
BTW, I guess quoting is problem error, rather than a version of ffmpeg that doesn't support pts, because your error message says ffmpeg was interpreting `pts` as an option to the drawtext filter, NOT as part of the string argument to the `text` option.  So the `:` in the text arg must not have been getting quoted properly.  Probably a difference in how `\\\` inside double quotes is handled in bourne shell vs. DOS.
Peter Cordes
CC BY-SA 3.0
2015-04-19T13:28:40.967Z
Also, don't put h.264 into .avi containers, unless you need to.  mkv is a nicer container, and so is mp4.  AVI doesn't really properly support B frames (which can reference future frames).  Video streams are stored in decode order.  With B frames, that's not the same as display order.  IIRC, this is what makes B frames (even xvid with b frames) in avi a hack.
Peter Cordes
CC BY-SA 3.0
2015-02-23T02:36:30.497Z
2015-02-23T14:38:50.503Z
2015-02-23T14:38:50.503Z
Peter Cordes
<p>Video editing software usually DOES come with this ability.  After Effects, Premiere, Vegas, etc, all support doing this very simply.  Some of them add their own time code rather than time code from meta, so you may have to adjust the start point to match your actual time code, but the end result should still be the same.</p>

<p>For example, in Premiere, the following screen shot shows the effect under Video Effects/Video/Timecode as well as the options associated with it.
<img src="https://i.sstatic.net/PxONu.jpg" alt="enter image description here"></p>

<p>It is worth mentioning that in Premiere, it does appear that the font is fixed on arial, though size and position can be adjusted.  After Effects, however, will allow for font of your choosing.</p>

CC BY-SA 3.0
2015-02-22T20:10:32.523Z
Hi, thanks for your reply. Can you give me bit more info on how to apply the timestamp on to it on premier?
Kash
CC BY-SA 3.0
2015-02-22T21:14:07.467Z
@Kash - updated my answer to include a screen shot with where the effect is, what the settings are and how it looks.
AJ Henderson
CC BY-SA 3.0
2015-02-22T16:17:55.433Z
2015-02-22T21:19:17.793Z
2015-02-22T21:19:17.793Z
AJ Henderson
<p>Another option is Sony Vegas Pro + Vegasaur extension.
Using this extension, you can <a href="http://vegasaur.com/recorded-date-time-subtitles" rel="nofollow noreferrer">extract recorded date/time information</a> from video files and burn it onto video. Font, color, size etc. - fully customizable.</p>

<p><img src="https://i.sstatic.net/J9nhI.png" alt="enter image description here"></p>

CC BY-SA 3.0
2015-04-05T12:55:16.553Z
2015-04-05T12:55:16.553Z
altarvic
<p>Try Davinci Resolve.  Very easy and capable burn in capability.
See my video tutorial on how to use this helpful feature.
<div class="youtube-embed"><div>
                <iframe width="640px" height="395px" src="https://www.youtube.com/embed/JTIvvWCHxks?start=0"></iframe>
            </div></div>
Thank you.
Dan Benson</p>

CC BY-SA 3.0
2017-08-17T22:43:28.000Z
Hi Daniel, welcome to Video.SE.  Could you include at least a basic level of detail in your answer here.  Video tutorials are great, but if off-site links go dead, then this will no longer provide an answer.  Due to this, answers that don't provide at least a basic explanation of the external resource may be down voted or deleted.
AJ Henderson
CC BY-SA 3.0
2017-08-17T21:42:15.330Z
2017-08-17T21:42:15.330Z
Daniel Benson
<p>I want to burn timestamp from the video meta data on to the video. </p>

<p>I'm having great difficulty in finding a good tool that does that. </p>

<p>Is there a video editing tool out there that allows timestamp to be inserted and change the font of it? </p>

<p>I am editing HD videos.</p>

<p>Also is there a tool out there that allows changing the timestamp on the meta data for correction?</p>

CC BY-SA 3.0
2015-02-23T14:35:27.677Z
dunno if stackexchange will notify you about my comment on my answer, that I mostly re-wrote it.  Well anyway, it sucked so I did.  Commenting here because I know that will pop up a notification for you.
Peter Cordes
CC BY-SA 3.0
2015-07-21T06:15:10.060Z
possible duplicate of [Adding a time stamp to a video](http://video.stackexchange.com/questions/4108/adding-a-time-stamp-to-a-video)
jsj
<video-editor><timecode><premiere-elements>
How to burn timestamp onto video?
Kash
# How to burn timestamp onto video?

(Asked by: username_0 on 2015-02-22)

I want to burn timestamp from the video meta data on to the video.

I'm having great difficulty in finding a good tool that does that.

Is there a video editing tool out there that allows timestamp to be inserted and change the font of it?

I am editing HD videos.

Also is there a tool out there that allows changing the timestamp on the meta data for correction?

**Tags:** video-editor, timecode, premiere-elements

> **Comments:**
> **username_1**: dunno if stackexchange will notify you about my comment on my answer, that I mostly re-wrote it.  Well anyway, it sucked so I did.  Commenting here because I know that will pop up a notification for you.  
> **username_2**: possible duplicate of [Adding a time stamp to a video](http://video.stackexchange.com/questions/4108/adding-a-time-stamp-to-a-video)  

---

## 4 answers

### Answer by username_1 on 2015-02-23. Score: 4

FFmpeg's `drawtext` filter can burn timecodes into frames.

edit: I misread the docs before. I saw the `timecode` option to the filter, and missed seeing that there was a `pts` available for text expansion. See the edit history for the longer-and-less-useful answer.

I eventually got around to trying it, and here's the command line I cobbled together from pasting and tweaking some examples:

`ffmpeg -i /f/p/moto-g\ camera/VID_20141225_140557099.mp4 -filter_complex "drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='frame %{n}\\: %{pict_type}\\: pts=%{pts \\: hms}': x=100: y=50: fontsize=24: fontcolor=yellow@0.8: box=1: boxcolor=blue@0.9" -c:a copy -c:v libx264 -preset veryfast -crf 16 -x264-params keyint=60 -map 0 foo.mkv`

Note the actual text to be printed needs a lot of escaping, to protect it from the shell, then from ffmpeg's arg-to-`drawtext`. To modify it, change the `text='frame %{n}\\: %{pict_type}\\: pts=%{pts \\: hms}'` part of that ffmpeg command.

example output: "frame 0: I: pts=00:00:00.0000" (I/B/P are frame types, from `%{pict_type}`.)

Modify `x` and `y` to put it somewhere else in the frame. (you can use `x=iw/2` to put it horizontally in the middle. `iw` = input width. (anchor = top left corner of the text, I think?)) Modify other params to change colors or whatnot.

This works even with VFR video. I checked with video from the camera in a Moto G phone, which makes variable frame-rate video. The first second has 30 frames. A later 1-sec interval in the video has 17 frames. (Indoors, not very well lit, so I think it's lower FPS to get more light, not because it can't write to flash storage fast enough.) The timestamps it puts in the MP4 container are correct, so it plays fine.

The encode parameters `-c:a copy -c:v libx264 -preset faster -crf 16 -x264-params keyint=60` are my suggestion for what you might want for scratch files with timestamps burned in: you just want it to encode fast, and don't care much about filesize since you're just going to use it locally, since it has timestamps scribbled all over it. (There's even a superfast. Don't use ultrafast except for lossless mode, though.)

`keyint=60` will make sure there's an I frame at least as often as every 60 frames, for efficient scrubbing. Leave it out if you don't need to be able to efficiently framestep backwards; lower it if you want high-rez seeking to be faster.

Use `-map 0` if you want multiple audio and metadata streams copied into the output, instead of just the first audio and first video tracks (and no e.g. chapter metadata).

> **Comments:**
> **username_1**: basically re-did my answer, because I mis-read the docs the first time.  >.<  turns out ffmpeg can burn in timestamps without needing to be told the FPS or anything stupid like that.  
> **username_0**: Thanks @peter-cordes . FFmpeg looks amazing - just checked out their website. But it does look quite complex and requires lots of pure coding :S  
> **username_1**: Heh, it *took* lots of coding to write, but using it is at the simplest just a matter of finding a recipe and then using it on different input files.  On Mac, Windows, or GNU/Linux, you could set something up to let you drag a file onto a script, so the script runs ffmpeg on your file, making a new output file named `in_name-timestamped.mp4` or something.  Probably easier to do it from within the editing tool you already use, though, if it formats the timestamps in a way you like.  
> **username_3**: Screenshot please?  
> **username_1**: On Windows, if you put a Shortcut to a .bat on your desktop, dragging a file onto it will run the .bat with the dragged file as a command line arg.  So you write a bat file that uses `%1` as input and `timestamped-%1` as output.  On GNU/Linux, you either put your command in a shell script and use it from the command line yourself, or you make a `.desktop` file that lets you send files to it from a graphical file browser.  I assume something similar is possible on OS X.  
> **username_0**: I went away to learn bit about the ffmpeg and the installation. I now know some basic stuff! @PeterCordes  
> **username_0**: I using windows so I changed the font location to this:  ffmpeg -i in.mts -filter_complex "drawtext=fontfile=/Windows/Fonts/arial.ttf: text='frame %{n}\\: %{pict_type}\\: pts=%{pts \\: hms}': x=100: y=50: fontsize=24: fontcolor=yellow@0.8: box=1: boxcolor=blue@0.9" -c:a copy -c:v libx264 -preset veryfast -crf 16 -x264-params keyint=60 -map 0 out3.avi  
> **username_0**: But I got this error:  [Parsed_drawtext_0 @ 03ba4060] Option 'pts' not found [AVFilterGraph @ 03d8b8a0] Error initializing filter 'drawtext' with args 'fontfile=/Windows/Fonts/a rial.ttf: text=frame %{n}\\: %{pict_type}\\: pts=%{pts \\: hms}: x=100: y=50: fontsize=24: fontcolor =yellow@0.8: box=1: boxcolor=blue@0.9' Error configuring filters.  
> **username_0**: Do you know what this error is and how to resolve? @PeterCordes  
> **username_1**: Your commandline, copy/pasted into a shell and changing the input file and font, works for me.  My quoting works for a Unix shell, I guess DOS cmd.exe has different quoting rules.  (Or actually, I think cmd.exe passes the entire arg as one string, and every program needs to do its own quote-removal.)  I don't have a working Windows with ffmpeg setup right now.  
> **username_1**: However, I can tell you what the command line ffmpeg sees should be:  I ran echo ffmpeg ..., so see what happens after bash's quote remval.  `ffmpeg -i in.mts -filter_complex drawtext=fontfile=/Windows/Fonts/arial.ttf: text='frame %{n}\: %{pict_type}\: pts=%{pts \: hms}': x=100: y=50: fontsize=24: fontcolor=yellow@0.8: box=1: boxcolor=blue@0.9 -c:a copy -c:v libx264 -preset veryfast -crf 16 -x264-params keyint=60 -map 0 out3.avi`  
> **username_1**: If I were you, I'd get a decent Unix shell for windows.  Git comes with bash compiled with mingw.  (http://git-scm.com/download/win)  Not a full cygwin bash, just minimal port to windows.  The installer sets up "new git bash here" context menu entries for folders for explorer, too.  It still runs in a DOS text window, instead of a decent terminal emulator, so copy/pasting sucks a bit, but it's pretty usable and very lightweight.   The other option, of course, is to figure out how to quote your command for `cmd.exe`. :P  
> **username_1**: BTW, I guess quoting is problem error, rather than a version of ffmpeg that doesn't support pts, because your error message says ffmpeg was interpreting `pts` as an option to the drawtext filter, NOT as part of the string argument to the `text` option.  So the `:` in the text arg must not have been getting quoted properly.  Probably a difference in how `\\\` inside double quotes is handled in bourne shell vs. DOS.  
> **username_1**: Also, don't put h.264 into .avi containers, unless you need to.  mkv is a nicer container, and so is mp4.  AVI doesn't really properly support B frames (which can reference future frames).  Video streams are stored in decode order.  With B frames, that's not the same as display order.  IIRC, this is what makes B frames (even xvid with b frames) in avi a hack.  

---

### Answer by username_4 on 2015-02-22. Score: 4

Video editing software usually DOES come with this ability. After Effects, Premiere, Vegas, etc, all support doing this very simply. Some of them add their own time code rather than time code from meta, so you may have to adjust the start point to match your actual time code, but the end result should still be the same.

For example, in Premiere, the following screen shot shows the effect under Video Effects/Video/Timecode as well as the options associated with it.
![enter image description here](https://i.sstatic.net/PxONu.jpg)

It is worth mentioning that in Premiere, it does appear that the font is fixed on arial, though size and position can be adjusted. After Effects, however, will allow for font of your choosing.

> **Comments:**
> **username_0**: Hi, thanks for your reply. Can you give me bit more info on how to apply the timestamp on to it on premier?  
> **username_4**: @username_0 - updated my answer to include a screen shot with where the effect is, what the settings are and how it looks.  

---

### Answer by username_5 on 2015-04-05. Score: 0

Another option is Sony Vegas Pro + Vegasaur extension.
Using this extension, you can [extract recorded date/time information](http://vegasaur.com/recorded-date-time-subtitles) from video files and burn it onto video. Font, color, size etc. - fully customizable.

![enter image description here](https://i.sstatic.net/J9nhI.png)


---

### Answer by username_6 on 2017-08-17. Score: -1

Try Davinci Resolve. Very easy and capable burn in capability.
See my video tutorial on how to use this helpful feature.Thank you.
Dan Benson

> **Comments:**
> **username_4**: Hi Daniel, welcome to Video.SE.  Could you include at least a basic level of detail in your answer here.  Video tutorials are great, but if off-site links go dead, then this will no longer provide an answer.  Due to this, answers that don't provide at least a basic explanation of the external resource may be down voted or deleted.  

---

