summaryrefslogtreecommitdiff
path: root/libavformat/img2enc.c
diff options
context:
space:
mode:
authorrogerdpack <rogerpack2005@gmail.com>2016-10-25 18:33:12 -0600
committerMichael Niedermayer <michael@niedermayer.cc>2016-11-01 22:29:23 +0100
commit1a956c64c8eff5edecb004fc7aafd21207e6485c (patch)
tree50251e57f361a9bb3cab04a9c14272aa87e5cddb /libavformat/img2enc.c
parent7ddfa0be6298d1713b809eadbc91820bca1a99be (diff)
img2 encoder: allow %t in filename, based on patch from Yuval Adam
Signed-off-by: rogerdpack <rogerpack2005@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/img2enc.c')
-rw-r--r--libavformat/img2enc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index 1297b1aaba..69dbebe861 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -80,10 +80,12 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
VideoMuxData *img = s->priv_data;
AVIOContext *pb[4];
char filename[1024];
- AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
+ AVStream *stream = s->streams[ pkt->stream_index ];
+ AVCodecParameters *par = stream->codecpar;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(par->format);
int i;
int nb_renames = 0;
+ int64_t ts = av_rescale_q(pkt->pts, stream->time_base, AV_TIME_BASE_Q);
if (!img->is_pipe) {
if (img->update) {
@@ -99,7 +101,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
}
} else if (av_get_frame_filename2(filename, sizeof(filename), img->path,
img->img_number,
- AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0 &&
+ AV_FRAME_FILENAME_FLAGS_MULTIPLE, ts) < 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",