Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Nicolas George <george@nsup.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] libavfilter/f_select: switch to activate and properly handle EOF pts
Date: Wed, 14 Sep 2022 20:14:55 +0200
Message-ID: <YyIaHwy5VTPYT75+@phare.normalesup.org> (raw)
In-Reply-To: <CAC1ZW2gD0+3P_G9BS-4mpjwmiXK-5AavEkdjyRZpQ9PF6WyAXQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2238 bytes --]

Li-Heng Chen (12022-09-14):
> Thanks for the comment, Nicolas! I've attached a new patch file which
> should address the comments. I also want to mention that this patch is
> similar to another one Paul had done for setpts filter:
> http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=2a546fb7d5722c306dd42c715137e5e493b0d5be

It is similar in its form, but the logic is very different: Paul's
commit has the function evaluated for the final timestamps.

> The attached patch should have the commit message wrapped, and I
> have also added a comment in the code to explain the logic:
> /* Two conditions that current pts could be the EOF pts:
> * - If the current frame N is not selected while the previous
> * frame (N-1) is selected, frame N-1 could be the last frame,
> * hence we update select->eof_pts.
> * - Last input frame: we have EOF status, and the current (last)
> * frame is selected */

Thanks for explaining. Unfortunately, it confirms my analysis that your
logic is slightly flawed.

Consider a select filter that keeps only the frames with a PTS that is a
prime number. The frame with PTS 13 used to extend in the timeline of
the stream from 13 inclusive to 14 exclusive. Now it extends from 13
inclusive to 17 exclusive; the timestamp 14 was completely skipped.

There is no reason that a EOF arriving a little after that would change
that and make the filter re-consider 14: the frame 14 was skipped, its
PTS should not be considered.

> This patch does not change the frame timestamps. Instead, we added
> another variable select->eof_pts to track possible EOF pts. It sets the
> EOF pts as the pts *after* the last selected frame (e.g. if the last frame
> selected by the filter is frame 20, EOF pts is set as the pts of frame 21)

Which means it sets the EOF PTS at the timestamp of a frame that was
dropped. This is not logical.

> I have also tested the trim filter, which does not present this bug. However,
> if you do -vf select='eq(n\,24)',fps=25/1 on the above example, this selected
> frame will also be duplicated 21 times, which is also not an expected behavior
> for the select filter.

I consider it the correct behavior.

Regards,

-- 
  Nicolas George

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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-14 18:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 20:50 Li-Heng Chen
2022-09-14 15:14 ` Nicolas George
2022-09-14 18:03   ` Li-Heng Chen
2022-09-14 18:14     ` Nicolas George [this message]
2022-09-14 20:26       ` Li-Heng Chen
2022-09-15  9:41         ` Nicolas George
2022-09-15 16:42           ` Li-Heng Chen
2022-09-14 19:02   ` [FFmpeg-devel] Unsubscribe Sam Davis

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=YyIaHwy5VTPYT75+@phare.normalesup.org \
    --to=george@nsup.org \
    --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