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 65FC245099 for ; Wed, 4 Jan 2023 17:32:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A676068BCE3; Wed, 4 Jan 2023 19:32:39 +0200 (EET) Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C337468B99F for ; Wed, 4 Jan 2023 19:32:33 +0200 (EET) Received: by mail-ua1-f51.google.com with SMTP id f25so7714012uaa.3 for ; Wed, 04 Jan 2023 09:32:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=EfXyp+grBcmT1/A/XK3wO942/K0U1RXbDr5pBk+2hgM=; b=ivKohoDGscfcOW6nvCK1DqXIQ0vftNKbfTC2HjPpSR5GVDeyF/vxmpKWSp2tM3gPzp tBLbmNnD2JDsUda85Vj5qSOwQuo743h4XuWnhFEG9Qwhj/7ximrimRHi3CYeYA/k677T f7Qi9Ul4jlVwtmpYr5ysvky05p8uImoxkQVHhr/V2X2sOop/tsFgbLyoWokWMILVebVT +/DUxvgv8ATgn5L+PxGKWyVmRLJyE9aeQ3YXWfd+dEEIosvlQ0l9QoTdNLgz50hOkatt psPb99jxC2ds9kObLLpQ5Csxd/e+rXATzi0reu8mX5+GTvNx8RpDqfrFF/llXe/O8dAI MpYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EfXyp+grBcmT1/A/XK3wO942/K0U1RXbDr5pBk+2hgM=; b=16Av3Z6s8YrOLJWB/JSkFVPq3t5p7ZzMxQs3E2fHQ2hKcffG1Nql+mFJS6M0wg77gT bIvOT4qKV/EbzY0R66nVH2jxoODZFpy1RQ4GFgihOObBueNJZKbbxcyKSrwg4KPbG009 dWqplme6m1Zs8zTrXT1/iVTxZqCl3Ib0eAP+MvPGUAycBZ09SdMDWZIT1SSGuvseleE6 Ju3mSmx1xL7KCgBm8UGfXaA86Pf4j97EUDhg5Ex0DIxXAQD5brHWr+2R8jx+fNUN7Nhb 5Kg83kT3u4xZgtnbGKLJTnbwKJ0zAThyW5sLWyvIwMUHsM1M7oG5eSGwz7hVFQiVmvKc gkZQ== X-Gm-Message-State: AFqh2krrbos4a4O/wTos8IRwt9VHsWGh6oId0+8bsLLZQ9teCwceFCc8 TYQHtyPnAWEYhG7HOal/GErgmXaOmpb2dI5eiyUCKufD X-Google-Smtp-Source: AMrXdXuXqzcpP5cSqmuBFW6uovYSqSp3PBq7j82zeTtfdDe9n+Pqzetmbyl9Eii4ihxAz2UWuElC0nUXo//6S/E4dcM= X-Received: by 2002:ab0:1301:0:b0:444:2123:f8df with SMTP id g1-20020ab01301000000b004442123f8dfmr4595869uae.86.1672853552153; Wed, 04 Jan 2023 09:32:32 -0800 (PST) MIME-Version: 1.0 References: <20230104164246.6133-1-anton@khirnov.net> <20230104164246.6133-8-anton@khirnov.net> In-Reply-To: <20230104164246.6133-8-anton@khirnov.net> From: Paul B Mahol Date: Wed, 4 Jan 2023 18:37:31 +0100 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH 8/8] fftools/ffmpeg: always generate CFR output when -r is used 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Wed, Jan 4, 2023 at 5:46 PM Anton Khirnov wrote: > Current code may, depending on the muxer, decide to use VSYNC_VFR tagged > with the specified framerate, without actually performing framerate > conversion. This is clearly wrong and against the documentation, which > states unambiguously that -r should produce CFR output for video > encoding. > > FATE test changes: > * nuv-rtjpeg: replace -r with '-enc_time_base -1', which keeps the > original timebase. Output frames are now produced with proper > durations. > * filter-mpdecimate: just drop the -r option, it is unnecessary > * filter-fps-r: remove, this test makes no sense and actually > produces broken VFR output (with incorrect frame durations). > With this patch or even before? > --- > fftools/ffmpeg_mux_init.c | 16 +++++--- > tests/fate/filter-video.mak | 5 +-- > tests/fate/video.mak | 3 +- > tests/ref/fate/filter-fps-r | 78 ------------------------------------- > tests/ref/fate/nuv-rtjpeg | 16 ++++---- > 5 files changed, 22 insertions(+), 96 deletions(-) > delete mode 100644 tests/ref/fate/filter-fps-r > > diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c > index 0280759b05..9eea8639dc 100644 > --- a/fftools/ffmpeg_mux_init.c > +++ b/fftools/ffmpeg_mux_init.c > @@ -443,10 +443,6 @@ static OutputStream *new_video_stream(Muxer *mux, > const OptionsContext *o, Input > exit_program(1); > } > > - if ((frame_rate || max_frame_rate) && > - video_sync_method == VSYNC_PASSTHROUGH) > - av_log(NULL, AV_LOG_ERROR, "Using -vsync passthrough and > -r/-fpsmax can produce invalid output files\n"); > - > MATCH_PER_STREAM_OPT(frame_aspect_ratios, str, frame_aspect_ratio, > oc, st); > if (frame_aspect_ratio) { > AVRational q; > @@ -614,8 +610,18 @@ static OutputStream *new_video_stream(Muxer *mux, > const OptionsContext *o, Input > if (fps_mode) > parse_and_set_vsync(fps_mode, &ost->vsync_method, > ost->file_index, ost->index, 0); > > + if ((ost->frame_rate.num || ost->max_frame_rate.num) && > + !(ost->vsync_method == VSYNC_AUTO || > + ost->vsync_method == VSYNC_CFR || ost->vsync_method == > VSYNC_VSCFR)) { > + av_log(NULL, AV_LOG_FATAL, "One of -r/-fpsmax was specified " > + "together a non-CFR -vsync/-fps_mode. This is > contradictory.\n"); > + exit_program(1); > + } > + > if (ost->vsync_method == VSYNC_AUTO) { > - if (!strcmp(oc->oformat->name, "avi")) { > + if (ost->frame_rate.num || ost->max_frame_rate.num) { > + ost->vsync_method = VSYNC_CFR; > + } else if (!strcmp(oc->oformat->name, "avi")) { > ost->vsync_method = VSYNC_VFR; > } else { > ost->vsync_method = (oc->oformat->flags & > AVFMT_VARIABLE_FPS) ? > diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak > index f3c27ed1c8..63873a7a07 100644 > --- a/tests/fate/filter-video.mak > +++ b/tests/fate/filter-video.mak > @@ -365,7 +365,7 @@ FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC2 FPS > DECIMATE) += fate-filter-decimat > fate-filter-decimate: CMD = framecrc -lavfi > testsrc2=r=24:d=10,fps=60,decimate=5,decimate=4,decimate=3 -pix_fmt yuv420p > > FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC2 FPS MPDECIMATE) += > fate-filter-mpdecimate > -fate-filter-mpdecimate: CMD = framecrc -lavfi > testsrc2=r=2:d=10,fps=3,mpdecimate -r 3 -pix_fmt yuv420p > +fate-filter-mpdecimate: CMD = framecrc -lavfi > testsrc2=r=2:d=10,fps=3,mpdecimate -pix_fmt yuv420p > > FATE_FILTER-$(call FILTERFRAMECRC, FPS TESTSRC2) += $(addprefix > fate-filter-fps-, up up-round-down up-round-up down down-round-down > down-round-up down-eof-pass start-drop start-fill) > fate-filter-fps-up: CMD = framecrc -lavfi testsrc2=r=3:d=2,fps=7 > @@ -378,9 +378,8 @@ fate-filter-fps-down-eof-pass: CMD = framecrc -lavfi > testsrc2=r=7:d=3.5,fps=3:eo > fate-filter-fps-start-drop: CMD = framecrc -lavfi > testsrc2=r=7:d=3.5,fps=3:start_time=1.5 > fate-filter-fps-start-fill: CMD = framecrc -lavfi > testsrc2=r=7:d=1.5,setpts=PTS+14,fps=3:start_time=1.5 > > -FATE_FILTER_SAMPLES-$(call FILTERDEMDEC, FPS SCALE, MOV, QTRLE) += > fate-filter-fps-cfr fate-filter-fps fate-filter-fps-r > +FATE_FILTER_SAMPLES-$(call FILTERDEMDEC, FPS SCALE, MOV, QTRLE) += > fate-filter-fps-cfr fate-filter-fps > fate-filter-fps-cfr: CMD = framecrc -auto_conversion_filters -i > $(TARGET_SAMPLES)/qtrle/apple-animation-variable-fps-bug.mov -r 30 -vsync > cfr -pix_fmt yuv420p > -fate-filter-fps-r: CMD = framecrc -auto_conversion_filters -i > $(TARGET_SAMPLES)/qtrle/apple-animation-variable-fps-bug.mov -r 30 -vf fps > -pix_fmt yuv420p > fate-filter-fps: CMD = framecrc -auto_conversion_filters -i > $(TARGET_SAMPLES)/qtrle/apple-animation-variable-fps-bug.mov -vf fps=30 > -pix_fmt yuv420p > > FATE_FILTER_ALPHAEXTRACT_ALPHAMERGE := $(addprefix > fate-filter-alphaextract_alphamerge_, rgb yuv) > diff --git a/tests/fate/video.mak b/tests/fate/video.mak > index af7e77e814..d7639a3978 100644 > --- a/tests/fate/video.mak > +++ b/tests/fate/video.mak > @@ -269,9 +269,8 @@ fate-mv-sgirle: CMD = framecrc -i > $(TARGET_SAMPLES)/mv/pet-rle.movie -an > FATE_VIDEO-$(call FRAMECRC, MXG, MXPEG) += fate-mxpeg > fate-mxpeg: CMD = framecrc -idct simple -flags +bitexact -i > $(TARGET_SAMPLES)/mxpeg/m1.mxg -an > > -# FIXME dropped frames in this test because of coarse timebase > FATE_NUV += fate-nuv-rtjpeg > -fate-nuv-rtjpeg: CMD = framecrc -idct simple -i > $(TARGET_SAMPLES)/nuv/Today.nuv -an -r 1000 > +fate-nuv-rtjpeg: CMD = framecrc -idct simple -i > $(TARGET_SAMPLES)/nuv/Today.nuv -an -enc_time_base -1 > > FATE_NUV += fate-nuv-rtjpeg-fh > fate-nuv-rtjpeg-fh: CMD = framecrc -idct simple -i > $(TARGET_SAMPLES)/nuv/rtjpeg_frameheader.nuv -an > diff --git a/tests/ref/fate/filter-fps-r b/tests/ref/fate/filter-fps-r > deleted file mode 100644 > index c1bc7d1547..0000000000 > --- a/tests/ref/fate/filter-fps-r > +++ /dev/null > @@ -1,78 +0,0 @@ > -#tb 0: 1/30 > -#media_type 0: video > -#codec_id 0: rawvideo > -#dimensions 0: 112x182 > -#sar 0: 0/1 > -0, 0, 0, 1, 30576, 0xcdc29b3d > -0, 1, 1, 1, 30576, 0xcdc29b3d > -0, 2, 2, 1, 30576, 0xcdc29b3d > -0, 4, 4, 1, 30576, 0xcdc29b3d > -0, 5, 5, 1, 30576, 0xcdc29b3d > -0, 6, 6, 1, 30576, 0x5c83656c > -0, 7, 7, 1, 30576, 0x5c83656c > -0, 8, 8, 1, 30576, 0x5c83656c > -0, 10, 10, 1, 30576, 0x5c83656c > -0, 11, 11, 1, 30576, 0x5c83656c > -0, 12, 12, 1, 30576, 0x5c83656c > -0, 13, 13, 1, 30576, 0x26b67f83 > -0, 14, 14, 1, 30576, 0x26b67f83 > -0, 16, 16, 1, 30576, 0x26b67f83 > -0, 17, 17, 1, 30576, 0x26b67f83 > -0, 18, 18, 1, 30576, 0x26b67f83 > -0, 19, 19, 1, 30576, 0x26b67f83 > -0, 20, 20, 1, 30576, 0x26b67f83 > -0, 22, 22, 1, 30576, 0x26b67f83 > -0, 23, 23, 1, 30576, 0x26b67f83 > -0, 24, 24, 1, 30576, 0x26b67f83 > -0, 25, 25, 1, 30576, 0x26b67f83 > -0, 26, 26, 1, 30576, 0x26b67f83 > -0, 28, 28, 1, 30576, 0x26b67f83 > -0, 29, 29, 1, 30576, 0x26b67f83 > -0, 30, 30, 1, 30576, 0x26b67f83 > -0, 31, 31, 1, 30576, 0x26b67f83 > -0, 32, 32, 1, 30576, 0x26b67f83 > -0, 34, 34, 1, 30576, 0x26b67f83 > -0, 35, 35, 1, 30576, 0x26b67f83 > -0, 36, 36, 1, 30576, 0x26b67f83 > -0, 37, 37, 1, 30576, 0x26b67f83 > -0, 38, 38, 1, 30576, 0x26b67f83 > -0, 40, 40, 1, 30576, 0x26b67f83 > -0, 41, 41, 1, 30576, 0x26b67f83 > -0, 42, 42, 1, 30576, 0x26b67f83 > -0, 43, 43, 1, 30576, 0x26b67f83 > -0, 44, 44, 1, 30576, 0x26b67f83 > -0, 46, 46, 1, 30576, 0x26b67f83 > -0, 47, 47, 1, 30576, 0x26b67f83 > -0, 48, 48, 1, 30576, 0x26b67f83 > -0, 49, 49, 1, 30576, 0x26b67f83 > -0, 50, 50, 1, 30576, 0x26b67f83 > -0, 52, 52, 1, 30576, 0x26b67f83 > -0, 53, 53, 1, 30576, 0x26b67f83 > -0, 54, 54, 1, 30576, 0x26b67f83 > -0, 55, 55, 1, 30576, 0x26b67f83 > -0, 56, 56, 1, 30576, 0x26b67f83 > -0, 58, 58, 1, 30576, 0x26b67f83 > -0, 59, 59, 1, 30576, 0x26b67f83 > -0, 60, 60, 1, 30576, 0x26b67f83 > -0, 61, 61, 1, 30576, 0x26b67f83 > -0, 62, 62, 1, 30576, 0x26b67f83 > -0, 64, 64, 1, 30576, 0x26b67f83 > -0, 65, 65, 1, 30576, 0x26b67f83 > -0, 66, 66, 1, 30576, 0x26b67f83 > -0, 67, 67, 1, 30576, 0x26b67f83 > -0, 68, 68, 1, 30576, 0x26b67f83 > -0, 70, 70, 1, 30576, 0x26b67f83 > -0, 71, 71, 1, 30576, 0x26b67f83 > -0, 72, 72, 1, 30576, 0x26b67f83 > -0, 73, 73, 1, 30576, 0xa2fcd06f > -0, 74, 74, 1, 30576, 0xa2fcd06f > -0, 76, 76, 1, 30576, 0xa2fcd06f > -0, 77, 77, 1, 30576, 0xa2fcd06f > -0, 78, 78, 1, 30576, 0xa2fcd06f > -0, 79, 79, 1, 30576, 0xa2fcd06f > -0, 80, 80, 1, 30576, 0xa2fcd06f > -0, 82, 82, 1, 30576, 0xd4150aad > -0, 83, 83, 1, 30576, 0xd4150aad > -0, 84, 84, 1, 30576, 0xd4150aad > -0, 85, 85, 1, 30576, 0xd4150aad > -0, 86, 86, 1, 30576, 0xd4150aad > diff --git a/tests/ref/fate/nuv-rtjpeg b/tests/ref/fate/nuv-rtjpeg > index bc5af1ca22..d6093e78d8 100644 > --- a/tests/ref/fate/nuv-rtjpeg > +++ b/tests/ref/fate/nuv-rtjpeg > @@ -3,11 +3,11 @@ > #codec_id 0: rawvideo > #dimensions 0: 640x480 > #sar 0: 1/1 > -0, 118, 118, 1, 460800, 0x54aedafe > -0, 152, 152, 1, 460800, 0xb7aa8b56 > -0, 177, 177, 1, 460800, 0x283ea3b5 > -0, 202, 202, 1, 460800, 0x283ea3b5 > -0, 235, 235, 1, 460800, 0x10e577de > -0, 269, 269, 1, 460800, 0x4e091ee2 > -0, 302, 302, 1, 460800, 0x2ea88828 > -0, 335, 335, 1, 460800, 0x4b7f4df0 > +0, 118, 118, 33, 460800, 0x54aedafe > +0, 152, 152, 33, 460800, 0xb7aa8b56 > +0, 177, 177, 33, 460800, 0x283ea3b5 > +0, 202, 202, 33, 460800, 0x283ea3b5 > +0, 235, 235, 33, 460800, 0x10e577de > +0, 269, 269, 33, 460800, 0x4e091ee2 > +0, 302, 302, 33, 460800, 0x2ea88828 > +0, 335, 335, 33, 460800, 0x4b7f4df0 > -- > 2.35.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".