History

avformat/img2enc: use unmatched filename for an invalid or missing sequence pattern

Also warn the user that for single images -update should be used, for sequences a proper pattern should be specified. Fixes ticket #9748.

Marton Balint committed 4 years ago

Commit b54f3e31 parent 3f2de561 file · +11 −7Browse files

Unified · Split

libavformat/img2enc.c+11−7
@@ -163,13 +163,17 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) · 162 unmodified lines
163163 }
164164 } else if (av_get_frame_filename2(filename, sizeof(filename), s->url,
165165 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+ }
173177 }
174178 for (i = 0; i < 4; i++) {
175179 av_dict_copy(&options, img->protocol_opts, 0);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t