First of all, make sure your file has the tags you want to use in a manner ffmpeg can understand. Like this:
ffprobe -i file.jpg -show_entries frames
This will output something like this:
.
.
.
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
best_effort_timestamp=0
best_effort_timestamp_time=0.000000
pkt_duration=1
pkt_duration_time=0.040000
pkt_pos=N/A
pkt_size=40439
width=501
height=493
pix_fmt=yuvj420p
sample_aspect_ratio=1:1
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]
In this specific example, there is no creation time (CreateDate) in the file, so ffmpeg won't be able to do anything for you.
But now suppose you have a file with the metadata you want. Then, the output will be, for example:
.
.
.
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
best_effort_timestamp=0
best_effort_timestamp_time=0.000000
pkt_duration=1
pkt_duration_time=0.040000
pkt_pos=N/A
pkt_size=40681
width=501
height=493
pix_fmt=yuvj420p
sample_aspect_ratio=1:1
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
TAG:XResolution= 72:1
TAG:YResolution= 72:1
TAG:ResolutionUnit= 2
TAG:DateTime=2015:12:17 19:28:47
TAG:YCbCrPositioning= 1
TAG:ExifVersion= 48, 50, 49, 48
TAG:DateTimeDigitized=2015-01-01 00:00:00
TAG:ComponentsConfiguration= 1, 2, 3, 0
TAG:FlashpixVersion= 48, 49, 48, 48
TAG:ColorSpace=65535
TAG:PixelXDimension= 0
TAG:PixelYDimension= 0
[/FRAME]
Here you can notice the lines prefixed by TAG:
. These are the lines ffmpeg will like. With those, you can use this:
ffmpeg -f image2 -pattern_type glob -framerate 20 -i "myfiles*.jpg" -filter_complex "drawtext='fontfile=/usr/share/fonts/truetype/msttcorefonts/Arial.ttf:fontsize=32:fontcolor=yellow:borderw=2:bordercolor=black:x=10:y=10:text=%{metadata\:DateTimeDigitized}'" "out.avi"
Breaking that in parts:
-f image2
Use "image2" file demuxer.
-pattern_type glob -i "myfiles*.jpg"
Get all files matching global pattern "myfiles*.jpg"
drawtext=
Enable "drawtext" filter.
fontfile=/usr/share/fonts/truetype/msttcorefonts/Arial.ttf
Font to use.
fontsize=32
Font size.
fontcolor=yellow
Font color.
borderw=2
Draw a 2px border around text.
bordercolor=black
Border will be black.
x=10
Start text 10px from left side of video.
y=10
Start text 10px from top of video.
text=%{metadata\:DateTimeDigitized}
Text to be renderized, which, in this case, will be taken from "DateTimeDigitized" metadata, contained in source file.
"out.avi"
The output file name.
Well, that's it. Hope that helps!