Also warn the user that for single images -update should be used, for sequences a proper pattern should be specified. Fixes ticket #9748.
Unified · Split
| @@ -163,13 +163,17 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) · 162 unmodified lines | ||
| 163 | 163 | } |
| 164 | 164 | } else if (av_get_frame_filename2(filename, sizeof(filename), s->url, |
| 165 | 165 | img->img_number, |
| 166 | − AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0 && | |
| 167 | − img->img_number > img->start_img_number) { | |
| 168 | − av_log(s, AV_LOG_ERROR, | |
| 169 | − "Could not get frame filename number %d from pattern '%s'. " | |
| 170 | − "Use '-frames:v 1' for a single image, or '-update' option, or use a pattern such as %%03d within the filename.\n", | |
| 171 | − img->img_number, s->url); | |
| 172 | − return AVERROR(EINVAL); | |
| 166 | + AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { | |
| 167 | + if (img->img_number == img->start_img_number) { | |
| 168 | + av_log(s, AV_LOG_WARNING, "The specified filename '%s' does not contain an image sequence pattern or a pattern is invalid.\n", s->url); | |
| 169 | + av_log(s, AV_LOG_WARNING, | |
| 170 | + "Use a pattern such as %%03d for an image sequence or " | |
| 171 | + "use the -update option (with -frames:v 1 if needed) to write a single image.\n"); | |
| 172 | + av_strlcpy(filename, s->url, sizeof(filename)); | |
| 173 | + } else { | |
| 174 | + av_log(s, AV_LOG_ERROR, "Cannot write more than one file with the same name. Are you missing the -update option or a sequence pattern?\n"); | |
| 175 | + return AVERROR(EINVAL); | |
| 176 | + } | |
| 173 | 177 | } |
| 174 | 178 | for (i = 0; i < 4; i++) { |
| 175 | 179 | av_dict_copy(&options, img->protocol_opts, 0); |