From patchwork Sun Jun 12 22:44:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 36187 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1a22:b0:84:42e0:ad30 with SMTP id cj34csp195037pzb; Sun, 12 Jun 2022 15:45:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQLFPiOzILCPJ/HSTB8pCXEHo1L6/0Q+JpVvctOvflSM/u+YdNKgowfMp1Ove1pUMdaMFO X-Received: by 2002:a17:906:38d0:b0:715:8483:e01e with SMTP id r16-20020a17090638d000b007158483e01emr4596082ejd.265.1655073926582; Sun, 12 Jun 2022 15:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655073926; cv=none; d=google.com; s=arc-20160816; b=dMST81koL54EtGZ+EWQnUuGyMXRMsg3CaZ1bgWcGCVAPATLCWnOHbOdTGxNl7xgYht M0CKFaP6fo6XUrb5C+FLjF4rxV5dmAMWSpAAkSfXHxtSWf+dVLG83CpEZT8x8k7ggIFk UiqWUChlB+t706C6UE+eIjKdtEzjn4/DHFHDXMO58Nrh/nI2jdxpAtdPUwt1uwcc6MdO rHLIP2McEkuSZWWFdpXlZJQYIDaRwCQe1MPZWNb2fpgTXpls8gnH7YiZvWVAWewcC1ZV bgFY4QEMNzcY1KFqZ8ZIQbQTX5cyRtzEhx/6yOKqcTb4/oMI0WcQ2h42wgb8t77PCRwY b10g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=vblLxLC0LrPji6P7TbmEEN4d7fHj/1EuN9rPhyAM3JY=; b=M3d+y7oEM9bolR/JllETcebwW4pPlLIH4UiMt2GsGYPmiURznbD3rWTX7cxaCPRjdn VD9/NtjsVnYYKvIWiO3vvuL2vxtsclprz6/Slr1sCq4yuPgFMDG8Db/rahcHIXWE4FxT 8F+Lm1Fd67GNSMSUm9hggTapASSyz3vECAa8AIULboTCjERAW3IXs/+Pj3qh4dARW+Bw Ip1lPj8rD8uF2ur1+tveN2fKWmlquCeLWMNbykTIc7WG6OZlKrjiolOGkrFFU8vVZu7R 7y6rjz2O4RvfvBKBrb1RWJJASbVBgiGqoH3xw9XsW58AiMvRVFmRi8kxpsOOwiUP0stV IERw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n9-20020a17090673c900b006ffa19a00c8si5700259ejl.184.2022.06.12.15.45.26; Sun, 12 Jun 2022 15:45:26 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8D04168B586; Mon, 13 Jun 2022 01:45:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 431D568B4BB for ; Mon, 13 Jun 2022 01:45:04 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 48144E73D0; Mon, 13 Jun 2022 00:44:55 +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 hZjpqGqb2LMi; Mon, 13 Jun 2022 00:44:53 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 299BBE73CF; Mon, 13 Jun 2022 00:44:53 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Jun 2022 00:44:48 +0200 Message-Id: <20220612224449.23333-1-cus@passwd.hu> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/img2enc: fix first image check 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 Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: qz9MvfhBpMZp Start image number was hardcoded to 1 for the first image check. Signed-off-by: Marton Balint --- libavformat/img2enc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c index b3a0801ec9..82a04e639b 100644 --- a/libavformat/img2enc.c +++ b/libavformat/img2enc.c @@ -36,6 +36,7 @@ typedef struct VideoMuxData { const AVClass *class; /**< Class for private options. */ + int start_img_number; int img_number; int split_planes; /**< use independent file for each Y, U, V plane */ char tmp[4][1024]; @@ -69,6 +70,7 @@ static int write_header(AVFormatContext *s) &&(desc->flags & AV_PIX_FMT_FLAG_PLANAR) && desc->nb_components >= 3; } + img->img_number = img->start_img_number; return 0; } @@ -162,7 +164,7 @@ 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 > 1) { + 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", @@ -246,7 +248,7 @@ static int query_codec(enum AVCodecID id, int std_compliance) #define ENC AV_OPT_FLAG_ENCODING_PARAM static const AVOption muxoptions[] = { { "update", "continuously overwrite one file", OFFSET(update), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC }, - { "start_number", "set first number in the sequence", OFFSET(img_number), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, INT_MAX, ENC }, + { "start_number", "set first number in the sequence", OFFSET(start_img_number), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, INT_MAX, ENC }, { "strftime", "use strftime for filename", OFFSET(use_strftime), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC }, { "frame_pts", "use current frame pts for filename", OFFSET(frame_pts), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC }, { "atomic_writing", "write files atomically (using temporary files and renames)", OFFSET(use_rename), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC },