From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 35F0143653 for ; Mon, 20 Jun 2022 21:31:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 092B568B62B; Tue, 21 Jun 2022 00:31:44 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E59AE68B335 for ; Tue, 21 Jun 2022 00:31:37 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 444DFE747C for ; Mon, 20 Jun 2022 23:31:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BhMs0qDocguK for ; Mon, 20 Jun 2022 23:31:36 +0200 (CEST) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 16A74E6FA6 for ; Mon, 20 Jun 2022 23:31:36 +0200 (CEST) Date: Mon, 20 Jun 2022 23:31:36 +0200 (CEST) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <20220612224449.23333-2-cus@passwd.hu> Message-ID: <435abbbb-6fbc-a2d1-8adb-aa4a5fe9dbfb@passwd.hu> References: <20220612224449.23333-1-cus@passwd.hu> <20220612224449.23333-2-cus@passwd.hu> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 2/2] avformat/img2enc: use unmatched filename for an invalid or missing sequence pattern X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Mon, 13 Jun 2022, Marton Balint wrote: > Also warn the user that for single images -update should be used, for sequences > a proper pattern should be specified. > > Fixes ticket #9748. Ping for this. Note that this patch will show a warning for any non-sequence image filename (unless the -update option is specified) in order to help the user avoid unexpected results with filenames containing %d. Regards, Marton > > Signed-off-by: Marton Balint > --- > libavformat/img2enc.c | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c > index 82a04e639b..50e469dd96 100644 > --- a/libavformat/img2enc.c > +++ b/libavformat/img2enc.c > @@ -163,13 +163,17 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) > } > } else if (av_get_frame_filename2(filename, sizeof(filename), s->url, > img->img_number, > - AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0 && > - img->img_number > img->start_img_number) { > - av_log(s, AV_LOG_ERROR, > - "Could not get frame filename number %d from pattern '%s'. " > - "Use '-frames:v 1' for a single image, or '-update' option, or use a pattern such as %%03d within the filename.\n", > - img->img_number, s->url); > - return AVERROR(EINVAL); > + AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { > + if (img->img_number == img->start_img_number) { > + 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); > + av_log(s, AV_LOG_WARNING, > + "Use a pattern such as %%03d for an image sequence or " > + "use the -update option (with -frames:v 1 if needed) to write a single image.\n"); > + av_strlcpy(filename, s->url, sizeof(filename)); > + } else { > + 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"); > + return AVERROR(EINVAL); > + } > } > for (i = 0; i < 4; i++) { > av_dict_copy(&options, img->protocol_opts, 0); > -- > 2.34.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".