diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-11 21:49:26 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-11 21:50:53 +0200 |
commit | 647fe2e77733edf6e3a15c490056211bc38ccc20 (patch) | |
tree | 3387124478a584b39080e590c7f703b3fc230949 | |
parent | 976e3439ed992b8e06e3737642448a3935b148e4 (diff) | |
parent | 9e6b5e61a0c91e25e298d0a21b189c4c95443795 (diff) | |
download | ffmpeg-647fe2e77733edf6e3a15c490056211bc38ccc20.tar.gz |
Merge commit '9e6b5e61a0c91e25e298d0a21b189c4c95443795'
* commit '9e6b5e61a0c91e25e298d0a21b189c4c95443795':
img2enc: add an option for overwriting one file with subsequent images
Conflicts:
doc/muxers.texi
libavformat/img2enc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | doc/muxers.texi | 8 | ||||
-rw-r--r-- | libavformat/img2enc.c | 11 |
2 files changed, 12 insertions, 7 deletions
diff --git a/doc/muxers.texi b/doc/muxers.texi index 9d119c39a1..f1274948f8 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -245,9 +245,11 @@ ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg Start the sequence from @var{number}. Default value is 1. Must be a positive number. -@item updatefirst 1|0 -If set to 1, update the first written image file again and -again. Default value is 0. +@item -update @var{number} +If @var{number} is nonzero, the filename will always be interpreted as just a +filename, not a pattern, and this file will be continuously overwritten with new +images. + @end table The image muxer supports the .Y.U.V image file format. This format is diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c index 67b5819dc9..fb297da20b 100644 --- a/libavformat/img2enc.c +++ b/libavformat/img2enc.c @@ -36,7 +36,7 @@ typedef struct { int is_pipe; int split_planes; /**< use independent file for each Y, U, V plane */ char path[1024]; - int updatefirst; + int update; } VideoMuxData; static int write_header(AVFormatContext *s) @@ -75,8 +75,10 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) int i; if (!img->is_pipe) { - if (av_get_frame_filename(filename, sizeof(filename), - img->path, img->img_number) < 0 && img->img_number > 1 && !img->updatefirst) { + if (img->update) { + av_strlcpy(filename, img->path, sizeof(filename)); + } else if (av_get_frame_filename(filename, sizeof(filename), img->path, img->img_number) < 0 && + img->img_number > 1) { av_log(s, AV_LOG_ERROR, "Could not get frame filename number %d from pattern '%s' (either set updatefirst or use a pattern like %%03d within the filename pattern)\n", img->img_number, img->path); @@ -128,7 +130,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) #define OFFSET(x) offsetof(VideoMuxData, x) #define ENC AV_OPT_FLAG_ENCODING_PARAM static const AVOption muxoptions[] = { - { "updatefirst", "update the first image file", OFFSET(updatefirst), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, ENC }, + { "updatefirst", "continuously overwrite one file", OFFSET(update), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, ENC }, + { "update", "continuously overwrite one file", OFFSET(update), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, ENC }, { "start_number", "set first number in the sequence", OFFSET(img_number), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, ENC }, { NULL }, }; |