diff options
author | Alexandre Heitor Schmidt <alexandre.schmidt@gmail.com> | 2020-01-01 16:57:02 +0000 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2020-01-10 23:08:18 +0100 |
commit | ae436cc5e4d75c1a7deefb2b30820486e2f3d8af (patch) | |
tree | 7af074782f4590de4a57f960a3ca993ac517a610 /doc | |
parent | ad1b0a12f34d57ed5bfb952ce67bce8f48b3ec0e (diff) | |
download | ffmpeg-ae436cc5e4d75c1a7deefb2b30820486e2f3d8af.tar.gz |
avformat/img2dec: add option to provide metadata fields related to input path
libavformat/img2.h: New field export_path_metadata to
VideoDemuxData to only allow the use of the extra metadata
upon explicit user request, for security reasons.
libavformat/img2dec.c: Modify image2 demuxer to make available
two special metadata entries called lavf.image2dec.source_path
and lavf.image2dec.source_basename, which represents, respectively,
the complete path to the source image for the current frame and
the basename i.e. the file name related to the current frame.
These can then be used by filters like drawtext and others. The
metadata fields will only be available when explicitly enabled
with image2 option -export_path_metadata 1.
doc/demuxers.texi: Documented the new metadata fields available
for image2 and how to use them.
doc/filters.texi: Added an example on how to use the new metadata
fields with drawtext filter, in order to plot the input file path
to each output frame.
Usage example:
ffmpeg -f image2 -export_path_metadata 1 -pattern_type glob
-framerate 18 -i '/path/to/input/files/*.jpg'
-filter_complex drawtext="fontsize=40:fontcolor=white:
fontfile=FreeSans.ttf:borderw=2:bordercolor=black:
text='%{metadata\:lavf.image2dec.source_basename\:NA}':x=5:y=50"
output.avi
Fixes #2874.
Signed-off-by: Alexandre Heitor Schmidt <alexandre.schmidt@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/demuxers.texi | 11 | ||||
-rw-r--r-- | doc/filters.texi | 9 |
2 files changed, 20 insertions, 0 deletions
diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 0d13bdd1b3..2de14b68d3 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -456,6 +456,17 @@ nanosecond precision. @item video_size Set the video size of the images to read. If not specified the video size is guessed from the first image file in the sequence. +@item export_path_metadata +If set to 1, will add two extra fields to the metadata found in input, making them +also available for other filters (see @var{drawtext} filter for examples). Default +value is 0. The extra fields are described below: +@table @option +@item lavf.image2dec.source_path +Corresponds to the full path to the input file being read. +@item lavf.image2dec.source_basename +Corresponds to the name of the file being read. +@end table + @end table @subsection Examples diff --git a/doc/filters.texi b/doc/filters.texi index 6fb660b05a..a2f862e85f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -9932,6 +9932,15 @@ drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a, drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a @end example +@item +Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if +such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer +must have option @option{-export_path_metadata 1} for the special metadata fields +to be available for filters. +@example +drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10" +@end example + @end itemize For more information about libfreetype, check: |