• Alexandre Heitor Schmidt's avatar
    avformat/img2dec: add option to provide metadata fields related to input path · ae436cc5
    Alexandre Heitor Schmidt authored
    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: 's avatarAlexandre Heitor Schmidt <alexandre.schmidt@gmail.com>
    Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
    ae436cc5
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...