From: Xiaolei Yu <dreifachstein@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] ffmpeg: fix increment of sync_opts Date: Thu, 8 Sep 2022 17:51:10 +0800 Message-ID: <bf9be598-56a1-3461-37c3-79df4fb09cb7@gmail.com> (raw) The encoder time base could been overridden by the command line argument and may not always be 1/ost->frame_rate. --- fftools/ffmpeg.c | 2 +- tests/fate/ffmpeg.mak | 5 +++++ tests/ref/fate/enc_time_base-vfr | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/enc_time_base-vfr diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 0e1477299d..8bc48125c8 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1344,7 +1344,7 @@ static void do_video_out(OutputFile *of, if (ret < 0 && ret != AVERROR_EOF) exit_program(1); - ost->sync_opts++; + ost->sync_opts += av_rescale_q(1, av_inv_q(ost->frame_rate), ost->enc_ctx->time_base); ost->vsync_frame_number++; } diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak index 38a1ae7ed5..a3be79d65e 100644 --- a/tests/fate/ffmpeg.mak +++ b/tests/fate/ffmpeg.mak @@ -209,3 +209,8 @@ FATE_TIME_BASE-$(call PARSERDEMDEC, MPEGVIDEO, MPEGPS, MPEG2VIDEO, MPEGVIDEO_DEM fate-time_base: CMD = md5 -i $(TARGET_SAMPLES)/mpeg2/dvd_single_frame.vob -an -sn -c:v copy -r 25 -time_base 1001:30000 -fflags +bitexact -f mxf FATE_SAMPLES_FFMPEG-yes += $(FATE_TIME_BASE-yes) + +FATE_ENC_TIME_BASE-$(call ALLYES, LAVFI_INDEV COLOR_FILTER FRAMEMD5_MUXER) += fate-enc_time_base-vfr +fate-enc_time_base-vfr: CMD = framemd5 -auto_conversion_filters -fflags +bitexact -flags +bitexact -f lavfi -i "color=r=30:d=1" -enc_time_base 1/600 -fps_mode vfr -r 15 + +FATE_SAMPLES_FFMPEG-yes += $(FATE_ENC_TIME_BASE-yes) diff --git a/tests/ref/fate/enc_time_base-vfr b/tests/ref/fate/enc_time_base-vfr new file mode 100644 index 0000000000..cb38177d8e --- /dev/null +++ b/tests/ref/fate/enc_time_base-vfr @@ -0,0 +1,25 @@ +#format: frame checksums +#version: 2 +#hash: MD5 +#tb 0: 1/600 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 320x240 +#sar 0: 1/1 +#stream#, dts, pts, duration, size, hash +0, 0, 0, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 40, 40, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 80, 80, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 120, 120, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 160, 160, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 200, 200, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 240, 240, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 280, 280, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 320, 320, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 360, 360, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 400, 400, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 440, 440, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 480, 480, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 520, 520, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 560, 560, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 +0, 600, 600, 40, 115200, 8e4dd5c5c31a54672e30503f6ee13321 -- 2.37.2 _______________________________________________ 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".
reply other threads:[~2022-09-08 9:51 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bf9be598-56a1-3461-37c3-79df4fb09cb7@gmail.com \ --to=dreifachstein@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git