Commit Graph

8 Commits

Author SHA1 Message Date
Alexandre Heitor Schmidt
ae436cc5e4 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>
2020-01-10 23:08:18 +01:00
Michael Niedermayer
7ccedc1c78 avformat/img2dec: do not interpret the filename by default if a IO context has been opened
With this, user applications which use custom IO and have set a IO context will not have
their already opened IO context ignored and glob/seq being interpreted

Comments and tests from maintainers of user apps are welcome!

Liked-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-20 17:31:01 +01:00
tab
fb135139fd avformat: implement query_codec for the image2 muxer.
Allows avformat_query_codec to be used to check for valid image2 encoders.
Reuses the existing ff_guess_image2_codec ID table.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-07 02:48:58 +02:00
Marton Balint
93cc5ca7ed lavf/img2dec: add option to disable pattern matching
Signed-off-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-12 13:32:23 +02:00
Michael Niedermayer
7c6b0436b6 avformat/img2: Change enum to int, which is accessed via AVOption as int
This fixes depending on implementation defined behavior

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-30 00:08:57 +02:00
Michael Niedermayer
a0fe1a25fa Merge commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e'
* commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e':
  avformat: Don't anonymously typedef structs

Conflicts:
	libavformat/adtsenc.c
	libavformat/aiffenc.c
	libavformat/avidec.c
	libavformat/gif.c
	libavformat/iff.c
	libavformat/img2dec.c
	libavformat/jvdec.c
	libavformat/matroskadec.c
	libavformat/udp.c
	libavformat/wtvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 21:07:40 +01:00
Michael Niedermayer
5303a644f5 avformat/img2: Make AVOptions available to img* demuxers defined in other files
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-11 15:10:15 +02:00
Michael Niedermayer
067a9cf81a avformat/img2dec: make image2dec capable to be used from seperate demuxers
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-28 23:54:51 +01:00